From b85f36b5c4caaa3aec382cf3058d1c7a358fadfe Mon Sep 17 00:00:00 2001 From: jgough Date: Wed, 29 Nov 2023 14:17:06 +0000 Subject: [PATCH] Add an option to push the signed statement into a file AB#8804 --- README.md | 3 ++- scitt/create_signed_statement.py | 11 ++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6562297..ee928f4 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,8 @@ Finally we have an environment we can run the create signed statement script in: python scitt/create_signed_statement.py --signing-key-file scitt-signing-key.pem \ --statement-file scitt-statement.json \ --feed testfeed \ - --issuer testissuer + --issuer testissuer \ + --output-file signed-statement.txt ``` Now we have the signed statement we can deactivate the venv: diff --git a/scitt/create_signed_statement.py b/scitt/create_signed_statement.py index 96a1c02..39f240d 100755 --- a/scitt/create_signed_statement.py +++ b/scitt/create_signed_statement.py @@ -152,6 +152,14 @@ def main(): help="issuer who owns the signing key.", ) + # output file + parser.add_argument( + "--output-file", + type=str, + help="name of the output file to store the signed statement.", + default="signed-statement.txt", + ) + args = parser.parse_args() signing_key = open_signing_key(args.signing_key_file) @@ -161,7 +169,8 @@ def main(): signing_key, payload, args.feed, args.issuer ) - print(signed_statement) + with open(args.output_file, "w", encoding="UTF-8") as output_file: + output_file.write(signed_statement.decode("utf-8")) if __name__ == "__main__":