Skip to content

Commit

Permalink
GCPSigner: Add exception for unsupported keys
Browse files Browse the repository at this point in the history
This seems correct-er and makes pylint happier.

Signed-off-by: Jussi Kukkonen <[email protected]>
  • Loading branch information
jku committed May 21, 2024
1 parent 603b461 commit 3b143af
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions securesystemslib/signer/_gcp_signer.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,10 @@ def _get_hash_algorithm(public_key: Key) -> str:
# nistp256 uses sha-256, nistp384 uses sha-384
bits = public_key.scheme.split("-nistp")[-1]
algo = f"sha{bits}"
else:
raise exceptions.UnsupportedAlgorithmError(
f"Unsupported key type {public_key.keytype} in key {public_key.keyid}"
)

# trigger UnsupportedAlgorithm if appropriate
_ = sslib_hash.digest(algo)
Expand Down

0 comments on commit 3b143af

Please sign in to comment.