Skip to content

Commit

Permalink
[python] Fix encoding of the passphrase yet again
Browse files Browse the repository at this point in the history
Previous fix did not take into account an empty string.

Fixes: 9489939 ("[python] Fix encoding of the passphrase")
Signed-off-by: Wojtek Porczyk <woju@invisiblethingslab.com>
  • Loading branch information
woju authored and dimakuv committed Oct 18, 2023
1 parent c114403 commit e83ea91
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion python/graminelibos/sgx_sign.py
Original file line number Diff line number Diff line change
Expand Up @@ -591,8 +591,10 @@ def get_tbssigstruct(manifest_path, date, libpal=SGX_LIBPAL, verbose=False):
@click.option('--passphrase', '--password', '-p', 'passphrase', metavar='PASSPHRASE',
help='optional passphrase to decrypt the key')
def sign_with_file(ctx, key, passphrase):
if passphrase is not None:
passphrase = passphrase.encode()
try:
private_key = load_private_key_from_pem_file(key, passphrase and passphrase.encode())
private_key = load_private_key_from_pem_file(key, passphrase)
except InvalidKeyError as e:
ctx.fail(str(e))

Expand Down

0 comments on commit e83ea91

Please sign in to comment.