imgtool: Add raw output option
Signed-off-by: Dávid Házi <david.hazi@arm.com>
Signed-off-by: Bence Balogh <bence.balogh@arm.com>
Change-Id: Ia7f385e5e1b0471aae7693baa54e9a385ad3ae3f
diff --git a/scripts/imgtool/keys/general.py b/scripts/imgtool/keys/general.py
index 0393a9a..45cddc6 100644
--- a/scripts/imgtool/keys/general.py
+++ b/scripts/imgtool/keys/general.py
@@ -41,6 +41,13 @@
len_format="const unsigned int {}_pub_key_len = {{}};".format(self.shortname()),
file=file)
+ def emit_raw_public(self, file=sys.stdout):
+ if file and file is not sys.stdout:
+ with open(file, 'wb') as file:
+ file.write(self.get_public_bytes())
+ else:
+ sys.stdout.buffer.write(self.get_public_bytes())
+
def emit_rust_public(self, file=sys.stdout):
self._emit(
header="static {}_PUB_KEY: &[u8] = &[".format(self.shortname().upper()),