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
# 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
#\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