deeppavlov/utils/alexa/ssl_tools.py
def verify_signature(amazon_cert: crypto.X509, signature: str, request_body: bytes) -> bool:
    """Verifies Alexa request signature.

    Args:
        amazon_cert: Pycrypto X509 Amazon certificate.
        signature: Base64 decoded Alexa request signature from Signature HTTP header.
        request_body: full HTTPS request body
    Returns:
        result: True if verification was successful, False if not.
    """
    signature = base64.b64decode(signature)

    try:
        crypto.verify(amazon_cert, signature, request_body, 'sha1')
        result = True
    except crypto.Error:
        result = False

    return result
def verify_signature(amazon_cert: crypto.X509, signature: str, request_body: bytes) -> bool:
    signature = base64.b64decode(signature)

    try:
        crypto.verify(amazon_cert, signature, request_body, 'sha1')
        result = True
    except crypto.Error:
        result = False

    return result
def verify_signature ( amazon_cert : crypto . X509 , signature : str , request_body : bytes ) -> bool : signature = base64 . b64decode ( signature ) try : crypto . verify ( amazon_cert , signature , request_body , 'sha1' ) result = True except crypto . Error : result = False return result
Verifies Alexa request signature.

    Args:
        amazon_cert: Pycrypto X509 Amazon certificate.
        signature: Base64 decoded Alexa request signature from Signature HTTP header.
        request_body: full HTTPS request body
    Returns:
        result: True if verification was successful, False if not.
Verifies Alexa request signature .