Пример #1
0
def base64_to_long(encoded):
    """
    Base-64 decodes a string into a long.

    :param encoded:
        The encoded byte string.
    :returns:
        Long value.
    """
    byte_string = base64_decode(encoded)
    return bytes_to_long(byte_string)
Пример #2
0
def bytes_to_decimal(byte_string):
    """
    Converts a byte string to its decimal representation.

    :param byte_string:
        Byte string.
    :returns:
        Decimal-encoded byte string.
    """
    #return bytes(int(bytes_to_hex(byte_string), 16))
    return bytes(bytes_to_long(byte_string))
Пример #3
0
    def verify(self, digest, signature_bytes):
        """
        Verifies a signature against that computed by signing the provided
        data.

        :param digest:
            The SHA-1 digest of the data.
        :param signature_bytes:
            The signature raw byte string.
        :param encoder:
            The encoding method to use. Default EMSA-PKCS1-v1.5
        :returns:
            ``True`` if the signature matches; ``False`` otherwise.
        """
        return self._verify(digest, bytes_to_long(signature_bytes))