From 32e678fec414036c35c1007680988d34c024dc5f Mon Sep 17 00:00:00 2001 From: Rustam Ismayilov Date: Thu, 11 Jul 2024 11:50:13 +0200 Subject: [PATCH] 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 Change-Id: I3d255f576b2d8a8d0cbc8e31ff378717acb060c7 --- scripts/imgtool/keys/ed25519.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/imgtool/keys/ed25519.py b/scripts/imgtool/keys/ed25519.py index 08f67b6ed..a9959a665 100644 --- a/scripts/imgtool/keys/ed25519.py +++ b/scripts/imgtool/keys/ed25519.py @@ -4,7 +4,6 @@ # SPDX-License-Identifier: Apache-2.0 -from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives import serialization from cryptography.hazmat.primitives.asymmetric import ed25519 @@ -34,6 +33,11 @@ def get_public_bytes(self): encoding=serialization.Encoding.DER, format=serialization.PublicFormat.SubjectPublicKeyInfo) + def get_public_pem(self): + return self._get_public().public_bytes( + encoding=serialization.Encoding.PEM, + format=serialization.PublicFormat.SubjectPublicKeyInfo) + def get_private_bytes(self, minimal, format): self._unsupported('get_private_bytes')