Skip to content

Commit 7ad3185

Browse files
cleanup
Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
1 parent ace0dfb commit 7ad3185

File tree

2 files changed

+4
-22
lines changed

2 files changed

+4
-22
lines changed

sigstore/_internal/rekor/client.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
import rekor_types
2828
import requests
29-
from sigstore_protobuf_specs.dev.sigstore.rekor import v1 as rekor_v1
29+
from sigstore_protobuf_specs.dev.sigstore.rekor.v1 import TransparencyLogEntry
3030

3131
from sigstore._internal import USER_AGENT
3232
from sigstore._internal.rekor_tiles.dev.sigstore.rekor import v2
@@ -290,9 +290,7 @@ def __del__(self) -> None:
290290
"""
291291
self.session.close()
292292

293-
def create_entry(
294-
self, request: v2.CreateEntryRequest
295-
) -> rekor_v1.TransparencyLogEntry:
293+
def create_entry(self, request: v2.CreateEntryRequest) -> TransparencyLogEntry:
296294
"""
297295
Submit a new entry for inclusion in the Rekor log.
298296
"""

sigstore/sign.py

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,14 @@ def key_to_details(
8282
key: ec.EllipticCurvePrivateKey | rsa.RSAPrivateKey,
8383
) -> v1.PublicKeyDetails:
8484
"""
85-
Converts a key to a PublicKeyDetails. Although, the key type is currently hardcoded to PKIX_ECDSA_P384_SHA_256.
85+
Converts a key to a PublicKeyDetails. Although, the key type is currently hardcoded to a single type.
8686
"""
8787
if isinstance(key, ec.EllipticCurvePrivateKey) and isinstance(
8888
key.curve, ec.SECP256R1
8989
):
9090
return v1.PublicKeyDetails.PKIX_ECDSA_P384_SHA_256
9191
else:
92-
raise Exception("unsupported key type")
92+
raise Exception(f"unsupported key type {key}")
9393

9494

9595
class Signer:
@@ -300,22 +300,6 @@ def sign_artifact(
300300
),
301301
signature=artifact_signature,
302302
)
303-
proposed_entry = rekor_types.Hashedrekord(
304-
spec=rekor_types.hashedrekord.HashedrekordV001Schema(
305-
signature=rekor_types.hashedrekord.Signature(
306-
content=base64.b64encode(artifact_signature).decode(),
307-
public_key=rekor_types.hashedrekord.PublicKey(
308-
content=b64_cert.decode()
309-
),
310-
),
311-
data=rekor_types.hashedrekord.Data(
312-
hash=rekor_types.hashedrekord.Hash(
313-
algorithm=hashed_input._as_hashedrekord_algorithm(),
314-
value=hashed_input.digest.hex(),
315-
)
316-
),
317-
),
318-
)
319303

320304
# Create the proposed hashedrekord entry
321305
if isinstance(self._signing_ctx._rekor, RekorV2Client):

0 commit comments

Comments
 (0)