Skip to content

Commit

Permalink
New casing values
Browse files Browse the repository at this point in the history
  • Loading branch information
joamag committed Mar 21, 2020
1 parent 882d319 commit 645a91d
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 49 deletions.
2 changes: 1 addition & 1 deletion api_at/src/api_at/system.py
Expand Up @@ -317,7 +317,7 @@ def _submit_document(self, submit_url, document_payload):
public_key_path = self.get_resource("api_at/resources/at.pem")

# runs the encryption on the secret value to create an
# rsa encrypted representation of it and then encodes
# RSA encrypted representation of it and then encodes
# that value in base 64 to create the nonce value
ssl_structure = self.ssl_plugin.create_structure({})
secret_encrypted = ssl_structure.encrypt(public_key_path, secret)
Expand Down
8 changes: 4 additions & 4 deletions api_dropbox/src/api_dropbox/system.py
Expand Up @@ -57,10 +57,10 @@
""" 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 """
""" The RSA SHA1 value """

PLAINTEXT_VALUE = "PLAINTEXT"
""" The plaintext value """
Expand Down Expand Up @@ -98,10 +98,10 @@
""" The base REST secure URL to be used """

WWW_REST_SECURE_URL = "http://www.dropbox.com/1/"
""" The www REST URL to be used """
""" The WWW REST URL to be used """

WWW_REST_SECURE_URL = "https://www.dropbox.com/1/"
""" The www REST secure URL to be used """
""" The WWW REST secure URL to be used """

CONTENT_REST_SECURE_URL = "http://api-content.dropbox.com/1/"
""" The content REST URL to be used """
Expand Down
50 changes: 25 additions & 25 deletions encryption/src/pkcs1_c/system.py
Expand Up @@ -64,10 +64,10 @@
""" The type class value """

BEGIN_RSA_PRIVATE_VALUE = "-----BEGIN RSA PRIVATE KEY-----"
""" The begin rsa private value """
""" The begin RSA private value """

END_RSA_PRIVATE_VALUE = "-----END RSA PRIVATE KEY-----"
""" The end rsa private value """
""" The end RSA private value """

BEGIN_PUBLIC_VALUE = "-----BEGIN PUBLIC KEY-----"
""" The begin public value """
Expand Down Expand Up @@ -306,7 +306,7 @@ def generate_private_key_pem(self, keys, version = 1):
# creates the string value list
string_value_list = []

# adds the begin rsa private value to the string value list
# adds the begin RSA private value to the string value list
string_value_list.append(BEGIN_RSA_PRIVATE_VALUE + "\n")

# splits the private key der encoded value
Expand All @@ -315,7 +315,7 @@ def generate_private_key_pem(self, keys, version = 1):
# adds the private key der splitted to the string value list
string_value_list.append(private_key_der_splitted)

# adds the end rsa private value to the string value list
# adds the end RSA private value to the string value list
string_value_list.append(END_RSA_PRIVATE_VALUE + "\n")

# joins the string value list retrieving the
Expand Down Expand Up @@ -348,7 +348,7 @@ def generate_public_key_pem(self, keys):
# creates the string value list
string_value_list = []

# adds the begin rsa public value to the string value list
# adds the begin RSA public value to the string value list
string_value_list.append(BEGIN_PUBLIC_VALUE + "\n")

# splits the public key der encoded value
Expand All @@ -357,7 +357,7 @@ def generate_public_key_pem(self, keys):
# adds the public key der splitted to the string value list
string_value_list.append(public_key_der_splitted)

# adds the end rsa public value to the string value list
# adds the end RSA public value to the string value list
string_value_list.append(END_PUBLIC_VALUE + "\n")

# joins the string value list retrieving the
Expand Down Expand Up @@ -503,7 +503,7 @@ def generate_private_key_der(self, keys, version = 1):
VALUE_VALUE : coefficient
}

# creates the rsa private key contents (list)
# creates the RSA private key contents (list)
rsa_private_key_contents = [
version_value,
modulus_value,
Expand All @@ -516,7 +516,7 @@ def generate_private_key_der(self, keys, version = 1):
coefficient_value
]

# creates the rsa private key
# creates the RSA private key
rsa_private_key = {
TYPE_VALUE : {
TYPE_CONSTRUCTED_VALUE : 1,
Expand All @@ -526,10 +526,10 @@ def generate_private_key_der(self, keys, version = 1):
VALUE_VALUE : rsa_private_key_contents
}

# packs the rsa private key
# packs the RSA private key
rsa_private_key_packed = ber_structure.pack(rsa_private_key)

# returns the rsa private key packed
# returns the RSA private key packed
return rsa_private_key_packed

def generate_public_key_der(self, keys):
Expand All @@ -547,11 +547,11 @@ def generate_public_key_der(self, keys):
# unpacks the keys value
public_key, _private_key, _extras = keys

# retrieves the pubic key values
# retrieves the public key values
modulus = public_key["n"]
public_exponent = public_key["e"]

# retrieves the rsa encryption object identifier
# retrieves the RSA encryption object identifier
rsa_encryption_object_identifier = OBJECT_IDENTIFIERS_TUPLES_MAP["rsa_encryption"]

# creates the ber structure
Expand All @@ -569,13 +569,13 @@ def generate_public_key_der(self, keys):
VALUE_VALUE : public_exponent
}

# creates the rsa public key contents (list)
# creates the RSA public key contents (list)
rsa_public_key_contents = [
modulus_value,
public_exponent_value
]

# creates the rsa public key
# creates the RSA public key
rsa_public_key = {
TYPE_VALUE : {
TYPE_CONSTRUCTED_VALUE : 1,
Expand All @@ -585,7 +585,7 @@ def generate_public_key_der(self, keys):
VALUE_VALUE : rsa_public_key_contents
}

# packs the rsa public key
# packs the RSA public key
rsa_public_key_packed = ber_structure.pack(rsa_public_key)

# creates the algorithm identifier value
Expand Down Expand Up @@ -616,7 +616,7 @@ def generate_public_key_der(self, keys):
VALUE_VALUE : algorithm_identifier_contents
}

# creates the rsa public key packed but value
# creates the RSA public key packed but value
rsa_public_key_packed_bit_value = {
TYPE_VALUE : BIT_STRING_TYPE,
VALUE_VALUE : rsa_public_key_packed
Expand Down Expand Up @@ -648,10 +648,10 @@ def load_private_key_der(self, private_key_der):
# creates the ber structure
ber_structure = self.ber_plugin.create_structure({})

# unpacks the rsa private key
# unpacks the RSA private key
rsa_private_key_unpacked = ber_structure.unpack(private_key_der)

# retrieves the rsa private key value
# retrieves the RSA private key value
rsa_private_key_value = rsa_private_key_unpacked[VALUE_VALUE]

# retrieves the version and the version value
Expand Down Expand Up @@ -730,10 +730,10 @@ def load_public_key_der(self, private_key_der):
# creates the ber structure
ber_structure = self.ber_plugin.create_structure({})

# unpacks the rsa public key
# unpacks the RSA public key
rsa_public_key_unpacked = ber_structure.unpack(private_key_der)

# retrieves the rsa public key value
# retrieves the RSA public key value
rsa_public_key_value = rsa_public_key_unpacked[VALUE_VALUE]

# retrieves the algorithm identifier and the algorithm identifier value
Expand All @@ -748,14 +748,14 @@ def load_public_key_der(self, private_key_der):
arguments = algorithm_identifier_value[1]
arguments_value = arguments[VALUE_VALUE]

# retrieves the rsa public key packed bit value and the rsa public key packed bit value value
# retrieves the RSA public key packed bit value and the RSA public key packed bit value value
rsa_public_key_packed_bit = rsa_public_key_value[1]
rsa_public_key_packed_bit_value_value = rsa_public_key_packed_bit[VALUE_VALUE]

# unpacks the rsa public key packed bit value value
# unpacks the RSA public key packed bit value value
rsa_public_key = ber_structure.unpack(rsa_public_key_packed_bit_value_value)

# retrieves the rsa public key value value
# retrieves the RSA public key value value
rsa_public_key_value_value = rsa_public_key[VALUE_VALUE]

# retrieves the modulus and the modulus value
Expand All @@ -766,8 +766,8 @@ def load_public_key_der(self, private_key_der):
public_exponent = rsa_public_key_value_value[1]
public_exponent_value = public_exponent[VALUE_VALUE]

# in case the object identifier is not rsa encryption
# raises an error as the rsa encryption is the only
# in case the object identifier is not RSA encryption
# raises an error as the RSA encryption is the only
# supported encryption type
if not algorithm_value == OBJECT_IDENTIFIERS_TUPLES_MAP["rsa_encryption"]:
raise exceptions.InvalidFormatException("invalid algorithm value: " + str(algorithm_value))
Expand Down
24 changes: 12 additions & 12 deletions misc/src/random_c/system.py
Expand Up @@ -168,7 +168,7 @@ def generate_random_md5(self):
default random generator and converts it
into an MD5 value.
:rtype: Md5
:rtype: MD5
:return: The generated random key converted
into an MD5 value.
"""
Expand Down Expand Up @@ -210,43 +210,43 @@ def generate_random_sha1(self):
"""
Generates a random key, using the current
default random generator and converts it
into an sha1 value.
into an SHA1 value.
:rtype: Sha1
:rtype: SHA1
:return: The generated random key converted
into an sha1 value.
into an SHA1 value.
"""

# generates a random value
random = self.generate_random()

# generates an sha1 hash of the random value
# generates an SHA1 hash of the random value
# note that the random value is first encoded
# into a bytes value before the hash
random = colony.legacy.bytes(random)
random_sha1 = hashlib.sha1(random)

# returns the sha1 hash of the random value
# returns the SHA1 hash of the random value
return random_sha1

def generate_random_sha1_string(self):
"""
Generates a random key, using the current
default random generator and converts it
into an sha1 string value.
into an SHA1 string value.
:rtype: String
:return: The generated random key converted
into an sha1 string value.
into an SHA1 string value.
"""

# generates the sha1 hash of a random value
# generates the SHA1 hash of a random value
random_sha1 = self.generate_random_sha1()

# converts the sha1 hash into string
# converts the SHA1 hash into string
random_sha1_string = random_sha1.hexdigest()

# returns the string value of the sha1 hash
# returns the string value of the SHA1 hash
# of the random value
return random_sha1_string

Expand All @@ -256,7 +256,7 @@ def generate_random_sha256(self):
default random generator and converts it
into an SHA256 value.
:rtype: Sha256
:rtype: SHA256
:return: The generated random key converted
into an SHA256 value.
"""
Expand Down
14 changes: 7 additions & 7 deletions misc/src/random_plugin.py
Expand Up @@ -129,7 +129,7 @@ def generate_random_md5(self):
default random generator and converts it
into an MD5 value.
:rtype: Md5
:rtype: MD5
:return: The generated random key converted
into an MD5 value.
"""
Expand All @@ -153,11 +153,11 @@ def generate_random_sha1(self):
"""
Generates a random key, using the current
default random generator and converts it
into an sha1 value.
into an SHA1 value.
:rtype: Sha1
:rtype: SHA1
:return: The generated random key converted
into an sha1 value.
into an SHA1 value.
"""

return self.system.generate_random_sha1()
Expand All @@ -166,11 +166,11 @@ def generate_random_sha1_string(self):
"""
Generates a random key, using the current
default random generator and converts it
into an sha1 string value.
into an SHA1 string value.
:rtype: String
:return: The generated random key converted
into an sha1 string value.
into an SHA1 string value.
"""

return self.system.generate_random_sha1_string()
Expand All @@ -181,7 +181,7 @@ def generate_random_sha256(self):
default random generator and converts it
into an SHA256 value.
:rtype: Sha256
:rtype: SHA256
:return: The generated random key converted
into an SHA256 value.
"""
Expand Down

0 comments on commit 645a91d

Please sign in to comment.