X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=BaseTools%2FSource%2FPython%2FRsa2048Sha256Sign%2FRsa2048Sha256GenerateKeys.py;h=95a636966c5932050c87d202d24810e79cae85e8;hp=2dd6c201683334cb6a82b28f75bf16d249e7172d;hb=066c71544ed1c0e1a703b26982f9da60d21bcc5a;hpb=8a0933f436b2014de5402a8c8b4d164a612b9a15 diff --git a/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256GenerateKeys.py b/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256GenerateKeys.py index 2dd6c20168..95a636966c 100644 --- a/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256GenerateKeys.py +++ b/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256GenerateKeys.py @@ -64,6 +64,8 @@ if __name__ == '__main__': try: OpenSslPath = os.environ['OPENSSL_PATH'] OpenSslCommand = os.path.join(OpenSslPath, OpenSslCommand) + if ' ' in OpenSslCommand: + OpenSslCommand = '"' + OpenSslCommand + '"' except: pass @@ -98,7 +100,7 @@ if __name__ == '__main__': # # Generate private key and save it to output file in a PEM file format # - Process = subprocess.Popen('%s genrsa -out %s 2048' % (OpenSslCommand, Item.name), stdout=subprocess.PIPE, stderr=subprocess.PIPE) + Process = subprocess.Popen('%s genrsa -out %s 2048' % (OpenSslCommand, Item.name), stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) Process.communicate() if Process.returncode <> 0: print 'ERROR: RSA 2048 key generation failed' @@ -120,7 +122,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) + Process = subprocess.Popen('%s rsa -in %s -modulus -noout' % (OpenSslCommand, Item), stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) PublicKeyHexString = Process.communicate()[0].split('=')[1].strip() if Process.returncode <> 0: print 'ERROR: Unable to extract public key from private key' @@ -132,7 +134,7 @@ if __name__ == '__main__': # # Generate SHA 256 hash of RSA 2048 bit public key into STDOUT # - Process = subprocess.Popen('%s dgst -sha256 -binary' % (OpenSslCommand), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + 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] if Process.returncode <> 0: