Example #1
0
def _safe64(s):
    h64 = oidutil.toBase64(cryptutil.sha1(s))
    # to be able to manipulate it, make it a bytearray
    h64 = bytearray(h64)
    h64 = h64.replace(b'+', b'_')
    h64 = h64.replace(b'/', b'.')
    h64 = h64.replace(b'=', b'')
    return bytes(h64)
Example #2
0
def _safe64(s):
    h64 = oidutil.toBase64(cryptutil.sha1(s))
    # to be able to manipulate it, make it a bytearray
    h64 = bytearray(h64)
    h64 = h64.replace(b"+", b"_")
    h64 = h64.replace(b"/", b".")
    h64 = h64.replace(b"=", b"")
    return bytes(h64)
Example #3
0
def _safe64(s):
    h64 = oidutil.toBase64(cryptutil.sha1(s))
    # to be able to manipulate it, make it a bytearray
    h64 = bytearray(h64)
    h64 = h64.replace(b'+', b'_')
    h64 = h64.replace(b'/', b'.')
    h64 = h64.replace(b'=', b'')
    return bytes(h64)
    def __init__(self, secret_phrase):
        """
        Creates a new DumbStore instance.  For the security of the
        tokens generated by the library, this class attempts to at
        least have a secure implementation of C{L{getAuthKey}}.

        When you create an instance of this class, pass in a secret
        phrase.  The phrase is hashed with sha1 to make it the correct
        length and form for an auth key.  That allows you to use a
        long string as the secret phrase, which means you can make it
        very difficult to guess.

        Each C{L{DumbStore}} instance that is created for use by your
        consumer site needs to use the same C{secret_phrase}.

        @param secret_phrase: The phrase used to create the auth key
            returned by C{L{getAuthKey}}

        @type secret_phrase: C{str}
        """
        self.auth_key = cryptutil.sha1(secret_phrase)
    def __init__(self, secret_phrase):
        """
        Creates a new DumbStore instance.  For the security of the
        tokens generated by the library, this class attempts to at
        least have a secure implementation of C{L{getAuthKey}}.

        When you create an instance of this class, pass in a secret
        phrase.  The phrase is hashed with sha1 to make it the correct
        length and form for an auth key.  That allows you to use a
        long string as the secret phrase, which means you can make it
        very difficult to guess.

        Each C{L{DumbStore}} instance that is created for use by your
        consumer site needs to use the same C{secret_phrase}.

        @param secret_phrase: The phrase used to create the auth key
            returned by C{L{getAuthKey}}

        @type secret_phrase: C{str}
        """
        self.auth_key = cryptutil.sha1(secret_phrase)
Example #6
0
def _safe64(s):
    h64 = oidutil.toBase64(cryptutil.sha1(s))
    h64 = h64.replace('+', '_')
    h64 = h64.replace('/', '.')
    h64 = h64.replace('=', '')
    return h64
Example #7
0
def _safe64(s):
    h64 = oidutil.toBase64(cryptutil.sha1(s))
    h64 = h64.replace('+', '_')
    h64 = h64.replace('/', '.')
    h64 = h64.replace('=', '')
    return h64
Example #8
0
 def xorSecret(self, composite, secret):
     dh_shared = self.getSharedSecret(composite)
     sha1_dh_shared = cryptutil.sha1(cryptutil.longToBinary(dh_shared))
     return strxor(secret, sha1_dh_shared)
 def xorSecret(self, composite, secret):
     dh_shared = self.getSharedSecret(composite)
     sha1_dh_shared = cryptutil.sha1(cryptutil.longToBinary(dh_shared))
     return strxor(secret, sha1_dh_shared)
Example #10
0
 def _safe64(s):
     h64 = oidutil.toBase64(cryptutil.sha1(s))
     h64 = h64.replace("+", "_")
     h64 = h64.replace("/", ".")
     h64 = h64.replace("=", "")
     return h64