return signature
url = 'http://d604721fxaaqy9.cloudfront.net/horizon.jpg?large=yes&license=yes'
expected_url = (
    """http://d604721fxaaqy9.cloudfront.net/horizon.jpg?large=yes&license=yes&Expires=1258237200&Signature=Nql641NHEUkUaXQHZINK1FZ~SYeUSoBJMxjdgqrzIdzV2gyEXPDNv0pYdWJkflDKJ3xIu7lbwRpSkG98NBlgPi4ZJpRRnVX4kXAJK6tdNx6FucDB7OVqzcxkxHsGFd8VCG1BkC-Afh9~lOCMIYHIaiOB6~5jt9w2EOwi6sIIqrg_&Key-Pair-Id=PK123456789754"""
    )
message = 'PK123456789754'
expire_time = 1258237200


class CryptographyDistribution(Distribution):

    def _sign_string(self, message, private_key_file=None,
        private_key_string=None):
        return sign_with_cryptography(message)


class RSADistribution(Distribution):

    def _sign_string(self, message, private_key_file=None,
        private_key_string=None):
        return sign_with_rsa(message)
cryptography_distribution = CryptographyDistribution()
rsa_distribution = RSADistribution()
cryptography_url = cryptography_distribution.create_signed_url(url, message,
    expire_time)
rsa_url = rsa_distribution.create_signed_url(url, message, expire_time)
assert cryptography_url == rsa_url == expected_url, 'URLs do not match'
How to cope with the performance of generating signed URLs for accessing private content via CloudFront?