Skip to content

Commit d3403c0

Browse files
authored
Avoid storing references to Certificates (#12028)
Its asymmetric with the read path, which owns the value, and thus woudl need to change for our GAT API.
1 parent 3452160 commit d3403c0

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/rust/cryptography-x509/src/pkcs7.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ pub struct SignedData<'a> {
4141
pub certificates: Option<
4242
common::Asn1ReadableOrWritable<
4343
asn1::SetOf<'a, certificate::Certificate<'a>>,
44-
asn1::SetOfWriter<'a, &'a certificate::Certificate<'a>>,
44+
asn1::SetOfWriter<'a, certificate::Certificate<'a>>,
4545
>,
4646
>,
4747

src/rust/src/pkcs7.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ fn serialize_certificates<'p>(
5252

5353
let raw_certs = py_certs
5454
.iter()
55-
.map(|c| c.raw.borrow_dependent())
55+
.map(|c| c.raw.borrow_dependent().clone())
5656
.collect::<Vec<_>>();
5757

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

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

293293
signer_infos.push(pkcs7::SignerInfo {
294294
version: 1,

0 commit comments

Comments
 (0)