Package oauth2client :: Module crypt
[hide private]
[frames] | no frames]

Module crypt

source code

Crypto-related routines for oauth2client.

Classes [hide private]
  AppIdentityError
Functions [hide private]
 
_parse_pem_key(raw_key_input)
Identify and extract PEM keys.
source code
 
_urlsafe_b64encode(raw_bytes) source code
 
_urlsafe_b64decode(b64string) source code
 
_json_encode(data) source code
 
make_signed_jwt(signer, payload)
Make a signed JWT.
source code
 
verify_signed_jwt_with_certs(jwt, certs, audience)
Verify a JWT against public certs.
source code
Variables [hide private]
  CLOCK_SKEW_SECS = 300
  AUTH_TOKEN_LIFETIME_SECS = 300
  MAX_TOKEN_LIFETIME_SECS = 86400
  logger = logging.getLogger(__name__)
  OpenSSLVerifier = None
  OpenSSLSigner = None
  PyCryptoVerifier = None
  PyCryptoSigner = None
  Signer = None
  Verifier = None
Function Details [hide private]

_parse_pem_key(raw_key_input)

source code 
Identify and extract PEM keys.

Determines whether the given key is in the format of PEM key, and extracts
the relevant part of the key if it is.

Args:
  raw_key_input: The contents of a private key file (either PEM or PKCS12).

Returns:
  string, The actual key if the contents are from a PEM file, or else None.

make_signed_jwt(signer, payload)

source code 
Make a signed JWT.

See http://self-issued.info/docs/draft-jones-json-web-token.html.

Args:
  signer: crypt.Signer, Cryptographic signer.
  payload: dict, Dictionary of data to convert to JSON and then sign.

Returns:
  string, The JWT for the payload.

verify_signed_jwt_with_certs(jwt, certs, audience)

source code 
Verify a JWT against public certs.

See http://self-issued.info/docs/draft-jones-json-web-token.html.

Args:
  jwt: string, A JWT.
  certs: dict, Dictionary where values of public keys in PEM format.
  audience: string, The audience, 'aud', that this JWT should contain. If
    None then the JWT's 'aud' parameter is not verified.

Returns:
  dict, The deserialized JSON payload in the JWT.

Raises:
  AppIdentityError if any checks are failed.