mirror of
https://github.com/theupdateframework/python-tuf
synced 2026-05-24 10:08:28 +00:00
Merge pull request #525 from vladimir-v-diaz/fix_ssl_build_failure
Fix ssl build failure
This commit is contained in:
commit
ff3eb4e268
3 changed files with 10 additions and 19 deletions
|
|
@ -66,7 +66,7 @@ def test_schemas(self):
|
|||
'KEYIDS_SCHEMA': (securesystemslib.formats.KEYIDS_SCHEMA,
|
||||
['123456789abcdef', '123456789abcdef']),
|
||||
|
||||
'SIG_SCHEME_SCHEMA': (securesystemslib.formats.SIG_SCHEME_SCHEMA, 'rsassa-pss-sha256'),
|
||||
'SCHEME_SCHEMA': (securesystemslib.formats.SCHEME_SCHEMA, 'rsassa-pss-sha256'),
|
||||
|
||||
'RELPATH_SCHEMA': (securesystemslib.formats.RELPATH_SCHEMA, 'metadata/root/'),
|
||||
|
||||
|
|
|
|||
|
|
@ -316,34 +316,33 @@ def test_import_ed25519_privatekey_from_file(self):
|
|||
with open(invalid_keyfile, 'wb') as file_object:
|
||||
file_object.write(b'bad keyfile')
|
||||
|
||||
self.assertRaises(securesystemslib.exceptions.Error, repo_lib.import_ed25519_privatekey_from_file,
|
||||
invalid_keyfile, 'pw')
|
||||
self.assertRaises(securesystemslib.exceptions.Error,
|
||||
repo_lib.import_ed25519_privatekey_from_file, invalid_keyfile, 'pw')
|
||||
|
||||
# Invalid private key imported (contains unexpected keytype.)
|
||||
imported_ed25519_key['keytype'] = 'invalid_keytype'
|
||||
|
||||
# Use 'pycrypto_keys.py' to bypass the key format validation performed by
|
||||
# Use 'pyca_crypto_keys.py' to bypass the key format validation performed by
|
||||
# 'keys.py'.
|
||||
salt, iterations, derived_key = \
|
||||
securesystemslib.pycrypto_keys._generate_derived_key('pw')
|
||||
securesystemslib.pyca_crypto_keys._generate_derived_key('pw')
|
||||
|
||||
# Store the derived key info in a dictionary, the object expected
|
||||
# by the non-public _encrypt() routine.
|
||||
derived_key_information = {'salt': salt, 'iterations': iterations,
|
||||
'derived_key': derived_key}
|
||||
'derived_key': derived_key}
|
||||
|
||||
# Convert the key object to json string format and encrypt it with the
|
||||
# derived key.
|
||||
encrypted_key = \
|
||||
securesystemslib.pycrypto_keys._encrypt(json.dumps(imported_ed25519_key),
|
||||
derived_key_information)
|
||||
securesystemslib.pyca_crypto_keys._encrypt(
|
||||
json.dumps(imported_ed25519_key), derived_key_information)
|
||||
|
||||
with open(ed25519_keypath, 'wb') as file_object:
|
||||
file_object.write(encrypted_key.encode('utf-8'))
|
||||
file_object.write(encrypted_key.encode('utf-8'))
|
||||
|
||||
self.assertRaises(securesystemslib.exceptions.FormatError,
|
||||
repo_lib.import_ed25519_privatekey_from_file,
|
||||
ed25519_keypath, 'pw')
|
||||
repo_lib.import_ed25519_privatekey_from_file, ed25519_keypath, 'pw')
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -98,14 +98,6 @@
|
|||
# Initial 'timestamp.json' expiration time of 1 day.
|
||||
TIMESTAMP_EXPIRATION = 86400
|
||||
|
||||
try:
|
||||
securesystemslib.keys.check_crypto_libraries(['rsa', 'ed25519', 'general'])
|
||||
|
||||
except securesystemslib.exceptions.UnsupportedLibraryError: #pragma: no cover
|
||||
logger.warn('Warning: The repository and developer tools require'
|
||||
' additional libraries, which can be installed as follows:'
|
||||
'\n $ pip install tuf[tools]')
|
||||
|
||||
|
||||
class Repository(object):
|
||||
"""
|
||||
|
|
|
|||
Loading…
Reference in a new issue