Skip to content

Commit

Permalink
Avoid storing references to Certificates (#12028)
Browse files Browse the repository at this point in the history
Its asymmetric with the read path, which owns the value, and thus woudl need to change for our GAT API.
  • Loading branch information
alex authored Nov 24, 2024
1 parent 3452160 commit d3403c0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/rust/cryptography-x509/src/pkcs7.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pub struct SignedData<'a> {
pub certificates: Option<
common::Asn1ReadableOrWritable<
asn1::SetOf<'a, certificate::Certificate<'a>>,
asn1::SetOfWriter<'a, &'a certificate::Certificate<'a>>,
asn1::SetOfWriter<'a, certificate::Certificate<'a>>,
>,
>,

Expand Down
6 changes: 3 additions & 3 deletions src/rust/src/pkcs7.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ fn serialize_certificates<'p>(

let raw_certs = py_certs
.iter()
.map(|c| c.raw.borrow_dependent())
.map(|c| c.raw.borrow_dependent().clone())
.collect::<Vec<_>>();

let signed_data = pkcs7::SignedData {
Expand Down Expand Up @@ -211,7 +211,7 @@ fn sign_and_serialize<'p>(
let mut digest_algs = vec![];
let mut certs = py_certs
.iter()
.map(|p| p.raw.borrow_dependent())
.map(|p| p.raw.borrow_dependent().clone())
.collect::<Vec<_>>();

let ka_vec = cryptography_keepalive::KeepAlive::new();
Expand Down Expand Up @@ -288,7 +288,7 @@ fn sign_and_serialize<'p>(
if !digest_algs.contains(&digest_alg) {
digest_algs.push(digest_alg.clone());
}
certs.push(cert.raw.borrow_dependent());
certs.push(cert.raw.borrow_dependent().clone());

signer_infos.push(pkcs7::SignerInfo {
version: 1,
Expand Down

0 comments on commit d3403c0

Please sign in to comment.