Skip to content

Commit

Permalink
New HMAC string values
Browse files Browse the repository at this point in the history
  • Loading branch information
joamag committed Mar 21, 2020
1 parent 645a91d commit 5d5d7dc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions api_dropbox/src/api_dropbox/system.py
Expand Up @@ -57,7 +57,7 @@
""" The content type charset value """

HMAC_SHA1_VALUE = "HMAC-SHA1"
""" The hmac SHA1 value """
""" The HMAC SHA1 value """

RSA_SHA1_VALUE = "RSA-SHA1"
""" The RSA SHA1 value """
Expand Down Expand Up @@ -89,7 +89,7 @@
HMAC_HASH_MODULES_MAP = {
HMAC_SHA1_VALUE : hashlib.sha1
}
""" The map associating the hmac values with the hashlib hash function modules """
""" The map associating the HMAC values with the hashlib hash function modules """

BASE_REST_URL = "http://api.dropbox.com/1/"
""" The base REST URL to be used """
Expand Down
14 changes: 7 additions & 7 deletions api_openid/src/api_openid/system.py
Expand Up @@ -122,7 +122,7 @@
""" The id res value """

HMAC_SHA1_VALUE = "HMAC-SHA1"
""" The hmac SHA1 value """
""" The HMAC SHA1 value """

HMAC_SHA256_VALUE = "HMAC-SHA256"
""" The HMAC SHA256 value """
Expand Down Expand Up @@ -160,7 +160,7 @@
DH_SHA1_VALUE : hashlib.sha1,
DH_SHA256_VALUE : hashlib.sha1
}
""" The map associating the hmac values with the hashlib
""" The map associating the HMAC values with the hashlib
hash function modules """

DIFFIE_HELLMAN_ASSOCIATION_TYPES = (
Expand Down Expand Up @@ -635,7 +635,7 @@ def get_response_parameters(self):
# decodes the MAC key using Base64
decoded_mac_key = base64.b64decode(self.openid_structure.mac_key)

# retrieves the hash module from the hmac hash modules map
# retrieves the hash module from the HMAC hash modules map
hash_module = HMAC_HASH_MODULES_MAP.get(mac_key_type, None)

# encodes the key value in order to be used in the xor operation
Expand Down Expand Up @@ -755,11 +755,11 @@ def _get_mac_key_type(self):
return self.openid_structure.association_type
# in case the current session is of type DH SHA1
elif self.openid_structure.session_type == DH_SHA1_VALUE:
# returns the hmac SHA1 value
# returns the HMAC SHA1 value
return HMAC_SHA1_VALUE
# in case the current session is of type DH SHA256
elif self.openid_structure.session_type == DH_SHA256_VALUE:
# returns the hmac sha256 value
# returns the HMAC sha256 value
return HMAC_SHA256_VALUE

def _generate_signature(self):
Expand Down Expand Up @@ -795,7 +795,7 @@ def _generate_signature(self):
# decodes the signature MAC key from Base64
signature_mac_key = base64.b64decode(self.openid_structure.mac_key)

# retrieves the hash module from the hmac hash modules map
# retrieves the hash module from the HMAC hash modules map
hash_module = HMAC_HASH_MODULES_MAP.get(self.openid_structure.association_type, None)

# in case no hash module is set
Expand Down Expand Up @@ -1205,7 +1205,7 @@ def openid_verify(self, return_openid_structure, strict = True):
# decodes the signature MAC key from Base64
signature_mac_key = base64.b64decode(self.openid_structure.mac_key)

# retrieves the hash module from the hmac hash modules map
# retrieves the hash module from the HMAC hash modules map
hash_module = HMAC_HASH_MODULES_MAP.get(self.openid_structure.association_type, None)

# in case no hash module is set
Expand Down

0 comments on commit 5d5d7dc

Please sign in to comment.