ValueError: non-hexadecimal number found in fromhex() arg at position 0 Cc: Bob Feng <bob.c.f...@intel.com> Cc: Liming Gao <liming....@intel.com> Cc: Yonghong Zhu <yonghong....@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan <zhijux....@intel.com> --- BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py b/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py index d2bb0c998c..c285a69ec0 100644 --- a/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py +++ b/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py @@ -154,11 +154,11 @@ if __name__ == '__main__': # Process = subprocess.Popen('%s rsa -in "%s" -modulus -noout' % (OpenSslCommand, args.PrivateKeyFileName), stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) PublicKeyHexString = Process.communicate()[0].split('=')[1].strip() PublicKey = '' while len(PublicKeyHexString) > 0: - PublicKey = PublicKey + chr(int(PublicKeyHexString[0:2], 16)) + PublicKey = PublicKey + PublicKeyHexString[0:2] PublicKeyHexString=PublicKeyHexString[2:] if Process.returncode != 0: sys.exit(Process.returncode) if args.MonotonicCountStr: @@ -186,11 +186,11 @@ if __name__ == '__main__': # # Write output file that contains hash GUID, Public Key, Signature, and Input data # args.OutputFile = open(args.OutputFileName, 'wb') args.OutputFile.write(EFI_HASH_ALGORITHM_SHA256_GUID.bytes_le) - args.OutputFile.write(PublicKey) + args.OutputFile.write(bytearray.fromhex(str(PublicKey))) args.OutputFile.write(Signature) args.OutputFile.write(args.InputFileBuffer) args.OutputFile.close() if args.Decode: -- 2.20.1.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel