summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python/Rsa2048Sha256Sign
diff options
context:
space:
mode:
authorBob Feng <bob.c.feng@intel.com>2019-07-16 17:14:08 +0800
committerLiming Gao <liming.gao@intel.com>2019-08-01 15:36:48 +0800
commit8ddec24dea74a7e172cb67d5bcaf6c74db3ac6f9 (patch)
tree9592b86222c312772fa01a2beba8e6ffd67d74b6 /BaseTools/Source/Python/Rsa2048Sha256Sign
parent307e1650be267b67db7be1089e0979ace460d830 (diff)
downloadedk2-8ddec24dea74a7e172cb67d5bcaf6c74db3ac6f9.tar.gz
edk2-8ddec24dea74a7e172cb67d5bcaf6c74db3ac6f9.tar.bz2
edk2-8ddec24dea74a7e172cb67d5bcaf6c74db3ac6f9.zip
BaseTools:Updata the output encoding of the Popen function
BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=2015 Not all output works in utf-8, so change the encoding to the default This patch is going to fix that issue. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com> Reviewed-by: Liming Gao <liming.gao@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 f9aed2bf86..6c9b8c464e 100644
--- a/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256GenerateKeys.py
+++ b/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256GenerateKeys.py
@@ -78,7 +78,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(encoding='utf-8', errors='ignore'))
+ print(Version[0].decode())
args.PemFileName = []
@@ -119,7 +119,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].decode(encoding='utf-8', errors='ignore').split(b'=')[1].strip()
+ PublicKeyHexString = Process.communicate()[0].decode().split(b'=')[1].strip()
if Process.returncode != 0:
print('ERROR: Unable to extract public key from private key')
sys.exit(Process.returncode)
@@ -132,7 +132,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].decode(encoding='utf-8', errors='ignore')
+ PublicKeyHash = PublicKeyHash + Process.communicate()[0].decode()
if Process.returncode != 0:
print('ERROR: Unable to extract SHA 256 hash of public key')
sys.exit(Process.returncode)