Skip to content

Commit 669e503

Browse files
committed
require trust root in constructor, remove more unused code, update readme
1 parent 5bbeb75 commit 669e503

File tree

10 files changed

+153
-411
lines changed

10 files changed

+153
-411
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,17 @@ let bundle_json = serde_json::to_string_pretty(&bundle)?;
114114
- Identity-based verification policies
115115
- Ambient credential detection for CI/CD environments
116116

117+
## Cryptography
118+
119+
This library uses [aws-lc-rs](https://github.com/aws/aws-lc-rs) as its cryptographic backend. AWS-LC is a general-purpose cryptographic library maintained by AWS, based on code from BoringSSL. It provides:
120+
121+
- ECDSA (P-256, P-384) signature verification and signing
122+
- Ed25519 signature support
123+
- SHA-256/SHA-384/SHA-512 hashing
124+
- X.509 certificate parsing and validation
125+
126+
AWS-LC is [FIPS 140-3 validated](https://csrc.nist.gov/projects/cryptographic-module-validation-program/certificate/4816), making this library suitable for environments with compliance requirements.
127+
117128
## Minimum Supported Rust Version
118129

119130
Rust 1.70 or later.

crates/sigstore-conformance/src/main.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use sigstore_oidc::parse_identity_token;
1212
use sigstore_rekor::RekorClient;
1313
use sigstore_trust_root::TrustedRoot;
1414
use sigstore_types::{Bundle, MediaType, Sha256Hash, SignatureContent};
15-
use sigstore_verify::{verify_with_trusted_root, VerificationPolicy};
15+
use sigstore_verify::{verify, VerificationPolicy};
1616

1717
use std::env;
1818
use std::fs;
@@ -453,8 +453,7 @@ fn verify_bundle(args: &[String]) -> Result<(), Box<dyn std::error::Error>> {
453453
let dummy_artifact = vec![];
454454

455455
// Verify the signature with trusted root
456-
let result =
457-
verify_with_trusted_root(&dummy_artifact, &bundle, &digest_policy, &trusted_root)?;
456+
let result = verify(&dummy_artifact, &bundle, &digest_policy, &trusted_root)?;
458457

459458
if !result.success {
460459
return Err("Verification failed".into());
@@ -466,7 +465,7 @@ fn verify_bundle(args: &[String]) -> Result<(), Box<dyn std::error::Error>> {
466465
let artifact_data = fs::read(&artifact_or_digest)?;
467466

468467
// Verify with trusted root
469-
let result = verify_with_trusted_root(&artifact_data, &bundle, &policy, &trusted_root)?;
468+
let result = verify(&artifact_data, &bundle, &policy, &trusted_root)?;
470469

471470
if !result.success {
472471
return Err("Verification failed".into());

crates/sigstore-tsa/src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,11 @@
66
pub mod asn1;
77
pub mod client;
88
pub mod error;
9-
pub mod parse;
109
pub mod verify;
1110

1211
pub use asn1::{
1312
AlgorithmIdentifier, Asn1MessageImprint, PkiStatus, TimeStampReq, TimeStampResp, TstInfo,
1413
};
1514
pub use client::{timestamp_sigstore, TimestampClient};
1615
pub use error::{Error, Result};
17-
pub use parse::parse_timestamp;
1816
pub use verify::{verify_timestamp_response, TimestampResult, VerifyOpts};

crates/sigstore-tsa/src/parse.rs

Lines changed: 0 additions & 232 deletions
This file was deleted.

crates/sigstore-tsa/src/verify.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use webpki::{anchor_from_trusted_cert, EndEntityCert, KeyUsage, ALL_VERIFICATION
2020

2121
// Define OIDs as constants using const_oid::db
2222
const ID_KP_TIME_STAMPING: ObjectIdentifier = const_oid::db::rfc5280::ID_KP_TIME_STAMPING;
23-
const ID_SIGNED_DATA_STR: ObjectIdentifier = ObjectIdentifier::new_unwrap("1.2.840.113549.1.7.2");
23+
const ID_SIGNED_DATA: ObjectIdentifier = const_oid::db::rfc5911::ID_SIGNED_DATA;
2424
const OID_MESSAGE_DIGEST: ObjectIdentifier = const_oid::db::rfc6268::ID_MESSAGE_DIGEST;
2525
const OID_SHA256: ObjectIdentifier = const_oid::db::rfc5912::ID_SHA_256;
2626
const OID_SHA384: ObjectIdentifier = const_oid::db::rfc5912::ID_SHA_384;
@@ -173,7 +173,7 @@ pub fn verify_timestamp_response(
173173
};
174174

175175
// Verify content type is SignedData
176-
if content_info.content_type != ID_SIGNED_DATA_STR {
176+
if content_info.content_type != ID_SIGNED_DATA {
177177
return Err(Error::ParseError(
178178
"ContentInfo content type is not SignedData".to_string(),
179179
));

crates/sigstore-verify/src/lib.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
//! # Example
66
//!
77
//! ```no_run
8-
//! use sigstore_verify::{verify_with_trusted_root, VerificationPolicy};
8+
//! use sigstore_verify::{verify, VerificationPolicy};
99
//! use sigstore_trust_root::TrustedRoot;
1010
//! use sigstore_types::Bundle;
1111
//!
@@ -19,7 +19,7 @@
1919
//! .require_identity("user@example.com")
2020
//! .require_issuer("https://accounts.google.com");
2121
//!
22-
//! let result = verify_with_trusted_root(&artifact, &bundle, &policy, &trusted_root)?;
22+
//! let result = verify(&artifact, &bundle, &policy, &trusted_root)?;
2323
//! assert!(result.success);
2424
//! # Ok(())
2525
//! # }
@@ -41,6 +41,5 @@ pub use sigstore_types as types;
4141

4242
pub use error::{Error, Result};
4343
pub use verify::{
44-
verify, verify_with_trusted_root, VerificationPolicy, VerificationResult, Verifier,
45-
DEFAULT_CLOCK_SKEW_SECONDS,
44+
verify, VerificationPolicy, VerificationResult, Verifier, DEFAULT_CLOCK_SKEW_SECONDS,
4645
};

0 commit comments

Comments
 (0)