| Index: client/third_party/oauth2client/_openssl_crypt.py
|
| diff --git a/client/third_party/oauth2client/_openssl_crypt.py b/client/third_party/oauth2client/_openssl_crypt.py
|
| index d024cf30aa5ac872af24e3e7ee3e33118c80a810..7a76fb7157f156a354b554f90b859d5ed8cba672 100644
|
| --- a/client/third_party/oauth2client/_openssl_crypt.py
|
| +++ b/client/third_party/oauth2client/_openssl_crypt.py
|
| @@ -68,6 +68,7 @@ class OpenSSLVerifier(object):
|
| Raises:
|
| OpenSSL.crypto.Error: if the key_pem can't be parsed.
|
| """
|
| + key_pem = _to_bytes(key_pem)
|
| if is_x509_cert:
|
| pubkey = crypto.load_certificate(crypto.FILETYPE_PEM, key_pem)
|
| else:
|
| @@ -112,6 +113,7 @@ class OpenSSLSigner(object):
|
| Raises:
|
| OpenSSL.crypto.Error if the key can't be parsed.
|
| """
|
| + key = _to_bytes(key)
|
| parsed_pem_key = _parse_pem_key(key)
|
| if parsed_pem_key:
|
| pkey = crypto.load_privatekey(crypto.FILETYPE_PEM, parsed_pem_key)
|
| @@ -121,19 +123,17 @@ class OpenSSLSigner(object):
|
| return OpenSSLSigner(pkey)
|
|
|
|
|
| -def pkcs12_key_as_pem(private_key_text, private_key_password):
|
| - """Convert the contents of a PKCS12 key to PEM using OpenSSL.
|
| +def pkcs12_key_as_pem(private_key_bytes, private_key_password):
|
| + """Convert the contents of a PKCS#12 key to PEM using pyOpenSSL.
|
|
|
| Args:
|
| - private_key_text: String. Private key.
|
| - private_key_password: String. Password for PKCS12.
|
| + private_key_bytes: Bytes. PKCS#12 key in DER format.
|
| + private_key_password: String. Password for PKCS#12 key.
|
|
|
| Returns:
|
| - String. PEM contents of ``private_key_text``.
|
| + String. PEM contents of ``private_key_bytes``.
|
| """
|
| - decoded_body = base64.b64decode(private_key_text)
|
| private_key_password = _to_bytes(private_key_password)
|
| -
|
| - pkcs12 = crypto.load_pkcs12(decoded_body, private_key_password)
|
| + pkcs12 = crypto.load_pkcs12(private_key_bytes, private_key_password)
|
| return crypto.dump_privatekey(crypto.FILETYPE_PEM,
|
| pkcs12.get_privatekey())
|
|
|