Skip to content

Commit

Permalink
Remove calls to deleted methods in tuf
Browse files Browse the repository at this point in the history
Methods that essentially duplicated the methods available in
`securesystemslib` were removed. Four methods were deleted.
 These methods were:
* generate_and_write_rsa_keypair
* generate_and_write_ed25519_keypair
* import_rsa_publickey_from_file
* import_ed25519_publickey_from_file

Signed-off-by: Oluwatobi Popoola  <[email protected]>
  • Loading branch information
Oluwatobi Popoola authored and tobithegreat committed Nov 30, 2018
1 parent 7dfae4e commit 880391d
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 50 deletions.
12 changes: 0 additions & 12 deletions tuf/developer_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -989,18 +989,6 @@ def _strip_prefix_from_targets_metadata(targets_metadata, prefix):
# Users are expected to call functions provided by repository_tool.py. We opt
# for this approach, as opposed to using import statements to achieve the
# equivalent, to avoid linter warnings for unused imports.
def generate_and_write_rsa_keypair(filepath, bits, password):
return repo_lib.generate_and_write_rsa_keypair(filepath, bits, password)

def generate_and_write_ed25519_keypair(filepath, password):
return repo_lib.generate_and_write_ed25519_keypair(filepath, password)

def import_rsa_publickey_from_file(filepath):
return repo_lib.import_rsa_publickey_from_file(filepath)

def import_ed25519_publickey_from_file(filepath):
return repo_lib.import_ed25519_publickey_from_file(filepath)

def import_rsa_privatekey_from_file(filepath, password):
return repo_lib.import_rsa_privatekey_from_file(filepath, password)

Expand Down
7 changes: 0 additions & 7 deletions tuf/repository_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -3157,9 +3157,6 @@ def append_signature(signature, metadata_filepath):
# Users are expected to call functions provided by repository_tool.py. We opt
# for wrapper functions, instead of using the import statements to achieve the
# equivalent, to avoid linter warnings for unused imports.
def generate_and_write_ed25519_keypair(filepath=None, password=None):
return repo_lib.generate_and_write_ed25519_keypair(filepath, password)

def generate_ed25519_key(scheme='ed25519'):
return securesystemslib.keys.generate_ed25519_key(scheme)

Expand All @@ -3171,10 +3168,6 @@ def import_ed25519_privatekey_from_file(filepath, password=None):

# NOTE: securesystemslib cannot presently import an Ed25519 key from PEM.

def generate_and_write_rsa_keypair(filepath=None,
bits=repo_lib.DEFAULT_RSA_KEY_BITS, password=None):
return repo_lib.generate_and_write_rsa_keypair(filepath, bits, password)

def generate_rsa_key(bits=DEFAULT_RSA_KEY_BITS, scheme='rsassa-pss-sha256'):
return securesystemslib.keys.generate_rsa_key(bits, scheme)

Expand Down
62 changes: 31 additions & 31 deletions tuf/scripts/repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,85 +48,85 @@
[--role <rolename> --sign </path/to/role_privkey>]
$ repo.py --verbose <0-5>
$ repo.py --clean [--path]
<Options>
--init:
Create new TUF repository in current working or specified directory.
--consistent:
Enable consistent snapshots for newly created TUF repository.
--bare:
Specify creation of bare TUF repository with no key created or set.
--path:
Choose specified path location of a TUF repository or key(s).
--role:
Specify top-level role(s) affected by the main command-line option.
--pubkeys:
Indicate location of key(s) affected by the main command-line option.
--root_pw:
Set password for encrypting top-level key file of root role.
--targets_pw:
Set password for encrypting top-level key file of targets role.
--snapshot_pw:
Set password for encrypting top-level key file of snapshot role.
--timestamp_pw:
Set password for encrypting top-level key file of timestamp role.
--add:
Add file specified by <target> to the Targets metadata.
--recursive:
Include files in subdirectories of specified directory <dir>.
--remove:
Remove target files from Targets metadata matching <glob pattern>.
--distrust:
Discontinue trust of keys located in </path/to/pubkey> directory of a role.
--trust:
Indicate trusted keys located in </path/to/pubkey> directory of a role.
--sign:
--sign:
Sign metadata of target role(s) with keys in specified directory.
--key:
Generate cryptographic key of specified type <keytype> (default: Ed25519).
--filename:
Specify filename associated with generated top-level key.
--pw:
Set password for the generated key of specified type <keytype>.
--delegate:
Delegate trust of target files from Targets role (or <rolename> specified
in --role) to --delegatee role with specified <rolename>.
--delegatee:
Specify role that is targetted by delegator in --role to sign for
target files matching delegated <glob pattern> or in revocation of trust.
--terminating:
Mark delegation to --delegatee role from delegator as a terminating one.
--threshold:
Specify signature threshold of --delegatee role as the value <X>.
--revoke:
Revoke trust of target files from delegated role (--delegatee)
--verbose:
Set the verbosity level of logging messages. Accepts values 1-5.
--clean:
Delete repo in current working or specified directory.
"""
Expand Down Expand Up @@ -899,16 +899,16 @@ def set_top_level_keys(repository, parsed_arguments):
parsed_arguments.pw = securesystemslib.interface.get_password(
prompt='Enter a password for the top-level role keys: ', confirm=True)

repo_tool.generate_and_write_ed25519_keypair(
securesystemslib.interface.generate_and_write_ed25519_keypair(
os.path.join(parsed_arguments.path, KEYSTORE_DIR,
ROOT_KEY_NAME), password=parsed_arguments.root_pw)
repo_tool.generate_and_write_ed25519_keypair(
securesystemslib.interface.generate_and_write_ed25519_keypair(
os.path.join(parsed_arguments.path, KEYSTORE_DIR,
TARGETS_KEY_NAME), password=parsed_arguments.targets_pw)
repo_tool.generate_and_write_ed25519_keypair(
securesystemslib.interface.generate_and_write_ed25519_keypair(
os.path.join(parsed_arguments.path, KEYSTORE_DIR,
SNAPSHOT_KEY_NAME), password=parsed_arguments.snapshot_pw)
repo_tool.generate_and_write_ed25519_keypair(
securesystemslib.interface.generate_and_write_ed25519_keypair(
os.path.join(parsed_arguments.path, KEYSTORE_DIR,
TIMESTAMP_KEY_NAME), password=parsed_arguments.timestamp_pw)

Expand Down

0 comments on commit 880391d

Please sign in to comment.