Skip to content

Commit ef598b1

Browse files
rustammendeldavidvincze
authored andcommitted
imgtool: Fix getpub fails for ed25519 key
Fix getpub command fails to emit public pair of ed25519 key with encoding. Signed-off-by: Rustam Ismayilov <[email protected]> Change-Id: I3d255f576b2d8a8d0cbc8e31ff378717acb060c7
1 parent 078874f commit ef598b1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

scripts/imgtool/keys/ed25519.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
# SPDX-License-Identifier: Apache-2.0
66

7-
from cryptography.hazmat.backends import default_backend
87
from cryptography.hazmat.primitives import serialization
98
from cryptography.hazmat.primitives.asymmetric import ed25519
109

@@ -34,6 +33,11 @@ def get_public_bytes(self):
3433
encoding=serialization.Encoding.DER,
3534
format=serialization.PublicFormat.SubjectPublicKeyInfo)
3635

36+
def get_public_pem(self):
37+
return self._get_public().public_bytes(
38+
encoding=serialization.Encoding.PEM,
39+
format=serialization.PublicFormat.SubjectPublicKeyInfo)
40+
3741
def get_private_bytes(self, minimal, format):
3842
self._unsupported('get_private_bytes')
3943

0 commit comments

Comments
 (0)