summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python/Rsa2048Sha256Sign
diff options
context:
space:
mode:
authorFan, ZhijuX <zhijux.fan@intel.com>2019-03-29 13:53:40 +0800
committerFeng, Bob C <bob.c.feng@intel.com>2019-04-01 13:37:19 +0800
commit1c27ec42363515bda97468dccf57a01c6e66d01e (patch)
tree3694f14b657c8bc02b750eacf6ac2b5fa4ba6731 /BaseTools/Source/Python/Rsa2048Sha256Sign
parent58742d79457e71fba75d72e79050ba43915e3ed6 (diff)
downloadedk2-1c27ec42363515bda97468dccf57a01c6e66d01e.tar.gz
edk2-1c27ec42363515bda97468dccf57a01c6e66d01e.tar.bz2
edk2-1c27ec42363515bda97468dccf57a01c6e66d01e.zip
BaseTools:Coding problems caused by special characters
BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=1670 During BaseTools compiling under Chinese or Japanese language Windows, python exception occurring. UnicodeDecodeError: 'ascii' codec can't decode byte 0xbd in position 3528: ordinal not in range(128) Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
Diffstat (limited to 'BaseTools/Source/Python/Rsa2048Sha256Sign')
-rw-r--r--BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256GenerateKeys.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256GenerateKeys.py b/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256GenerateKeys.py
index c0b661d03c..3cc14e3bb9 100644
--- a/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256GenerateKeys.py
+++ b/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256GenerateKeys.py
@@ -84,7 +84,7 @@ if __name__ == '__main__':
if Process.returncode != 0:
print('ERROR: Open SSL command not available. Please verify PATH or set OPENSSL_PATH')
sys.exit(Process.returncode)
- print(Version[0].decode())
+ print(Version[0].decode(encoding='utf-8', errors='ignore'))
args.PemFileName = []
@@ -125,7 +125,7 @@ if __name__ == '__main__':
# Extract public key from private key into STDOUT
#
Process = subprocess.Popen('%s rsa -in %s -modulus -noout' % (OpenSslCommand, Item), stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
- PublicKeyHexString = Process.communicate()[0].split(b'=')[1].strip()
+ PublicKeyHexString = Process.communicate()[0].decode(encoding='utf-8', errors='ignore').split(b'=')[1].strip()
if Process.returncode != 0:
print('ERROR: Unable to extract public key from private key')
sys.exit(Process.returncode)
@@ -138,7 +138,7 @@ if __name__ == '__main__':
#
Process = subprocess.Popen('%s dgst -sha256 -binary' % (OpenSslCommand), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
Process.stdin.write (PublicKey)
- PublicKeyHash = PublicKeyHash + Process.communicate()[0]
+ PublicKeyHash = PublicKeyHash + Process.communicate()[0].decode(encoding='utf-8', errors='ignore')
if Process.returncode != 0:
print('ERROR: Unable to extract SHA 256 hash of public key')
sys.exit(Process.returncode)