]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py
BaseTools: Handle the bytes and str difference
[mirror_edk2.git] / BaseTools / Source / Python / Rsa2048Sha256Sign / Rsa2048Sha256Sign.py
index c285a69ec0db0ae9b1a29f25546aef34e3a335f9..6cea8858532d2e70f67442f316ed98de4edb3fe1 100644 (file)
@@ -105,7 +105,7 @@ if __name__ == '__main__':
   if Process.returncode != 0:\r
     print('ERROR: Open SSL command not available.  Please verify PATH or set OPENSSL_PATH')\r
     sys.exit(Process.returncode)\r
-  print(Version[0])\r
+  print(Version[0].decode('utf-8'))\r
 \r
   #\r
   # Read input file into a buffer and save input filename\r
@@ -153,7 +153,8 @@ if __name__ == '__main__':
   # Extract public key from private key into STDOUT\r
   #\r
   Process = subprocess.Popen('%s rsa -in "%s" -modulus -noout' % (OpenSslCommand, args.PrivateKeyFileName), stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)\r
-  PublicKeyHexString = Process.communicate()[0].split('=')[1].strip()\r
+  PublicKeyHexString = Process.communicate()[0].split(b'=')[1].strip()\r
+  PublicKeyHexString = PublicKeyHexString.decode('utf-8')\r
   PublicKey = ''\r
   while len(PublicKeyHexString) > 0:\r
     PublicKey = PublicKey + PublicKeyHexString[0:2]\r
@@ -210,7 +211,7 @@ if __name__ == '__main__':
     #\r
     # Verify the public key\r
     #\r
-    if Header.PublicKey != PublicKey:\r
+    if Header.PublicKey != bytearray.fromhex(PublicKey):\r
       print('ERROR: Public key in input file does not match public key from private key file')\r
       sys.exit(1)\r
 \r