diff options
Diffstat (limited to 'openpgp')
-rw-r--r-- | openpgp/src/cert/amalgamation/key.rs | 10 | ||||
-rw-r--r-- | openpgp/src/cert/bindings.rs | 10 | ||||
-rw-r--r-- | openpgp/src/cert/mod.rs | 20 | ||||
-rw-r--r-- | openpgp/src/cert/parser/low_level/grammar.lalrpop | 2 | ||||
-rw-r--r-- | openpgp/src/cert/revoke.rs | 8 | ||||
-rw-r--r-- | openpgp/src/crypto/asymmetric.rs | 2 | ||||
-rw-r--r-- | openpgp/src/packet/key.rs | 28 | ||||
-rw-r--r-- | openpgp/src/packet/pkesk.rs | 12 | ||||
-rw-r--r-- | openpgp/src/packet/signature/mod.rs | 2 | ||||
-rw-r--r-- | openpgp/src/parse/stream.rs | 2 | ||||
-rw-r--r-- | openpgp/src/policy.rs | 10 | ||||
-rw-r--r-- | openpgp/src/serialize.rs | 2 | ||||
-rw-r--r-- | openpgp/src/serialize/cert.rs | 2 | ||||
-rw-r--r-- | openpgp/src/serialize/stream.rs | 12 |
14 files changed, 61 insertions, 61 deletions
diff --git a/openpgp/src/cert/amalgamation/key.rs b/openpgp/src/cert/amalgamation/key.rs index dc215688..fc0210ed 100644 --- a/openpgp/src/cert/amalgamation/key.rs +++ b/openpgp/src/cert/amalgamation/key.rs @@ -199,7 +199,7 @@ impl<'a, P> ValidateAmalgamation<'a, Key<P, key::UnspecifiedRole>> let vka = ValidErasedKeyAmalgamation { ka: KeyAmalgamation { ca: key::PublicParts::convert_key_amalgamation( - self.ca.mark_parts_unspecified()).expect("to public"), + self.ca.parts_into_unspecified()).expect("to public"), primary: self.primary, }, // We need some black magic to avoid infinite @@ -227,7 +227,7 @@ impl<'a, P> ValidateAmalgamation<'a, Key<P, key::UnspecifiedRole>> Ok(ValidErasedKeyAmalgamation { ka: KeyAmalgamation { ca: P::convert_key_amalgamation( - vka.ka.ca.mark_parts_unspecified()).expect("roundtrip"), + vka.ka.ca.parts_into_unspecified()).expect("roundtrip"), primary: vka.ka.primary, }, cert: vka.cert, @@ -334,7 +334,7 @@ impl<'a, P, P2> TryFrom<ErasedKeyAmalgamation<'a, P>> if ka.primary { Ok(Self { ca: P2::convert_key_amalgamation( - ka.ca.mark_role_primary().mark_parts_unspecified())?, + ka.ca.mark_role_primary().parts_into_unspecified())?, primary: (), }) } else { @@ -360,7 +360,7 @@ impl<'a, P, P2> TryFrom<ErasedKeyAmalgamation<'a, P>> } else { Ok(Self { ca: P2::convert_key_amalgamation( - ka.ca.mark_role_subordinate().mark_parts_unspecified())?, + ka.ca.mark_role_subordinate().parts_into_unspecified())?, primary: (), }) } @@ -923,7 +923,7 @@ mod test { } let mut primary = cert.primary_key().key().clone() - .mark_parts_secret().unwrap().into_keypair().unwrap(); + .parts_into_secret().unwrap().into_keypair().unwrap(); // Only expire the subkeys. let sigs = cert.keys().subkeys().with_policy(p, None) diff --git a/openpgp/src/cert/bindings.rs b/openpgp/src/cert/bindings.rs index a11a578a..8004188f 100644 --- a/openpgp/src/cert/bindings.rs +++ b/openpgp/src/cert/bindings.rs @@ -35,7 +35,7 @@ impl<P: key::KeyParts> Key<P, key::SubordinateRole> { /// // Generate a Cert, and create a keypair from the primary key. /// let (cert, _) = CertBuilder::new().generate()?; /// let mut keypair = cert.primary_key().key().clone() - /// .mark_parts_secret()?.into_keypair()?; + /// .parts_into_secret()?.into_keypair()?; /// /// // Let's add an encryption subkey. /// let flags = KeyFlags::default().set_storage_encryption(true); @@ -97,7 +97,7 @@ impl UserID { /// // Generate a Cert, and create a keypair from the primary key. /// let (cert, _) = CertBuilder::new().generate()?; /// let mut keypair = cert.primary_key().key().clone() - /// .mark_parts_secret()?.into_keypair()?; + /// .parts_into_secret()?.into_keypair()?; /// assert_eq!(cert.userids().len(), 0); /// /// // Generate a userid and a binding signature. @@ -155,7 +155,7 @@ impl UserID { /// .add_userid("alice@example.org") /// .generate()?; /// let mut keypair = alice.primary_key().key().clone() - /// .mark_parts_secret()?.into_keypair()?; + /// .parts_into_secret()?.into_keypair()?; /// /// // Generate a Cert for Bob. /// let (bob, _) = CertBuilder::new() @@ -232,7 +232,7 @@ impl UserAttribute { /// let (cert, _) = CertBuilder::new() /// .generate()?; /// let mut keypair = cert.primary_key().key().clone() - /// .mark_parts_secret()?.into_keypair()?; + /// .parts_into_secret()?.into_keypair()?; /// assert_eq!(cert.userids().len(), 0); /// /// // Generate a user attribute and a binding signature. @@ -293,7 +293,7 @@ impl UserAttribute { /// .add_userid("alice@example.org") /// .generate()?; /// let mut keypair = alice.primary_key().key().clone() - /// .mark_parts_secret()?.into_keypair()?; + /// .parts_into_secret()?.into_keypair()?; /// /// // Generate a Cert for Bob. /// let user_attr = UserAttribute::new(&[ diff --git a/openpgp/src/cert/mod.rs b/openpgp/src/cert/mod.rs index c845a3a7..36f05061 100644 --- a/openpgp/src/cert/mod.rs +++ b/openpgp/src/cert/mod.rs @@ -545,7 +545,7 @@ impl Cert { /// cert.revoked(p, None)); /// /// let mut keypair = cert.primary_key().key().clone() - /// .mark_parts_secret()?.into_keypair()?; + /// .parts_into_secret()?.into_keypair()?; /// let cert = cert.revoke_in_place(&mut keypair, /// ReasonForRevocation::KeyCompromised, /// b"It was the maid :/")?; @@ -2130,7 +2130,7 @@ mod test { .key_validity_period() .expect("Keys expire by default."); - let mut keypair = cert.primary_key().key().clone().mark_parts_secret() + let mut keypair = cert.primary_key().key().clone().parts_into_secret() .unwrap().into_keypair().unwrap(); // Clear the expiration. @@ -2309,7 +2309,7 @@ mod test { assert_eq!(RevocationStatus::NotAsFarAsWeKnow, cert.revoked(p, None)); - let mut keypair = cert.primary_key().key().clone().mark_parts_secret() + let mut keypair = cert.primary_key().key().clone().parts_into_secret() .unwrap().into_keypair().unwrap(); let sig = CertRevocationBuilder::new() @@ -2331,7 +2331,7 @@ mod test { let (other, _) = CertBuilder::general_purpose(None, Some("Test 2")) .generate().unwrap(); - let mut keypair = other.primary_key().key().clone().mark_parts_secret() + let mut keypair = other.primary_key().key().clone().parts_into_secret() .unwrap().into_keypair().unwrap(); let sig = CertRevocationBuilder::new() @@ -2359,7 +2359,7 @@ mod test { assert_eq!(RevocationStatus::NotAsFarAsWeKnow, subkey.revoked(p, None)); - let mut keypair = cert.primary_key().key().clone().mark_parts_secret() + let mut keypair = cert.primary_key().key().clone().parts_into_secret() .unwrap().into_keypair().unwrap(); SubkeyRevocationBuilder::new() .set_reason_for_revocation( @@ -2390,7 +2390,7 @@ mod test { let uid = cert.userids().with_policy(p, None).nth(1).unwrap(); assert_eq!(RevocationStatus::NotAsFarAsWeKnow, uid.revoked()); - let mut keypair = cert.primary_key().key().clone().mark_parts_secret() + let mut keypair = cert.primary_key().key().clone().parts_into_secret() .unwrap().into_keypair().unwrap(); UserIDRevocationBuilder::new() .set_reason_for_revocation( @@ -3177,7 +3177,7 @@ Pu1xwz57O4zo1VYf6TqHJzVC3OMvMUM2hhdecMUe5x6GorNaj6g= // Have alice cerify the binding "bob@bar.com" and bob's key. let alice_certifies_bob = bob_userid_binding.userid().bind( - &mut alice.primary_key().key().clone().mark_parts_secret() + &mut alice.primary_key().key().clone().parts_into_secret() .unwrap().into_keypair().unwrap(), &bob, sig_template).unwrap(); @@ -3219,12 +3219,12 @@ Pu1xwz57O4zo1VYf6TqHJzVC3OMvMUM2hhdecMUe5x6GorNaj6g= assert_eq!(cert.keys().unencrypted_secret().count(), 0); let mut primary = cert.primary_key().key().clone() - .mark_parts_secret().unwrap(); + .parts_into_secret().unwrap(); let algo = primary.pk_algo(); primary.secret_mut() .decrypt_in_place(algo, &"streng geheim".into()).unwrap(); let cert = cert.merge_packets(vec![ - primary.mark_parts_secret().unwrap().mark_role_primary().into() + primary.parts_into_secret().unwrap().mark_role_primary().into() ]).unwrap(); assert_eq!(cert.keys().secret().count(), 2); @@ -3417,7 +3417,7 @@ Pu1xwz57O4zo1VYf6TqHJzVC3OMvMUM2hhdecMUe5x6GorNaj6g= assert_eq!(cert_at.keys().count(), 2); let mut primary_pair = cert.primary_key().key().clone() - .mark_parts_secret()?.into_keypair()?; + .parts_into_secret()?.into_keypair()?; let uid: UserID = "foo@example.org".into(); let sig = uid.bind( &mut primary_pair, &cert, diff --git a/openpgp/src/cert/parser/low_level/grammar.lalrpop b/openpgp/src/cert/parser/low_level/grammar.lalrpop index be22f92f..7280ddf5 100644 --- a/openpgp/src/cert/parser/low_level/grammar.lalrpop +++ b/openpgp/src/cert/parser/low_level/grammar.lalrpop @@ -234,7 +234,7 @@ Subkey: Option<Key<key::PublicParts, key::SubordinateRole>> = { }, <t:SECRET_SUBKEY> => { match t.into() { - Some(Packet::SecretSubkey(key)) => Some(key.mark_parts_public()), + Some(Packet::SecretSubkey(key)) => Some(key.parts_into_public()), // Just validating a message... None => None, Some(pkt) => diff --git a/openpgp/src/cert/revoke.rs b/openpgp/src/cert/revoke.rs index 341bdf5e..7970bc6d 100644 --- a/openpgp/src/cert/revoke.rs +++ b/openpgp/src/cert/revoke.rs @@ -57,7 +57,7 @@ use crate::cert::prelude::*; /// cert.revoked(p, None)); /// /// let mut signer = cert.primary_key().key().clone() -/// .mark_parts_secret()?.into_keypair()?; +/// .parts_into_secret()?.into_keypair()?; /// let sig = CertRevocationBuilder::new() /// .set_reason_for_revocation(ReasonForRevocation::KeyCompromised, /// b"It was the maid :/")? @@ -168,7 +168,7 @@ impl Deref for CertRevocationBuilder { /// .add_transport_encryption_subkey() /// .generate()?; /// let mut keypair = cert.primary_key().key().clone() -/// .mark_parts_secret()?.into_keypair()?; +/// .parts_into_secret()?.into_keypair()?; /// let subkey = cert.keys().subkeys().nth(0).unwrap(); /// /// // Generate the revocation for the first and only Subkey. @@ -286,7 +286,7 @@ impl Deref for SubkeyRevocationBuilder { /// .add_userid("some@example.org") /// .generate()?; /// let mut keypair = cert.primary_key().key().clone() -/// .mark_parts_secret()?.into_keypair()?; +/// .parts_into_secret()?.into_keypair()?; /// let ca = cert.userids().nth(0).unwrap(); /// /// // Generate the revocation for the first and only UserID. @@ -406,7 +406,7 @@ impl Deref for UserIDRevocationBuilder { /// .add_user_attribute(some_user_attribute) /// .generate()?; /// let mut keypair = cert.primary_key().key().clone() -/// .mark_parts_secret()?.into_keypair()?; +/// .parts_into_secret()?.into_keypair()?; /// let ca = cert.user_attributes().nth(0).unwrap(); /// /// // Generate the revocation for the first and only UserAttribute. diff --git a/openpgp/src/crypto/asymmetric.rs b/openpgp/src/crypto/asymmetric.rs index 46e77f8d..566f39d9 100644 --- a/openpgp/src/crypto/asymmetric.rs +++ b/openpgp/src/crypto/asymmetric.rs @@ -327,7 +327,7 @@ impl<P: key::KeyParts, R: key::KeyRole> Key<P, R> { }, } }, - ECDH => crate::crypto::ecdh::encrypt(self.mark_parts_public_ref(), + ECDH => crate::crypto::ecdh::encrypt(self.parts_as_public(), data), algo => Err(Error::UnsupportedPublicKeyAlgorithm(algo).into()), } diff --git a/openpgp/src/packet/key.rs b/openpgp/src/packet/key.rs index 896607f9..e5ba3883 100644 --- a/openpgp/src/packet/key.rs +++ b/openpgp/src/packet/key.rs @@ -45,7 +45,7 @@ //! let sk: &Key<key::SecretParts, key::PrimaryRole> = cert.primary_key().key().try_into()?; //! //! // Make the conversion explicit. -//! let sk = cert.primary_key().key().mark_parts_secret_ref()?; +//! let sk = cert.primary_key().key().parts_as_secret()?; //! # Ok(()) //! # } //! ``` @@ -489,7 +489,7 @@ macro_rules! create_part_conversions { { type Error = anyhow::Error; fn try_from(p: $Key<$($l, )* $from_parts, $($g, )* >) -> Result<Self> { - p.mark_parts_secret() + p.parts_into_secret() } } @@ -523,7 +523,7 @@ macro_rules! create_part_conversions { impl<$($l, )* P, $($g, )*> $Key<$($l, )* P, $($g, )*> where P: KeyParts, $($w: $c ),* { /// Changes the key's parts tag to `PublicParts`. - pub fn mark_parts_public(self) -> $Key<$($l, )* PublicParts, $($g, )*> { + pub fn parts_into_public(self) -> $Key<$($l, )* PublicParts, $($g, )*> { // Ideally, we'd use self.into() to do the actually // conversion. But, because P is not concrete, we get the // following error: @@ -548,12 +548,12 @@ macro_rules! create_part_conversions { } /// Changes the key's parts tag to `PublicParts`. - pub fn mark_parts_public_ref(&$($l)* self) -> &$($l)* $Key<$($l, )* PublicParts, $($g, )*> { + pub fn parts_as_public(&$($l)* self) -> &$($l)* $Key<$($l, )* PublicParts, $($g, )*> { convert_ref!(self) } /// Changes the key's parts tag to `SecretParts`. - pub fn mark_parts_secret(self) -> Result<$Key<$($l, )* SecretParts, $($g, )*>> { + pub fn parts_into_secret(self) -> Result<$Key<$($l, )* SecretParts, $($g, )*>> { if self.has_secret() { Ok(convert!(self)) } else { @@ -562,7 +562,7 @@ macro_rules! create_part_conversions { } /// Changes the key's parts tag to `SecretParts`. - pub fn mark_parts_secret_ref(&$($l)* self) -> Result<&$($l)* $Key<$($l, )* SecretParts, $($g, )*>> + pub fn parts_as_secret(&$($l)* self) -> Result<&$($l)* $Key<$($l, )* SecretParts, $($g, )*>> { if self.has_secret() { Ok(convert_ref!(self)) @@ -572,12 +572,12 @@ macro_rules! create_part_conversions { } /// Changes the key's parts tag to `UnspecifiedParts`. - pub fn mark_parts_unspecified(self) -> $Key<$($l, )* UnspecifiedParts, $($g, )*> { + pub fn parts_into_unspecified(self) -> $Key<$($l, )* UnspecifiedParts, $($g, )*> { convert!(self) } /// Changes the key's parts tag to `UnspecifiedParts`. - pub fn mark_parts_unspecified_ref(&$($l)* self) -> &$Key<$($l, )* UnspecifiedParts, $($g, )*> { + pub fn parts_as_unspecified(&$($l)* self) -> &$Key<$($l, )* UnspecifiedParts, $($g, )*> { convert_ref!(self) } } @@ -1396,7 +1396,7 @@ macro_rules! impl_common_secret_functions { -> (Key4<PublicParts, R>, Option<SecretKeyMaterial>) { let old = std::mem::replace(&mut self.secret, None); - (self.mark_parts_public(), old) + (self.parts_into_public(), old) } /// Adds `SecretKeyMaterial` to the packet, returning the old if @@ -1405,7 +1405,7 @@ macro_rules! impl_common_secret_functions { -> (Key4<SecretParts, R>, Option<SecretKeyMaterial>) { let old = std::mem::replace(&mut self.secret, Some(secret)); - (self.mark_parts_secret().expect("secret just set"), old) + (self.parts_into_secret().expect("secret just set"), old) } } } @@ -1433,7 +1433,7 @@ impl<R> Key4<SecretParts, R> -> (Key4<PublicParts, R>, SecretKeyMaterial) { let old = std::mem::replace(&mut self.secret, None); - (self.mark_parts_public(), + (self.parts_into_public(), old.expect("Key<SecretParts, _> has a secret key material")) } @@ -1443,7 +1443,7 @@ impl<R> Key4<SecretParts, R> -> (Key4<SecretParts, R>, SecretKeyMaterial) { let old = std::mem::replace(&mut self.secret, Some(secret)); - (self.mark_parts_secret().expect("secret just set"), + (self.parts_into_secret().expect("secret just set"), old.expect("Key<SecretParts, _> has a secret key material")) } } @@ -1921,7 +1921,7 @@ mod tests { let sk = SessionKey::from(Vec::from(&dek[..])); // Expected - let got_enc = ecdh::encrypt_shared(&key.mark_parts_public(), + let got_enc = ecdh::encrypt_shared(&key.parts_into_public(), &sk, eph_pubkey, &shared_sec) .unwrap(); @@ -1959,7 +1959,7 @@ mod tests { // Session key let dek = b"\x09\x0D\xDC\x40\xC5\x71\x51\x88\xAC\xBD\x45\x56\xD4\x2A\xDF\x77\xCD\xF4\x82\xA2\x1B\x8F\x2E\x48\x3B\xCA\xBF\xD3\xE8\x6D\x0A\x7C\xDF\x10\xe6"; - let key = key.mark_parts_public(); + let key = key.parts_into_public(); let got_dek = match key.optional_secret() { Some(SecretKeyMaterial::Unencrypted(ref u)) => u.map(|mpis| { ecdh::decrypt(&key, mpis, &ciphertext) diff --git a/openpgp/src/packet/pkesk.rs b/openpgp/src/packet/pkesk.rs index b08dc8e2..7ab9ccbb 100644 --- a/openpgp/src/packet/pkesk.rs +++ b/openpgp/src/packet/pkesk.rs @@ -215,7 +215,7 @@ mod tests { crate::tests::message("encrypted-to-testy.gpg")).unwrap(); let mut keypair = cert.subkeys().next().unwrap() - .key().clone().mark_parts_secret().unwrap().into_keypair().unwrap(); + .key().clone().parts_into_secret().unwrap().into_keypair().unwrap(); let pkg = pile.descendants().skip(0).next().clone(); @@ -240,7 +240,7 @@ mod tests { crate::tests::message("encrypted-to-testy-new.pgp")).unwrap(); let mut keypair = cert.subkeys().next().unwrap() - .key().clone().mark_parts_secret().unwrap().into_keypair().unwrap(); + .key().clone().parts_into_secret().unwrap().into_keypair().unwrap(); let pkg = pile.descendants().skip(0).next().clone(); @@ -265,7 +265,7 @@ mod tests { crate::tests::message("encrypted-to-testy-nistp256.pgp")).unwrap(); let mut keypair = cert.subkeys().next().unwrap() - .key().clone().mark_parts_secret().unwrap().into_keypair().unwrap(); + .key().clone().parts_into_secret().unwrap().into_keypair().unwrap(); let pkg = pile.descendants().skip(0).next().clone(); @@ -290,7 +290,7 @@ mod tests { crate::tests::message("encrypted-to-testy-nistp384.pgp")).unwrap(); let mut keypair = cert.subkeys().next().unwrap() - .key().clone().mark_parts_secret().unwrap().into_keypair().unwrap(); + .key().clone().parts_into_secret().unwrap().into_keypair().unwrap(); let pkg = pile.descendants().skip(0).next().clone(); @@ -315,7 +315,7 @@ mod tests { crate::tests::message("encrypted-to-testy-nistp521.pgp")).unwrap(); let mut keypair = cert.subkeys().next().unwrap() - .key().clone().mark_parts_secret().unwrap().into_keypair().unwrap(); + .key().clone().parts_into_secret().unwrap().into_keypair().unwrap(); let pkg = pile.descendants().skip(0).next().clone(); @@ -376,7 +376,7 @@ mod tests { let pkesk = PKESK3::for_recipient(SymmetricAlgorithm::AES256, &sess_key, &key).unwrap(); let mut keypair = - key.mark_parts_secret().unwrap().into_keypair().unwrap(); + key.parts_into_secret().unwrap().into_keypair().unwrap(); pkesk.decrypt(&mut keypair, None).unwrap(); } } diff --git a/openpgp/src/packet/signature/mod.rs b/openpgp/src/packet/signature/mod.rs index 754e3b6b..88ff7806 100644 --- a/openpgp/src/packet/signature/mod.rs +++ b/openpgp/src/packet/signature/mod.rs @@ -1434,7 +1434,7 @@ mod test { ] { let cert = Cert::from_bytes(crate::tests::key(key)).unwrap(); let mut pair = cert.primary_key().key().clone() - .mark_parts_secret().unwrap() + .parts_into_secret().unwrap() .into_keypair() .expect("secret key is encrypted/missing"); diff --git a/openpgp/src/parse/stream.rs b/openpgp/src/parse/stream.rs index a7f8e517..1189233a 100644 --- a/openpgp/src/parse/stream.rs +++ b/openpgp/src/parse/stream.rs @@ -1869,7 +1869,7 @@ mod test { { let key = cert.keys().with_policy(p, None).for_signing().nth(0).unwrap().key(); let keypair = - key.clone().mark_parts_secret().unwrap() + key.clone().parts_into_secret().unwrap() .into_keypair().unwrap(); let m = Message::new(&mut buf); diff --git a/openpgp/src/policy.rs b/openpgp/src/policy.rs index b724e5d9..ca0b3f2b 100644 --- a/openpgp/src/policy.rs +++ b/openpgp/src/policy.rs @@ -1076,7 +1076,7 @@ mod test { // Revoke it. let mut keypair = cert.primary_key().key().clone() - .mark_parts_secret()?.into_keypair()?; + .parts_into_secret()?.into_keypair()?; let ca = cert.userids().nth(0).unwrap(); // Generate the revocation for the first and only UserID. @@ -1389,7 +1389,7 @@ mod test { // Create a revoked version. let mut keypair = cert.primary_key().key().clone() - .mark_parts_secret()?.into_keypair()?; + .parts_into_secret()?.into_keypair()?; let cert_revoked = cert.clone().revoke_in_place( &mut keypair, ReasonForRevocation::KeyCompromised, @@ -1530,7 +1530,7 @@ mod test { .add_signing_subkey() .generate()?; - let pk = cert.primary_key().key().mark_parts_secret_ref()?; + let pk = cert.primary_key().key().parts_as_secret()?; let subkey: key::SecretSubkey = Key4::generate_rsa(4096)?.into(); let binding = signature::Builder::new(SignatureType::SubkeyBinding) @@ -1554,7 +1554,7 @@ mod test { .add_signing_subkey() .generate()?; - let pk = cert.primary_key().key().mark_parts_secret_ref()?; + let pk = cert.primary_key().key().parts_as_secret()?; let subkey: key::SecretSubkey = key::Key4::generate_ecc(true, Curve::Ed25519)?.into(); let binding = signature::Builder::new(SignatureType::SubkeyBinding) @@ -1681,7 +1681,7 @@ mod test { // We always use the first subkey. let key = cert.keys().nth(1).unwrap().key(); let mut keypair = key.clone() - .mark_parts_secret().unwrap() + .parts_into_secret().unwrap() .into_keypair().unwrap(); // Create a signature. diff --git a/openpgp/src/serialize.rs b/openpgp/src/serialize.rs index 0e6d4dfd..58d07fa2 100644 --- a/openpgp/src/serialize.rs +++ b/openpgp/src/serialize.rs @@ -3179,7 +3179,7 @@ mod test { use crate::cert::prelude::*; let (cert, _) = CertBuilder::new().generate().unwrap(); - let mut keypair = cert.primary_key().key().clone().mark_parts_secret() + let mut keypair = cert.primary_key().key().clone().parts_into_secret() .unwrap().into_keypair().unwrap(); let uid = UserID::from("foo"); diff --git a/openpgp/src/serialize/cert.rs b/openpgp/src/serialize/cert.rs index 2dd2532f..75ccf018 100644 --- a/openpgp/src/serialize/cert.rs +++ b/openpgp/src/serialize/cert.rs @@ -761,7 +761,7 @@ mod test { let p = &P::new(); let (cert, _) = CertBuilder::new().generate().unwrap(); - let mut keypair = cert.primary_key().key().clone().mark_parts_secret() + let mut keypair = cert.primary_key().key().clone().parts_into_secret() .unwrap().into_keypair().unwrap(); let key: key::SecretSubkey = diff --git a/openpgp/src/serialize/stream.rs b/openpgp/src/serialize/stream.rs index 04d610ff..8f377334 100644 --- a/openpgp/src/serialize/stream.rs +++ b/openpgp/src/serialize/stream.rs @@ -253,7 +253,7 @@ impl<'a> Signer<'a> { /// # .unwrap(); /// # let keypair = tsk.keys().with_policy(p, None).alive().revoked(false).for_signing() /// # .nth(0).unwrap() - /// # .key().clone().mark_parts_secret().unwrap().into_keypair().unwrap(); + /// # .key().clone().parts_into_secret().unwrap().into_keypair().unwrap(); /// # f(tsk, keypair).unwrap(); /// # fn f(cert: Cert, mut signing_keypair: KeyPair) /// # -> Result<()> { @@ -362,7 +362,7 @@ impl<'a> Signer<'a> { /// # let keypair /// # = tsk.keys().with_policy(p, None).alive().revoked(false).for_signing() /// # .nth(0).unwrap() - /// # .key().clone().mark_parts_secret().unwrap().into_keypair() + /// # .key().clone().parts_into_secret().unwrap().into_keypair() /// # .unwrap(); /// # f(tsk, keypair).unwrap(); /// # fn f(cert: Cert, mut signing_keypair: KeyPair) @@ -928,7 +928,7 @@ impl<'a> Recipient<'a> { { Recipient { keyid, - key: key.mark_parts_public_ref().mark_role_unspecified_ref(), + key: key.parts_as_public().mark_role_unspecified_ref(), } } @@ -1523,7 +1523,7 @@ mod test { let mut o = vec![]; { let mut signers = keys.iter().map(|(_, key)| { - key.clone().mark_parts_secret().unwrap().into_keypair() + key.clone().parts_into_secret().unwrap().into_keypair() .expect("expected unencrypted secret key") }).collect::<Vec<KeyPair>>(); @@ -1721,7 +1721,7 @@ mod test { let mut keypair = self.tsk.keys().with_policy(self.policy, None) .for_transport_encryption() .map(|ka| ka.key()).next().unwrap() - .clone().mark_parts_secret().unwrap() |