summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2020-10-01 12:06:14 +0200
committerJustus Winter <justus@sequoia-pgp.org>2020-10-02 15:09:10 +0200
commit46f9d859b56cfbbf8a0e41d76f2d0abaa055b73d (patch)
tree25cfaa36095be4568119fa555c14be84738b8a5f
parent23cb4b184b8c710d5c54bd45dbad206d59ae36b3 (diff)
openpgp: Rename Cert::merge_packets to Cert::insert_packets.
- This is closer to collection types such as HashMap, and distinguishes the function from Cert::merge that merges two certificates. - See #572.
-rw-r--r--openpgp-ffi/include/sequoia/openpgp.h2
-rw-r--r--openpgp-ffi/src/cert.rs10
-rw-r--r--openpgp/src/cert/amalgamation/key.rs8
-rw-r--r--openpgp/src/cert/bindings.rs10
-rw-r--r--openpgp/src/cert/builder.rs10
-rw-r--r--openpgp/src/cert/mod.rs72
-rw-r--r--openpgp/src/cert/revoke.rs16
-rw-r--r--openpgp/src/packet/mod.rs10
-rw-r--r--openpgp/src/packet/signature.rs10
-rw-r--r--openpgp/src/packet/signature/subpacket.rs48
-rw-r--r--openpgp/src/policy.rs10
-rw-r--r--openpgp/src/serialize/cert.rs2
-rw-r--r--openpgp/src/types/mod.rs6
13 files changed, 107 insertions, 107 deletions
diff --git a/openpgp-ffi/include/sequoia/openpgp.h b/openpgp-ffi/include/sequoia/openpgp.h
index a5c49596..75b6098b 100644
--- a/openpgp-ffi/include/sequoia/openpgp.h
+++ b/openpgp-ffi/include/sequoia/openpgp.h
@@ -908,7 +908,7 @@ pgp_cert_t pgp_cert_merge (pgp_error_t *errp,
/// Consumes `cert` and the packets in `packets`. The buffer, however,
/// must be freed by the caller.
/*/
-pgp_cert_t pgp_cert_merge_packets (pgp_error_t *errp,
+pgp_cert_t pgp_cert_insert_packets (pgp_error_t *errp,
pgp_cert_t cert,
pgp_packet_t *packets,
size_t packets_len);
diff --git a/openpgp-ffi/src/cert.rs b/openpgp-ffi/src/cert.rs
index c1040c11..450d2925 100644
--- a/openpgp-ffi/src/cert.rs
+++ b/openpgp-ffi/src/cert.rs
@@ -109,7 +109,7 @@ fn pgp_cert_merge(errp: Option<&mut *mut crate::error::Error>,
/// Consumes `cert` and the packets in `packets`. The buffer, however,
/// must be managed by the caller.
#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C"
-fn pgp_cert_merge_packets(errp: Option<&mut *mut crate::error::Error>,
+fn pgp_cert_insert_packets(errp: Option<&mut *mut crate::error::Error>,
cert: *mut Cert,
packets: *mut *mut Packet,
packets_len: size_t)
@@ -120,7 +120,7 @@ fn pgp_cert_merge_packets(errp: Option<&mut *mut crate::error::Error>,
};
let packets =
packets.iter_mut().map(|&mut p| p.move_from_raw());
- cert.merge_packets(packets).move_into_raw(errp)
+ cert.insert_packets(packets).move_into_raw(errp)
}
/// Returns the fingerprint.
@@ -220,7 +220,7 @@ fn int_to_reason_for_revocation(code: c_int) -> ReasonForRevocation {
/// pgp_key_pair_free (primary_keypair);
///
/// pgp_packet_t packet = pgp_signature_into_packet (revocation);
-/// cert = pgp_cert_merge_packets (NULL, cert, &packet, 1);
+/// cert = pgp_cert_insert_packets (NULL, cert, &packet, 1);
/// assert (cert);
///
/// pgp_revocation_status_t rs = pgp_cert_revocation_status (cert, policy, 0);
@@ -278,7 +278,7 @@ fn pgp_cert_revoke_in_place(errp: Option<&mut *mut crate::error::Error>,
let builder = CertRevocationBuilder::new();
let builder = ffi_try_or!(builder.set_reason_for_revocation(code, reason), None);
let sig = builder.build(signer.as_mut(), &cert, None);
- cert.merge_packets(sig).move_into_raw(errp)
+ cert.insert_packets(sig).move_into_raw(errp)
}
/// Returns whether the Cert is alive at the specified time.
@@ -314,7 +314,7 @@ fn pgp_cert_set_expiration_time(errp: Option<&mut *mut crate::error::Error>,
let sigs = ffi_try_or!(cert.set_expiration_time(policy, None, signer.as_mut(),
maybe_time(expiry)), None);
- cert.merge_packets(sigs).move_into_raw(errp)
+ cert.insert_packets(sigs).move_into_raw(errp)
}
/// Returns whether the Cert includes any secret key material.
diff --git a/openpgp/src/cert/amalgamation/key.rs b/openpgp/src/cert/amalgamation/key.rs
index a2a87452..f32f7406 100644
--- a/openpgp/src/cert/amalgamation/key.rs
+++ b/openpgp/src/cert/amalgamation/key.rs
@@ -1408,7 +1408,7 @@ impl<'a, P> ValidPrimaryKeyAmalgamation<'a, P>
/// .key().clone().parts_into_secret()?.into_keypair()?;
///
/// let sigs = vc.primary_key().set_expiration_time(&mut signer, Some(t))?;
- /// let cert = cert.merge_packets(sigs)?;
+ /// let cert = cert.insert_packets(sigs)?;
///
/// // The primary key isn't expired yet.
/// let vc = cert.with_policy(p, None)?;
@@ -1511,7 +1511,7 @@ impl<'a, P> ValidSubordinateKeyAmalgamation<'a, P>
/// Some(t))?);
/// }
/// }
- /// let cert = cert.merge_packets(sigs)?;
+ /// let cert = cert.insert_packets(sigs)?;
///
/// // They aren't expired yet.
/// let vc = cert.with_policy(p, None)?;
@@ -1729,7 +1729,7 @@ impl<'a, P> ValidErasedKeyAmalgamation<'a, P>
/// Some(t))?);
/// }
/// }
- /// let cert = cert.merge_packets(sigs)?;
+ /// let cert = cert.insert_packets(sigs)?;
///
/// // They aren't expired yet.
/// let vc = cert.with_policy(p, None)?;
@@ -2239,7 +2239,7 @@ mod test {
.map(Into::into)
})
.collect::<Vec<Packet>>();
- let cert = cert.merge_packets(sigs).unwrap();
+ let cert = cert.insert_packets(sigs).unwrap();
for ka in cert.keys().with_policy(p, None) {
assert!(ka.alive().is_ok());
diff --git a/openpgp/src/cert/bindings.rs b/openpgp/src/cert/bindings.rs
index d4262c4b..56ca443e 100644
--- a/openpgp/src/cert/bindings.rs
+++ b/openpgp/src/cert/bindings.rs
@@ -62,7 +62,7 @@ impl<P: key::KeyParts> Key<P, key::SubordinateRole> {
/// let binding = subkey.bind(&mut keypair, &cert, builder)?;
///
/// // Now merge the key and binding signature into the Cert.
- /// let cert = cert.merge_packets(vec![Packet::from(subkey),
+ /// let cert = cert.insert_packets(vec![Packet::from(subkey),
/// binding.into()])?;
///
/// // Check that we have an encryption subkey.
@@ -114,7 +114,7 @@ impl UserID {
/// let binding = userid.bind(&mut keypair, &cert, builder)?;
///
/// // Now merge the userid and binding signature into the Cert.
- /// let cert = cert.merge_packets(vec![Packet::from(userid),
+ /// let cert = cert.insert_packets(vec![Packet::from(userid),
/// binding.into()])?;
///
/// // Check that we have a userid.
@@ -175,7 +175,7 @@ impl UserID {
/// None, None)?;
///
/// // `certificate` can now be used, e.g. by merging it into `bob`.
- /// let bob = bob.merge_packets(certificate)?;
+ /// let bob = bob.insert_packets(certificate)?;
///
/// // Check that we have a certification on the userid.
/// assert_eq!(bob.userids().nth(0).unwrap()
@@ -250,7 +250,7 @@ impl UserAttribute {
/// let binding = user_attr.bind(&mut keypair, &cert, builder)?;
///
/// // Now merge the user attribute and binding signature into the Cert.
- /// let cert = cert.merge_packets(vec![Packet::from(user_attr),
+ /// let cert = cert.insert_packets(vec![Packet::from(user_attr),
/// binding.into()])?;
///
/// // Check that we have a user attribute.
@@ -315,7 +315,7 @@ impl UserAttribute {
/// None, None)?;
///
/// // `certificate` can now be used, e.g. by merging it into `bob`.
- /// let bob = bob.merge_packets(certificate)?;
+ /// let bob = bob.insert_packets(certificate)?;
///
/// // Check that we have a certification on the userid.
/// assert_eq!(bob.user_attributes().nth(0).unwrap()
diff --git a/openpgp/src/cert/builder.rs b/openpgp/src/cert/builder.rs
index f48ff951..63ebddcd 100644
--- a/openpgp/src/cert/builder.rs
+++ b/openpgp/src/cert/builder.rs
@@ -1003,7 +1003,7 @@ impl CertBuilder {
builder = builder.set_primary_userid(true)?;
}
let signature = uid.bind(&mut signer, &cert, builder)?;
- cert = cert.merge_packets(
+ cert = cert.insert_packets(
vec![Packet::from(uid), signature.into()])?;
}
@@ -1017,7 +1017,7 @@ impl CertBuilder {
builder = builder.set_primary_userid(true)?;
}
let signature = ua.bind(&mut signer, &cert, builder)?;
- cert = cert.merge_packets(
+ cert = cert.insert_packets(
vec![Packet::from(ua), signature.into()])?;
}
@@ -1056,7 +1056,7 @@ impl CertBuilder {
if let Some(ref password) = self.password {
subkey.secret_mut().encrypt_in_place(password)?;
}
- cert = cert.merge_packets(vec![Packet::SecretSubkey(subkey),
+ cert = cert.insert_packets(vec![Packet::SecretSubkey(subkey),
signature.into()])?;
}
@@ -1234,7 +1234,7 @@ mod tests {
assert_eq!(cert.revocation_status(p, None),
RevocationStatus::NotAsFarAsWeKnow);
- let cert = cert.merge_packets(revocation.clone()).unwrap();
+ let cert = cert.insert_packets(revocation.clone()).unwrap();
assert_eq!(cert.revocation_status(p, None),
RevocationStatus::Revoked(vec![ &revocation ]));
}
@@ -1420,7 +1420,7 @@ mod tests {
let sig = signature::SignatureBuilder::new(SignatureType::DirectKey)
.set_signature_creation_time(then)?
.sign_hash(&mut primary_signer, hash)?;
- let cert = cert.merge_packets(sig)?;
+ let cert = cert.insert_packets(sig)?;
assert!(cert.with_policy(p, then)?.primary_userid().is_err());
assert_eq!(cert.revocation_keys(p).collect::<HashSet<_>>(),
diff --git a/openpgp/src/cert/mod.rs b/openpgp/src/cert/mod.rs
index d623d097..e6bdb275 100644
--- a/openpgp/src/cert/mod.rs
+++ b/openpgp/src/cert/mod.rs
@@ -35,7 +35,7 @@
//! also include any secret key material.
//! - *Using a certificate*: See the [`Cert`] and [`ValidCert`] data structures.
//! - *Revoking a certificate*: See the [`CertRevocationBuilder`] data structure.
-//! - *Merging packets*: See the [`Cert::merge_packets`] method.
+//! - *Merging packets*: See the [`Cert::insert_packets`] method.
//! - *Merging certificates*: See the [`Cert::merge`] method.
//! - *Creating third-party certifications*: See the [`UserID::certify`]
//! and [`UserAttribute::certify`] methods.
@@ -118,7 +118,7 @@
//! [`Cert::as_tsk`]: struct.Cert.html#method.as_tsk
//! [`ValidCert`]: struct.ValidCert.html
//! [`CertRevocationBuilder`]: struct.CertRevocationBuilder.html
-//! [`Cert::merge_packets`]: struct.Cert.html#method.merge_packets
+//! [`Cert::insert_packets`]: struct.Cert.html#method.insert_packets
//! [`Cert::merge`]: struct.Cert.html#method.merge
//! [`UserID::certify`]: ../packet/struct.UserID.html#method.certify
//! [`UserAttribute::certify`]: ../packet/user_attribute/struct.UserAttribute.html#method.certify
@@ -822,7 +822,7 @@ impl Cert {
///
/// // Merge the revocation certificate. `cert` is now considered
/// // to be revoked.
- /// let cert = cert.merge_packets(rev.clone())?;
+ /// let cert = cert.insert_packets(rev.clone())?;
/// assert_eq!(cert.revocation_status(p, None),
/// RevocationStatus::Revoked(vec![&rev.into()]));
/// # Ok(())
@@ -899,7 +899,7 @@ impl Cert {
/// let rev = cert.revoke(&mut keypair,
/// ReasonForRevocation::KeyCompromised,
/// b"It was the maid :/")?;
- /// let cert = cert.merge_packets(rev)?;
+ /// let cert = cert.insert_packets(rev)?;
/// if let RevocationStatus::Revoked(revs) = cert.revocation_status(p, None) {
/// assert_eq!(revs.len(), 1);
/// let rev = revs[0];
@@ -941,7 +941,7 @@ impl Cert {
let sigs = primary.set_validity_period_as_of(primary_signer,
expiration,
now)?;
- self.merge_packets(sigs)
+ self.insert_packets(sigs)
}
/// Sets the certificate to expire at the specified time.
@@ -988,7 +988,7 @@ impl Cert {
/// let sigs = cert.set_expiration_time(p, None, &mut keypair,
/// Some(time::SystemTime::now()))?;
///
- /// let cert = cert.merge_packets(sigs)?;
+ /// let cert = cert.insert_packets(sigs)?;
/// assert!(cert.with_policy(p, None)?.alive().is_err());
/// # Ok(())
/// # }
@@ -1037,7 +1037,7 @@ impl Cert {
/// # // Add a User ID without a binding signature and make sure
/// # // it is still returned.
/// # let userid = UserID::from("alice@example.net");
- /// # let cert = cert.merge_packets(userid)?;
+ /// # let cert = cert.insert_packets(userid)?;
/// # assert_eq!(cert.userids().count(), 2);
/// # Ok(())
/// # }
@@ -1154,7 +1154,7 @@ impl Cert {
/// # let tag = Tag::Private(61);
/// # let unknown
/// # = Unknown::new(tag, openpgp::Error::UnsupportedPacketType(tag).into());
- /// # let cert = cert.merge_packets(unknown).unwrap();
+ /// # let cert = cert.insert_packets(unknown).unwrap();
/// println!("{}'s has {} unknown components.",
/// cert.fingerprint(),
/// cert.unknowns().count());
@@ -1948,10 +1948,10 @@ impl Cert {
/// returned.
///
/// This routine merges duplicate packets. This is different from
- /// [`Cert::merge_packets`], which prefers keys in the packets that
+ /// [`Cert::insert_packets`], which prefers keys in the packets that
/// are being merged into the certificate.
///
- /// [`Cert::merge_packets`]: #method.merge_packets
+ /// [`Cert::insert_packets`]: #method.insert_packets
///
/// # Examples
///
@@ -2094,7 +2094,7 @@ impl Cert {
///
/// // Merge in the revocation certificate.
/// assert_eq!(cert.primary_key().self_revocations().len(), 0);
- /// let cert = cert.merge_packets(rev)?;
+ /// let cert = cert.insert_packets(rev)?;
/// assert_eq!(cert.primary_key().self_revocations().len(), 1);
///
///
@@ -2104,7 +2104,7 @@ impl Cert {
/// openpgp::Error::UnsupportedPacketType(tag).into());
///
/// // It shows up as an unknown component.
- /// let cert = cert.merge_packets(unknown)?;
+ /// let cert = cert.insert_packets(unknown)?;
/// assert_eq!(cert.unknowns().count(), 1);
/// for p in cert.unknowns() {
/// assert_eq!(p.tag(), tag);
@@ -2117,7 +2117,7 @@ impl Cert {
///
/// // Merging packets that are known to not belong to a
/// // certificate result in an error.
- /// assert!(cert.merge_packets(lit).is_err());
+ /// assert!(cert.insert_packets(lit).is_err());
/// # Ok(())
/// # }
/// ```
@@ -2147,7 +2147,7 @@ impl Cert {
///
/// // Merge in the public key. Recall: the packets that are
/// // being merged into the certificate take precedence.
- /// let cert = cert.merge_packets(pk)?;
+ /// let cert = cert.insert_packets(pk)?;
///
/// // The secret key material is stripped.
/// assert!(! cert.primary_key().has_secret());
@@ -2186,7 +2186,7 @@ impl Cert {
///
/// // Merge in the signature. Recall: the packets that are
/// // being merged into the certificate take precedence.
- /// let cert = cert.merge_packets(sig)?;
+ /// let cert = cert.insert_packets(sig)?;
///
/// // The old binding signature is replaced.
/// assert_eq!(cert.userids().nth(0).unwrap().self_signatures().len(), 1);
@@ -2195,7 +2195,7 @@ impl Cert {
/// .subpackets(SubpacketTag::NotationData).count(), 1);
/// # Ok(()) }
/// ```
- pub fn merge_packets<I>(self, packets: I)
+ pub fn insert_packets<I>(self, packets: I)
-> Result<Self>
where I: IntoIterator,
I::Item: Into<Packet>,
@@ -2786,7 +2786,7 @@ impl<'a> ValidCert<'a> {
///
/// // Merge the revocation certificate. `cert` is now considered
/// // to be revoked.
- /// let cert = cert.merge_packets(rev.clone())?;
+ /// let cert = cert.insert_packets(rev.clone())?;
/// assert_eq!(cert.with_policy(p, None)?.revocation_status(),
/// RevocationStatus::Revoked(vec![&rev.into()]));
/// # Ok(())
@@ -2995,7 +2995,7 @@ impl<'a> ValidCert<'a> {
/// .set_primary_userid(false)?;
/// let bob: UserID = "Bob".into();
/// let sig = bob.bind(&mut signer, &cert, sig)?;
- /// let cert = cert.merge_packets(vec![Packet::from(bob), sig.into()])?;
+ /// let cert = cert.insert_packets(vec![Packet::from(bob), sig.into()])?;
/// # assert_eq!(cert.userids().count(), 2);
///
/// // Alice should still be the primary User ID, because it has the
@@ -3010,7 +3010,7 @@ impl<'a> ValidCert<'a> {
/// .set_signature_creation_time(t2)?;
/// let carol: UserID = "Carol".into();
/// let sig = carol.bind(&mut signer, &cert, sig)?;
- /// let cert = cert.merge_packets(vec![Packet::from(carol), sig.into()])?;
+ /// let cert = cert.insert_packets(vec![Packet::from(carol), sig.into()])?;
/// # assert_eq!(cert.userids().count(), 3);
///
/// // It should now be the primary User ID, because it is the
@@ -3059,7 +3059,7 @@ impl<'a> ValidCert<'a> {
/// .primary_key().key().clone().parts_into_secret()?.into_keypair()?;
/// let binding = userid.bind(&mut signer, &cert, sig)?;
/// // Merge it.
- /// let cert = cert.merge_packets(
+ /// let cert = cert.insert_packets(
/// vec![Packet::from(userid), binding.into()])?;
///
/// // At t0, the new User ID is not yet valid (it doesn't have a
@@ -3144,7 +3144,7 @@ impl<'a> ValidCert<'a> {
/// # let ua = UserAttribute::new(&[sp]);
/// #
/// // Add a User Attribute without a self-signature to the certificate.
- /// let cert = cert.merge_packets(ua)?;
+ /// let cert = cert.insert_packets(ua)?;
/// assert_eq!(cert.user_attributes().count(), 1);
///
/// // Without a self-signature, it is definitely not valid.
@@ -3712,7 +3712,7 @@ mod test {
}
#[test]
- fn merge_packets() {
+ fn insert_packets() {
use crate::armor;
use crate::packet::Tag;
@@ -3729,7 +3729,7 @@ mod test {
assert_eq!(rev[0].tag(), Tag::Signature);
let packets_pre_merge = cert.clone().into_packets().count();
- let cert = cert.merge_packets(rev).unwrap();
+ let cert = cert.insert_packets(rev).unwrap();
let packets_post_merge = cert.clone().into_packets().count();
assert_eq!(packets_post_merge, packets_pre_merge + 1);
}
@@ -4029,7 +4029,7 @@ mod test {
assert_eq!(sig.issuer_fingerprints().collect::<Vec<_>>(),
vec![ &cert.fingerprint() ]);
- let cert = cert.merge_packets(sig).unwrap();
+ let cert = cert.insert_packets(sig).unwrap();
assert_match!(RevocationStatus::Revoked(_) = cert.revocation_status(p, None));
@@ -4076,7 +4076,7 @@ mod test {
.unwrap()
};
assert_eq!(sig.typ(), SignatureType::SubkeyRevocation);
- let cert = cert.merge_packets(sig).unwrap();
+ let cert = cert.insert_packets(sig).unwrap();
assert_eq!(RevocationStatus::NotAsFarAsWeKnow,
cert.revocation_status(p, None));
@@ -4107,7 +4107,7 @@ mod test {
.unwrap()
};
assert_eq!(sig.typ(), SignatureType::CertificationRevocation);
- let cert = cert.merge_packets(sig).unwrap();
+ let cert = cert.insert_packets(sig).unwrap();
assert_eq!(RevocationStatus::NotAsFarAsWeKnow,
cert.revocation_status(p, None));
@@ -4201,7 +4201,7 @@ mod test {
assert_eq!(cert.revocation_status(p, t34), RevocationStatus::NotAsFarAsWeKnow);
// Merge in the hard revocation.
- let cert = cert.merge_packets(rev2).unwrap();
+ let cert = cert.insert_packets(rev2).unwrap();
assert_match!(RevocationStatus::Revoked(_) = cert.revocation_status(p, te1));
assert_match!(RevocationStatus::Revoked(_) = cert.revocation_status(p, t12));
assert_match!(RevocationStatus::Revoked(_) = cert.revocation_status(p, t23));
@@ -4820,7 +4820,7 @@ Pu1xwz57O4zo1VYf6TqHJzVC3OMvMUM2hhdecMUe5x6GorNaj6g=
SignatureType::PositiveCertification,
None,
t1).unwrap();
- cert = cert.merge_packets(
+ cert = cert.insert_packets(
vec![Packet::from(uid), sig.into()]).unwrap();
const N: usize = 5;
@@ -4840,7 +4840,7 @@ Pu1xwz57O4zo1VYf6TqHJzVC3OMvMUM2hhdecMUe5x6GorNaj6g=
let binding : Packet = binding.into();
- cert = cert.merge_packets(binding).unwrap();
+ cert = cert.insert_packets(binding).unwrap();
// A time that matches multiple signatures.
let direct_signatures =
cert.primary_key().bundle().self_signatures();
@@ -4904,7 +4904,7 @@ Pu1xwz57O4zo1VYf6TqHJzVC3OMvMUM2hhdecMUe5x6GorNaj6g=
&bob,
sig_template).unwrap();
- let bob = bob.merge_packets(alice_certifies_bob.clone()).unwrap();
+ let bob = bob.insert_packets(alice_certifies_bob.clone()).unwrap();
// Make sure the certification is merged, and put in the right
// place.
@@ -4943,7 +4943,7 @@ Pu1xwz57O4zo1VYf6TqHJzVC3OMvMUM2hhdecMUe5x6GorNaj6g=
let algo = primary.pk_algo();
primary.secret_mut()
.decrypt_in_place(algo, &"streng geheim".into()).unwrap();
- let cert = cert.merge_packets(
+ let cert = cert.insert_packets(
primary.parts_into_secret().unwrap().role_into_primary()).unwrap();
assert_eq!(cert.keys().secret().count(), 2);
@@ -4984,7 +4984,7 @@ Pu1xwz57O4zo1VYf6TqHJzVC3OMvMUM2hhdecMUe5x6GorNaj6g=
// Add a bare userid.
let uid = UserID::from("foo@example.org");
- let cert = cert.merge_packets(uid)?;
+ let cert = cert.insert_packets(uid)?;
assert_eq!(cert.userids().count(), 1);
assert_eq!(cert.userids().with_policy(&p, None).count(), 0);
@@ -4994,7 +4994,7 @@ Pu1xwz57O4zo1VYf6TqHJzVC3OMvMUM2hhdecMUe5x6GorNaj6g=
Subpacket::Image(
Image::Private(100, vec![0, 1, 2].into_boxed_slice())),
])?;
- let cert = cert.merge_packets(ua)?;
+ let cert = cert.insert_packets(ua)?;
assert_eq!(cert.user_attributes().count(), 1);
assert_eq!(cert.user_attributes().with_policy(&p, None).count(), 0);
@@ -5002,7 +5002,7 @@ Pu1xwz57O4zo1VYf6TqHJzVC3OMvMUM2hhdecMUe5x6GorNaj6g=
let signing_subkey: Key<_, key::SubordinateRole> =
key::Key4::generate_ecc(true, Curve::Ed25519)?.into();
let _signing_subkey_pair = signing_subkey.clone().into_keypair()?;
- let cert = cert.merge_packets(signing_subkey)?;
+ let cert = cert.insert_packets(signing_subkey)?;
assert_eq!(cert.keys().subkeys().count(), 1);
assert_eq!(cert.keys().subkeys().with_policy(&p, None).count(), 0);
@@ -5013,7 +5013,7 @@ Pu1xwz57O4zo1VYf6TqHJzVC3OMvMUM2hhdecMUe5x6GorNaj6g=
let fake_binding = signature::SignatureBuilder::new(
SignatureType::Unknown(SignatureType::SubkeyBinding.into()))
.sign_standalone(&mut primary_pair)?;
- let cert = cert.merge_packets(vec![Packet::from(fake_key),
+ let cert = cert.insert_packets(vec![Packet::from(fake_key),
fake_binding.clone().into()])?;
assert_eq!(cert.unknowns().count(), 1);
assert_eq!(cert.unknowns().nth(0).unwrap().unknown().tag(),
@@ -5141,7 +5141,7 @@ Pu1xwz57O4zo1VYf6TqHJzVC3OMvMUM2hhdecMUe5x6GorNaj6g=
let sig = uid.bind(
&mut primary_pair, &cert,
signature::SignatureBuilder::new(SignatureType::PositiveCertification))?;
- let cert = cert.merge_packets(vec![
+ let cert = cert.insert_packets(vec![
Packet::from(uid),
sig.into(),
])?;
diff --git a/openpgp/src/cert/revoke.rs b/openpgp/src/cert/revoke.rs
index 909aa573..a77e8885 100644
--- a/openpgp/src/cert/revoke.rs
+++ b/openpgp/src/cert/revoke.rs
@@ -71,7 +71,7 @@ use crate::cert::prelude::*;
/// .build(&mut signer, &cert, None)?;
///
/// // Merge it into the certificate.
-/// let cert = cert.merge_packets(sig.clone())?;
+/// let cert = cert.insert_packets(sig.clone())?;
///
/// // Now it's revoked.
/// assert_eq!(RevocationStatus::Revoked(vec![&sig]),
@@ -215,7 +215,7 @@ impl CertRevocationBuilder {
/// # assert_eq!(sig.typ(), SignatureType::KeyRevocation);
/// #
/// # // Merge it into the certificate.
- /// # let cert = cert.merge_packets(sig.clone())?;
+ /// # let cert = cert.insert_packets(sig.clone())?;
/// #
/// # // Now it's revoked.
/// # assert_eq!(RevocationStatus::Revoked(vec![&sig]),
@@ -299,7 +299,7 @@ impl Deref for CertRevocationBuilder {
/// .build(&mut signer, &cert, subkey.key(), None)?;
///
/// // Merge it into the certificate.
-/// let cert = cert.merge_packets(sig.clone())?;
+/// let cert = cert.insert_packets(sig.clone())?;
///
/// // Now it's revoked.
/// let subkey = cert.keys().subkeys().nth(0).unwrap();
@@ -442,7 +442,7 @@ impl SubkeyRevocationBuilder {
/// # assert_eq!(sig.typ(), SignatureType::SubkeyRevocation);
/// #
/// # // Merge it into the certificate.
- /// # let cert = cert.merge_packets(sig.clone())?;
+ /// # let cert = cert.insert_packets(sig.clone())?;
/// #
/// # // Now it's revoked.
/// # assert_eq!(RevocationStatus::Revoked(vec![&sig]),
@@ -530,7 +530,7 @@ impl Deref for SubkeyRevocationBuilder {
/// .build(&mut signer, &cert, ua.userid(), None)?;
///
/// // Merge it into the certificate.
-/// let cert = cert.merge_packets(sig.clone())?;
+/// let cert = cert.insert_packets(sig.clone())?;
///
/// // Now it's revoked.
/// let ua = cert.userids().nth(0).unwrap();
@@ -680,7 +680,7 @@ impl UserIDRevocationBuilder {
/// # assert_eq!(sig.typ(), SignatureType::CertificationRevocation);
/// #
/// # // Merge it into the certificate.
- /// # let cert = cert.merge_packets(sig.clone())?;
+ /// # let cert = cert.insert_packets(sig.clone())?;
/// #
/// # // Now it's revoked.
/// # assert_eq!(RevocationStatus::Revoked(vec![&sig]),
@@ -775,7 +775,7 @@ impl Deref for UserIDRevocationBuilder {
/// .build(&mut signer, &cert, ua.user_attribute(), None)?;
///
/// // Merge it into the certificate.
-/// let cert = cert.merge_packets(sig.clone())?;
+/// let cert = cert.insert_packets(sig.clone())?;
///
/// // Now it's revoked.
/// let ua = cert.user_attributes().nth(0).unwrap();
@@ -931,7 +931,7 @@ impl UserAttributeRevocationBuilder {
/// # assert_eq!(sig.typ(), SignatureType::CertificationRevocation);
/// #
/// # // Merge it into the certificate.
- /// # let cert = cert.merge_packets(sig.clone())?;
+ /// # let cert = cert.insert_packets(sig.clone())?;
/// #
/// # // Now it's revoked.
/// # assert_eq!(RevocationStatus::Revoked(vec![&sig]),
diff --git a/openpgp/src/packet/mod.rs b/openpgp/src/packet/mod.rs
index a078e9a4..6b165916 100644
--- a/