3 L(Y @sTdZddlZddlmZddlmZddddgZejZejZejZej Z d d Z dS) aCryptography helpers for verifying and signing messages. The simplest way to verify signatures is using :func:`verify_signature`:: cert = open('certs.pem').read() valid = crypt.verify_signature(message, signature, cert) If you're going to verify many messages with the same certificate, you can use :class:`RSAVerifier`:: cert = open('certs.pem').read() verifier = crypt.RSAVerifier.from_string(cert) valid = verifier.verify(message, signature) To sign messages use :class:`RSASigner` with a private key:: private_key = open('private_key.pem').read() signer = crypt.RSASigner(private_key) signature = signer.sign(message) N)base)rsa RSASigner RSAVerifierSignerVerifiercCsFt|tjtjfr|g}x(|D] }tjj|}|j||rdSqWdS)aVerify an RSA cryptographic signature. Checks that the provided ``signature`` was generated from ``bytes`` using the private key associated with the ``cert``. Args: message (Union[str, bytes]): The plaintext message. signature (Union[str, bytes]): The cryptographic signature to check. certs (Union[Sequence, str, bytes]): The certificate or certificates to use to check the signature. Returns: bool: True if the signature is valid, otherwise False. TF) isinstancesix text_type binary_typerrZ from_stringverify)message signaturecertscertZverifierrI/private/tmp/pip-build-nl73fm5q/google-auth/google/auth/crypt/__init__.pyverify_signature9s   r) __doc__r Zgoogle.auth.cryptrr__all__rrrrrrrrr"s