imgtool: image signature export
Extend sign/create command so it now allow to export the image
signature to the file pointed by --sig-out option.
The image signature will be encoded as base64 formatted string.
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
diff --git a/scripts/imgtool/image.py b/scripts/imgtool/image.py
index 749b6da..834ec9d 100644
--- a/scripts/imgtool/image.py
+++ b/scripts/imgtool/image.py
@@ -447,12 +447,14 @@
else:
sig = key.sign_digest(digest)
tlv.add(key.sig_tlv(), sig)
+ self.signature = sig
elif fixed_sig is not None and key is None:
if public_key_format == 'hash':
tlv.add('KEYHASH', pubbytes)
else:
tlv.add('PUBKEY', pub)
tlv.add(pub_key.sig_tlv(), fixed_sig['value'])
+ self.signature = fixed_sig['value']
else:
raise click.UsageError("Can not sign using key and provide fixed-signature at the same time")