Update code using deprecated functions from sequoia-openpgp.

- Now that we've raised our minimum supported `sequoia-openpgp`
    version, update code using deprecated functions.
This commit is contained in:
Neal H. Walfield 2024-07-04 22:08:49 +02:00
parent b3fbee9565
commit e85661e8b7
No known key found for this signature in database
GPG Key ID: 6863C9AD5B4D22D3
6 changed files with 16 additions and 13 deletions

View File

@ -119,8 +119,7 @@ fn active_certification(sq: &Sq,
// - Are not expired,
// - Alias the issuer, and
// - Satisfy the policy.
let mut certifications = ua.bundle().certifications()
.iter()
let mut certifications = ua.bundle().certifications2()
.filter(|sig| {
if let Some(ct) = sig.signature_creation_time() {
ct <= sq.time
@ -151,7 +150,7 @@ fn active_certification(sq: &Sq,
let pk = ua.cert().primary_key().key();
let certification = certifications.into_iter()
.filter_map(|sig| {
let mut sig = sig.clone();
let sig = sig.clone();
if sig.verify_userid_binding(issuer, pk, &userid).is_ok() {
Some(sig)
} else {

View File

@ -89,7 +89,7 @@ fn update_user_id_binding(sq: &Sq,
// Update the signature.
let sig = ua.binding_signature();
let mut sig = SignatureBuilder::from(sig.clone())
let sig = SignatureBuilder::from(sig.clone())
.set_signature_creation_time(reference_time.clone())?
.set_hash_algo(GOOD_HASHES[0])
.set_preferred_hash_algorithms(
@ -170,7 +170,7 @@ fn update_subkey_binding<P>(sq: &Sq,
builder = builder.set_embedded_signature(backsig)?;
}
let mut sig = builder.sign_subkey_binding(&mut signer, pk, ka.key())?;
let sig = builder.sign_subkey_binding(&mut signer, pk, ka.key())?;
// Verify it.
assert!(sig.verify_subkey_binding(signer.public(), pk, ka.key())

View File

@ -447,7 +447,7 @@ fn inspect_key(
}
}
inspect_certifications(sq, output,
bundle.certifications().iter(),
bundle.certifications2(),
print_certifications)?;
Ok(())

View File

@ -192,7 +192,7 @@ pub fn adopt(sq: Sq, mut command: cli::key::AdoptCommand) -> Result<()>
})?;
}
let mut sig = builder.sign_subkey_binding(&mut pk_signer, pk, &key)?;
let sig = builder.sign_subkey_binding(&mut pk_signer, pk, &key)?;
// Verify it.
assert!(sig

View File

@ -38,14 +38,16 @@ pub fn attest_certifications(
let mut attestation_signatures = Vec::new();
for uid in key.userids() {
if all {
attestation_signatures.append(&mut uid.attest_certifications(
attestation_signatures.append(&mut uid.attest_certifications2(
sq.policy,
sq.time,
&mut pk_signer,
uid.certifications(),
)?);
} else {
attestation_signatures.append(&mut uid.attest_certifications(
attestation_signatures.append(&mut uid.attest_certifications2(
sq.policy,
sq.time,
&mut pk_signer,
&[],
)?);
@ -54,14 +56,16 @@ pub fn attest_certifications(
for ua in key.user_attributes() {
if all {
attestation_signatures.append(&mut ua.attest_certifications(
attestation_signatures.append(&mut ua.attest_certifications2(
sq.policy,
sq.time,
&mut pk_signer,
ua.certifications(),
)?);
} else {
attestation_signatures.append(&mut ua.attest_certifications(
attestation_signatures.append(&mut ua.attest_certifications2(
sq.policy,
sq.time,
&mut pk_signer,
&[],
)?);

View File

@ -188,7 +188,7 @@ fn sq_certify() -> Result<()> {
for ua in vc.userids() {
if ua.userid().value() == b"<bob@example.org>" {
assert_eq!(
ua.bundle().certifications().len(),
ua.bundle().certifications2().count(),
certification_count);
let certifications: Vec<_>
= ua.certifications().collect();
@ -207,7 +207,7 @@ fn sq_certify() -> Result<()> {
let mut ok = false;
for ua in vc.userids() {
if ua.userid().value() == b"<bob@example.org>" {
assert_eq!(ua.bundle().certifications().len(),
assert_eq!(ua.bundle().certifications2().count(),
certification_count);
let certifications: Vec<_>