Make encrypt_secret.py work with OpenSSL 0.x
The format was changed in 1.0. This enables Mac OS's default openssl CLI tool to work with encrypt_secret.py Change-Id: Ib5d7a0c5cc6a729bed6fa4a64193444bb48022fb
This commit is contained in:
parent
458ab7bc90
commit
2dc31dd567
|
@ -86,7 +86,12 @@ def main():
|
||||||
if p.returncode != 0:
|
if p.returncode != 0:
|
||||||
raise Exception("Return code %s from openssl" % p.returncode)
|
raise Exception("Return code %s from openssl" % p.returncode)
|
||||||
output = stdout.decode('utf-8')
|
output = stdout.decode('utf-8')
|
||||||
m = re.match(r'^Public-Key: \((\d+) bit\)$', output, re.MULTILINE)
|
openssl_version = subprocess.check_output(
|
||||||
|
['openssl', 'version']).split()[1]
|
||||||
|
if openssl_version.startswith(b'0.'):
|
||||||
|
m = re.match(r'^Modulus \((\d+) bit\):$', output, re.MULTILINE)
|
||||||
|
else:
|
||||||
|
m = re.match(r'^Public-Key: \((\d+) bit\)$', output, re.MULTILINE)
|
||||||
nbits = int(m.group(1))
|
nbits = int(m.group(1))
|
||||||
nbytes = int(nbits / 8)
|
nbytes = int(nbits / 8)
|
||||||
max_bytes = nbytes - 42 # PKCS1-OAEP overhead
|
max_bytes = nbytes - 42 # PKCS1-OAEP overhead
|
||||||
|
|
Loading…
Reference in New Issue