Skip to content

Commit

Permalink
Async Signer: add support for async OCSP call (#458)
Browse files Browse the repository at this point in the history
Co-authored-by: klein <klein@adobe.com>
Co-authored-by: Gavin  Peacock <gpeacock@adobe.com>
  • Loading branch information
3 people committed Apr 30, 2024
1 parent 0769dfb commit ca3df05
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion sdk/src/cose_sign.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,12 @@ fn build_headers(signer: &dyn Signer, data: &[u8], alg: SigningAlg) -> Result<(H
};

let certs = signer.certs()?;
let ocsp_val = signer.ocsp_val();

let ocsp_val = if _sync {
signer.ocsp_val()
} else {
signer.ocsp_val().await
};

let sc_der_array_or_bytes = match certs.len() {
1 => Value::Bytes(certs[0].clone()), // single cert
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/openssl/temp_signer_async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ impl crate::AsyncSigner for AsyncSignerAdapter {
self.tsa_url.clone()
}

fn ocsp_val(&self) -> Option<Vec<u8>> {
async fn ocsp_val(&self) -> Option<Vec<u8>> {
self.ocsp_val.clone()
}
}
2 changes: 1 addition & 1 deletion sdk/src/signer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ pub trait AsyncSigner: Sync {
/// This is the only C2PA supported cert revocation method.
/// By pre-querying the value for a your signing cert the value can
/// be cached taking pressure off of the CA (recommended by C2PA spec)
fn ocsp_val(&self) -> Option<Vec<u8>> {
async fn ocsp_val(&self) -> Option<Vec<u8>> {
None
}

Expand Down

0 comments on commit ca3df05

Please sign in to comment.