diff options
author | Wiktor Kwapisiewicz <wiktor@metacode.biz> | 2020-04-01 11:21:33 +0200 |
---|---|---|
committer | Wiktor Kwapisiewicz <wiktor@metacode.biz> | 2020-04-03 15:11:08 +0200 |
commit | 9fa0c1972a9f36e3a55da95d4eed44601d4a3f9f (patch) | |
tree | 5cebc2b5ea251e485737eb6f5ec1fbcb076a959a | |
parent | b0dbca2064163a41f73559d787456e8bab7b5cb9 (diff) |
Change function names to align to Rust naming conventions.
- Change `mark_parts_public` to `parts_into_public`,
- Change `mark_parts_public_ref` to `parts_as_public`,
- Change `mark_parts_secret` to `parts_into_secret`,
- Change `mark_parts_secret_ref` to `parts_as_secret`,
- Change `mark_parts_unspecified` to `parts_into_unspecified`,
- Change `mark_parts_unspecified_ref` to `parts_as_unspecified`,
- Fixes #452.
-rw-r--r-- | openpgp-ffi/src/cert.rs | 6 | ||||
-rw-r--r-- | openpgp-ffi/src/key_amalgamation.rs | 4 | ||||
-rw-r--r-- | openpgp-ffi/src/packet/key.rs | 2 | ||||
-rw-r--r-- | openpgp-ffi/src/packet/pkesk.rs | 2 | ||||
-rw-r--r-- | openpgp-ffi/src/parse/stream.rs | 4 | ||||
-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 |
19 files changed, 70 insertions, 70 deletions
diff --git a/openpgp-ffi/src/cert.rs b/openpgp-ffi/src/cert.rs index fdc95ed1..2d57677f 100644 --- a/openpgp-ffi/src/cert.rs +++ b/openpgp-ffi/src/cert.rs @@ -146,7 +146,7 @@ fn pgp_cert_as_tsk(cert: *const Cert) -> *mut TSK<'static> { #[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" fn pgp_cert_primary_key(cert: *const Cert) -> *const Key { let key = cert.ref_raw().primary_key().key() - .mark_parts_unspecified_ref().mark_role_unspecified_ref(); + .parts_as_unspecified().mark_role_unspecified_ref(); key.move_into_raw() } @@ -611,7 +611,7 @@ pub extern "C" fn pgp_cert_key_iter_next<'a>( iter_wrapper.next_called = true; if let Some(ka) = iter_wrapper.iter.as_mut().unwrap().next() { - Some(ka.mark_parts_unspecified()).move_into_raw() + Some(ka.parts_into_unspecified()).move_into_raw() } else { None } @@ -843,7 +843,7 @@ pub extern "C" fn pgp_cert_valid_key_iter_next<'a>( *ptr = rs.move_into_raw(); } - Some(ka.mark_parts_unspecified()).move_into_raw() + Some(ka.parts_into_unspecified()).move_into_raw() } else { None } diff --git a/openpgp-ffi/src/key_amalgamation.rs b/openpgp-ffi/src/key_amalgamation.rs index 374770c2..e2dc31c4 100644 --- a/openpgp-ffi/src/key_amalgamation.rs +++ b/openpgp-ffi/src/key_amalgamation.rs @@ -52,7 +52,7 @@ pub extern "C" fn pgp_key_amalgamation_key<'a>(ka: *const KeyAmalgamation<'a>) { let ka = ka.ref_raw(); - ka.key().mark_parts_unspecified_ref().mark_role_unspecified_ref() + ka.key().parts_as_unspecified().mark_role_unspecified_ref() .move_into_raw() } @@ -73,7 +73,7 @@ pub extern "C" fn pgp_valid_key_amalgamation_key<'a>(ka: *const ValidKeyAmalgama { let ka = ka.ref_raw(); - ka.key().mark_parts_unspecified_ref().mark_role_unspecified_ref() + ka.key().parts_as_unspecified().mark_role_unspecified_ref() .move_into_raw() } diff --git a/openpgp-ffi/src/packet/key.rs b/openpgp-ffi/src/packet/key.rs index e774fd43..6966acc1 100644 --- a/openpgp-ffi/src/packet/key.rs +++ b/openpgp-ffi/src/packet/key.rs @@ -82,6 +82,6 @@ fn pgp_key_into_key_pair(errp: Option<&mut *mut crate::error::Error>, -> *mut self::openpgp::crypto::KeyPair { ffi_make_fry_from_errp!(errp); - let key = ffi_try!(key.move_from_raw().mark_parts_secret()); + let key = ffi_try!(key.move_from_raw().parts_into_secret()); ffi_try_box!(key.into_keypair()) } diff --git a/openpgp-ffi/src/packet/pkesk.rs b/openpgp-ffi/src/packet/pkesk.rs index a00c4ff0..94166c11 100644 --- a/openpgp-ffi/src/packet/pkesk.rs +++ b/openpgp-ffi/src/packet/pkesk.rs @@ -43,7 +43,7 @@ pub extern "C" fn pgp_pkesk_decrypt(errp: Option<&mut *mut crate::error::Error>, let algo = ffi_param_ref_mut!(algo); let key_len = ffi_param_ref_mut!(key_len); - match ffi_try_or_status!(secret_key.clone().mark_parts_secret()) + match ffi_try_or_status!(secret_key.clone().parts_into_secret()) .into_keypair() { Ok(mut keypair) => { diff --git a/openpgp-ffi/src/parse/stream.rs b/openpgp-ffi/src/parse/stream.rs index 71e9caba..27f388c3 100644 --- a/openpgp-ffi/src/parse/stream.rs +++ b/openpgp-ffi/src/parse/stream.rs @@ -206,7 +206,7 @@ fn pgp_verification_result_good_checksum<'a>( if let Some(mut p) = key_r { *unsafe { p.as_mut() } = { let key = ka.key() - .mark_parts_unspecified_ref() + .parts_as_unspecified() .mark_role_unspecified_ref(); key.move_into_raw() }; @@ -334,7 +334,7 @@ fn $fn_name<'a>( if let Some(mut p) = key_r { *unsafe { p.as_mut() } = { let key = ka.key() - .mark_parts_unspecified_ref() + .parts_as_unspecified() .mark_role_unspecified_ref(); key.move_into_raw() }; 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 = |