Skip to content

Commit

Permalink
minor comments
Browse files Browse the repository at this point in the history
Signed-off-by: Trishank Karthik Kuppusamy <trishank.kuppusamy@datadoghq.com>
  • Loading branch information
trishankatdatadog committed Jul 21, 2020
1 parent f5eb59b commit b9a9050
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
5 changes: 3 additions & 2 deletions tests/test_tuf_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ def test(key_type, hash_algorithm, hash_algorithms):
)

# FIXME: Unfortunately, py-TUF does not yet support P-384.
# https://github.com/hvac/hvac/pull/606
# test(
# VaultKey.KeyTypes.P_384.value,
# VaultKey.HashAlgorithms.SHA2_384.value,
Expand Down Expand Up @@ -336,8 +337,8 @@ def test_VaultKey_RSA(self):

for key_type in {
VaultKey.KeyTypes.RSA_2048.value,
# FIXME: https://github.com/hvac/hvac/issues/605
#VaultKey.KeyTypes.RSA_3072.value,
# https://github.com/hvac/hvac/issues/605
VaultKey.KeyTypes.RSA_3072.value,
VaultKey.KeyTypes.RSA_4096.value
}:
NAME = f'test-{key_type}-key'
Expand Down
6 changes: 2 additions & 4 deletions tuf/api/keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,7 @@ def __init__(
if not self.__client.is_authenticated():
raise self.AuthenticationError

# Guess why this isn't a requests.Response?
# https://github.com/hvac/hvac/pull/537#issuecomment-660304707
# https://github.com/hvac/hvac/issues/604
response = self.__client.secrets.transit.read_key(name=name)
self.__name = name

Expand All @@ -324,8 +323,6 @@ def __init__(
# NOTE: The documentation is not clear, but presumably the returned
# keys are different versions of keys under the same name. Therefore,
# we shall select the one with the latest version number.
# NOTE: We are also taking it for granted that Vault will generate
# public keys in formats TUF will recognize out of the box.
keys = data['keys']
latest_version = data['latest_version']
key = keys.get(str(latest_version))
Expand Down Expand Up @@ -420,6 +417,7 @@ def verify(self, signed: BytesOrStr, signature: Dict) -> bool:
self.KeyTypes.RSA_3072.value,
self.KeyTypes.RSA_4096.value
} and self.__signature_algorithm == self.SignatureAlgorithms.PSS.value:
# https://github.com/secure-systems-lab/securesystemslib/pull/262
return self.__ram_key._verify_rsa_signature(
signed,
signature,
Expand Down

0 comments on commit b9a9050

Please sign in to comment.