diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2020-02-06 14:49:01 +0100 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2020-02-06 15:06:09 +0100 |
commit | d6ed2a3cbb18c50c2da73d5efbdade343e3bad12 (patch) | |
tree | 15cefd9945499ab20065acb30df86d3ccd829cca /openpgp | |
parent | 23110e2844a19ffdd1d5c1699cb868f93f734ccc (diff) |
openpgp: Rename methods 'set_policy' to 'with_policy'.
- Fixes #427.
Diffstat (limited to 'openpgp')
-rw-r--r-- | openpgp/examples/decrypt-with.rs | 2 | ||||
-rw-r--r-- | openpgp/examples/encrypt-for.rs | 2 | ||||
-rw-r--r-- | openpgp/examples/generate-encrypt-decrypt.rs | 4 | ||||
-rw-r--r-- | openpgp/examples/generate-sign-verify.rs | 2 | ||||
-rw-r--r-- | openpgp/examples/notarize.rs | 2 | ||||
-rw-r--r-- | openpgp/examples/pad.rs | 2 | ||||
-rw-r--r-- | openpgp/examples/sign-detached.rs | 2 | ||||
-rw-r--r-- | openpgp/examples/sign.rs | 2 | ||||
-rw-r--r-- | openpgp/src/autocrypt.rs | 2 | ||||
-rw-r--r-- | openpgp/src/cert/amalgamation.rs | 12 | ||||
-rw-r--r-- | openpgp/src/cert/bindings.rs | 4 | ||||
-rw-r--r-- | openpgp/src/cert/builder.rs | 28 | ||||
-rw-r--r-- | openpgp/src/cert/component_iter.rs | 6 | ||||
-rw-r--r-- | openpgp/src/cert/key_amalgamation.rs | 16 | ||||
-rw-r--r-- | openpgp/src/cert/keyiter.rs | 38 | ||||
-rw-r--r-- | openpgp/src/cert/mod.rs | 66 | ||||
-rw-r--r-- | openpgp/src/cert/revoke.rs | 4 | ||||
-rw-r--r-- | openpgp/src/packet/signature/mod.rs | 4 | ||||
-rw-r--r-- | openpgp/src/parse/stream.rs | 6 | ||||
-rw-r--r-- | openpgp/src/policy.rs | 22 | ||||
-rw-r--r-- | openpgp/src/serialize/cert.rs | 12 | ||||
-rw-r--r-- | openpgp/src/serialize/stream.rs | 14 | ||||
-rw-r--r-- | openpgp/src/types/timestamp.rs | 4 |
23 files changed, 128 insertions, 128 deletions
diff --git a/openpgp/examples/decrypt-with.rs b/openpgp/examples/decrypt-with.rs index b52c143c..fdcb3f7e 100644 --- a/openpgp/examples/decrypt-with.rs +++ b/openpgp/examples/decrypt-with.rs @@ -62,7 +62,7 @@ impl Helper { // Map (sub)KeyIDs to secrets. let mut keys = HashMap::new(); for cert in certs { - for ka in cert.keys().set_policy(p, None) + for ka in cert.keys().with_policy(p, None) .for_storage_encryption().for_transport_encryption() { // This only works for unencrypted secret keys. diff --git a/openpgp/examples/encrypt-for.rs b/openpgp/examples/encrypt-for.rs index b64165b7..557e648f 100644 --- a/openpgp/examples/encrypt-for.rs +++ b/openpgp/examples/encrypt-for.rs @@ -42,7 +42,7 @@ fn main() { certs.iter() .flat_map(|cert| { cert.keys() - .set_policy(p, None).alive().revoked(false).key_flags(&mode) + .with_policy(p, None).alive().revoked(false).key_flags(&mode) }) .map(|ka| ka.key().into()) .collect::<Vec<_>>(); diff --git a/openpgp/examples/generate-encrypt-decrypt.rs b/openpgp/examples/generate-encrypt-decrypt.rs index 089ed8e7..9f3b8d6a 100644 --- a/openpgp/examples/generate-encrypt-decrypt.rs +++ b/openpgp/examples/generate-encrypt-decrypt.rs @@ -48,7 +48,7 @@ fn encrypt(p: &dyn Policy, sink: &mut dyn Write, plaintext: &str, { // Build a vector of recipients to hand to Encryptor. let mut recipients = - recipient.keys().set_policy(p, None).alive().revoked(false) + recipient.keys().with_policy(p, None).alive().revoked(false) .for_transport_encryption() .map(|ka| ka.key().into()) .collect::<Vec<_>>(); @@ -124,7 +124,7 @@ impl<'a> DecryptionHelper for Helper<'a> { -> openpgp::Result<Option<openpgp::Fingerprint>> where D: FnMut(SymmetricAlgorithm, &SessionKey) -> openpgp::Result<()> { - let key = self.secret.keys().set_policy(self.policy, None) + let key = self.secret.keys().with_policy(self.policy, None) .for_transport_encryption().nth(0).unwrap().key().clone(); // The secret key is not encrypted. diff --git a/openpgp/examples/generate-sign-verify.rs b/openpgp/examples/generate-sign-verify.rs index e3142667..12709609 100644 --- a/openpgp/examples/generate-sign-verify.rs +++ b/openpgp/examples/generate-sign-verify.rs @@ -45,7 +45,7 @@ fn sign(p: &dyn Policy, sink: &mut dyn Write, plaintext: &str, tsk: &openpgp::Ce -> openpgp::Result<()> { // Get the keypair to do the signing from the Cert. let keypair = tsk - .keys().set_policy(p, None).alive().revoked(false).for_signing() + .keys().with_policy(p, None).alive().revoked(false).for_signing() .nth(0).unwrap() .key().clone().mark_parts_secret().unwrap().into_keypair()?; diff --git a/openpgp/examples/notarize.rs b/openpgp/examples/notarize.rs index 62042e60..83e34cee 100644 --- a/openpgp/examples/notarize.rs +++ b/openpgp/examples/notarize.rs @@ -31,7 +31,7 @@ fn main() { let mut n = 0; for key in tsk.keys() - .set_policy(p, None).alive().revoked(false).for_signing().secret() + .with_policy(p, None).alive().revoked(false).for_signing().secret() .map(|ka| ka.key()) { keys.push({ diff --git a/openpgp/examples/pad.rs b/openpgp/examples/pad.rs index 68efa655..c1c341c8 100644 --- a/openpgp/examples/pad.rs +++ b/openpgp/examples/pad.rs @@ -43,7 +43,7 @@ fn main() { .iter() .flat_map(|cert| { cert.keys() - .set_policy(p, None).alive().revoked(false).key_flags(&mode) + .with_policy(p, None).alive().revoked(false).key_flags(&mode) }) .map(|ka| Recipient::new(KeyID::wildcard(), ka.key())) .collect::<Vec<_>>(); diff --git a/openpgp/examples/sign-detached.rs b/openpgp/examples/sign-detached.rs index e93cd0e2..da5cd776 100644 --- a/openpgp/examples/sign-detached.rs +++ b/openpgp/examples/sign-detached.rs @@ -27,7 +27,7 @@ fn main() { let mut n = 0; for key in tsk - .keys().set_policy(p, None).alive().revoked(false).for_signing().secret() + .keys().with_policy(p, None).alive().revoked(false).for_signing().secret() .map(|ka| ka.key()) { keys.push({ diff --git a/openpgp/examples/sign.rs b/openpgp/examples/sign.rs index 85565b2e..95afee20 100644 --- a/openpgp/examples/sign.rs +++ b/openpgp/examples/sign.rs @@ -26,7 +26,7 @@ fn main() { let mut n = 0; for key in tsk.keys() - .set_policy(p, None).alive().revoked(false).for_signing().secret() + .with_policy(p, None).alive().revoked(false).for_signing().secret() .map(|ka| ka.key()) { keys.push({ diff --git a/openpgp/src/autocrypt.rs b/openpgp/src/autocrypt.rs index 22dfa40d..6d02c5ce 100644 --- a/openpgp/src/autocrypt.rs +++ b/openpgp/src/autocrypt.rs @@ -130,7 +130,7 @@ impl AutocryptHeader { } // The UserIDs matching ADDR. - for uidb in cert.userids().set_policy(policy, None) { + for uidb in cert.userids().with_policy(policy, None) { // XXX: Fix match once we have the rfc2822-name-addr. if let Ok(Some(a)) = uidb.userid().email() { if &a == addr { diff --git a/openpgp/src/cert/amalgamation.rs b/openpgp/src/cert/amalgamation.rs index 10ee8d5b..3ea1b25c 100644 --- a/openpgp/src/cert/amalgamation.rs +++ b/openpgp/src/cert/amalgamation.rs @@ -50,7 +50,7 @@ impl<'a, C> ComponentAmalgamation<'a, C> { /// time, if any. /// /// Note: this function is not exported. Users of this interface - /// should do: ca.set_policy(policy, time)?.binding_signature(). + /// should do: ca.with_policy(policy, time)?.binding_signature(). fn binding_signature<T>(&self, policy: &dyn Policy, time: T) -> Option<&'a Signature> where T: Into<Option<time::SystemTime>> @@ -65,7 +65,7 @@ impl<'a, C> ComponentAmalgamation<'a, C> { /// /// This transforms the `ComponentAmalgamation` into a /// `ValidComponentAmalgamation`. - pub fn set_policy<T>(self, policy: &'a dyn Policy, time: T) + pub fn with_policy<T>(self, policy: &'a dyn Policy, time: T) -> Result<ValidComponentAmalgamation<'a, C>> where T: Into<Option<time::SystemTime>> { @@ -189,7 +189,7 @@ impl<'a, C> ValidComponentAmalgamation<'a, C> } }) .and_then(|c| ComponentAmalgamation::new(cert, (c.0).0) - .set_policy(policy, t).ok()) + .with_policy(policy, t).ok()) } } @@ -213,7 +213,7 @@ pub trait Amalgamation<'a> { /// Changes the amalgamation's policy. /// /// If `time` is `None`, the current time is used. - fn set_policy<T>(self, policy: &'a dyn Policy, time: T) -> Result<Self> + fn with_policy<T>(self, policy: &'a dyn Policy, time: T) -> Result<Self> where Self: Sized, T: Into<Option<time::SystemTime>>; /// Returns the component's binding signature as of the reference time. @@ -272,11 +272,11 @@ impl<'a, C> Amalgamation<'a> for ValidComponentAmalgamation<'a, C> { /// Changes the amalgamation's policy. /// /// If `time` is `None`, the current time is used. - fn set_policy<T>(self, policy: &'a dyn Policy, time: T) -> Result<Self> + fn with_policy<T>(self, policy: &'a dyn Policy, time: T) -> Result<Self> where T: Into<Option<time::SystemTime>> { let time = time.into().unwrap_or_else(SystemTime::now); - self.a.set_policy(policy, time) + self.a.with_policy(policy, time) } /// Returns the component's binding signature as of the reference time. diff --git a/openpgp/src/cert/bindings.rs b/openpgp/src/cert/bindings.rs index 40a326d8..582ff705 100644 --- a/openpgp/src/cert/bindings.rs +++ b/openpgp/src/cert/bindings.rs @@ -39,7 +39,7 @@ impl<P: key::KeyParts> Key<P, key::SubordinateRole> { /// /// // Let's add an encryption subkey. /// let flags = KeyFlags::default().set_storage_encryption(true); - /// assert_eq!(cert.keys().set_policy(p, None).alive().revoked(false) + /// assert_eq!(cert.keys().with_policy(p, None).alive().revoked(false) /// .key_flags(&flags).count(), /// 0); /// @@ -56,7 +56,7 @@ impl<P: key::KeyParts> Key<P, key::SubordinateRole> { /// binding.into()])?; /// /// // Check that we have an encryption subkey. - /// assert_eq!(cert.keys().set_policy(p, None).alive().revoked(false) + /// assert_eq!(cert.keys().with_policy(p, None).alive().revoked(false) /// .key_flags(flags).count(), /// 1); /// # Ok(()) } diff --git a/openpgp/src/cert/builder.rs b/openpgp/src/cert/builder.rs index c09d90ae..171627f2 100644 --- a/openpgp/src/cert/builder.rs +++ b/openpgp/src/cert/builder.rs @@ -481,7 +481,7 @@ mod tests { .add_certification_subkey() .generate().unwrap(); - let mut userids = cert.userids().set_policy(p, None) + let mut userids = cert.userids().with_policy(p, None) .map(|u| String::from_utf8_lossy(u.userid().value()).into_owned()) .collect::<Vec<String>>(); userids.sort(); @@ -507,7 +507,7 @@ mod tests { assert_eq!(cert.userids().count(), 0); assert_eq!(cert.subkeys().count(), 3); let sig = - cert.primary_key().set_policy(p, None).unwrap().binding_signature(); + cert.primary_key().with_policy(p, None).unwrap().binding_signature(); assert_eq!(sig.typ(), crate::types::SignatureType::DirectKey); assert!(sig.features().unwrap().supports_mdc()); } @@ -581,7 +581,7 @@ mod tests { .primary_key_flags(KeyFlags::default()) .add_transport_encryption_subkey() .generate().unwrap(); - assert!(cert1.primary_key().set_policy(p, None).unwrap().for_certification()); + assert!(cert1.primary_key().with_policy(p, None).unwrap().for_certification()); assert_eq!(cert1.keys().subkeys().count(), 1); } @@ -673,19 +673,19 @@ mod tests { assert!(sig.key_alive(key, now + 590 * s).is_ok()); assert!(! sig.key_alive(key, now + 610 * s).is_ok()); - let ka = cert.keys().set_policy(p, now).alive().revoked(false) + let ka = cert.keys().with_policy(p, now).alive().revoked(false) .for_signing() .nth(0).unwrap(); assert!(ka.alive().is_ok()); - assert!(ka.clone().set_policy(p, now + 290 * s).unwrap().alive().is_ok()); - assert!(! ka.clone().set_policy(p, now + 310 * s).unwrap().alive().is_ok()); + assert!(ka.clone().with_policy(p, now + 290 * s).unwrap().alive().is_ok()); + assert!(! ka.clone().with_policy(p, now + 310 * s).unwrap().alive().is_ok()); - let ka = cert.keys().set_policy(p, now).alive().revoked(false) + let ka = cert.keys().with_policy(p, now).alive().revoked(false) .for_authentication() .nth(0).unwrap(); assert!(ka.alive().is_ok()); - assert!(ka.clone().set_policy(p, now + 590 * s).unwrap().alive().is_ok()); - assert!(! ka.clone().set_policy(p, now + 610 * s).unwrap().alive().is_ok()); + assert!(ka.clone().with_policy(p, now + 590 * s).unwrap().alive().is_ok()); + assert!(! ka.clone().with_policy(p, now + 610 * s).unwrap().alive().is_ok()); } #[test] @@ -701,17 +701,17 @@ mod tests { .generate().unwrap(); assert_eq!(cert.primary_key().creation_time(), UNIX_EPOCH); - assert_eq!(cert.primary_key().set_policy(p, None).unwrap() + assert_eq!(cert.primary_key().with_policy(p, None).unwrap() .binding_signature() .signature_creation_time().unwrap(), UNIX_EPOCH); - assert_eq!(cert.primary_key().set_policy(p, None).unwrap() + assert_eq!(cert.primary_key().with_policy(p, None).unwrap() .direct_key_signature().unwrap() .signature_creation_time().unwrap(), UNIX_EPOCH); assert_eq!(rev.signature_creation_time().unwrap(), UNIX_EPOCH); // (Sub)Keys. - assert_eq!(cert.keys().set_policy(p, None).count(), 2); - for ka in cert.keys().set_policy(p, None) { + assert_eq!(cert.keys().with_policy(p, None).count(), 2); + for ka in cert.keys().with_policy(p, None) { assert_eq!(ka.key().creation_time(), UNIX_EPOCH); assert_eq!(ka.binding_signature() .signature_creation_time().unwrap(), UNIX_EPOCH); @@ -719,7 +719,7 @@ mod tests { // UserIDs. assert_eq!(cert.userids().count(), 1); - for ui in cert.userids().set_policy(p, None) { + for ui in cert.userids().with_policy(p, None) { assert_eq!(ui.binding_signature() .signature_creation_time().unwrap(), UNIX_EPOCH); } diff --git a/openpgp/src/cert/component_iter.rs b/openpgp/src/cert/component_iter.rs index 879c673c..1d7f0cc9 100644 --- a/openpgp/src/cert/component_iter.rs +++ b/openpgp/src/cert/component_iter.rs @@ -60,7 +60,7 @@ impl<'a, C> ComponentIter<'a, C> { /// If `time` is None, then the current time is used. /// /// See `ValidComponentIter` for the definition of a valid component. - pub fn set_policy<T>(self, policy: &'a dyn Policy, time: T) + pub fn with_policy<T>(self, policy: &'a dyn Policy, time: T) -> ValidComponentIter<'a, C> where T: Into<Option<SystemTime>> { @@ -128,7 +128,7 @@ impl<'a, C> Iterator for ValidComponentIter<'a, C> t!("Considering component: {:?}", ca.bundle()); let vca - = if let Ok(vca) = ca.set_policy(self.policy, self.time) { + = if let Ok(vca) = ca.with_policy(self.policy, self.time) { vca } else { t!("No self-signature at time {:?}", self.time); @@ -195,7 +195,7 @@ impl<'a, C> ValidComponentIter<'a, C> { /// # let timestamp = None; /// let non_revoked_uas = cert /// .user_attributes() - /// .set_policy(p, timestamp) + /// .with_policy(p, timestamp) /// .filter(|ca| { /// match ca.revoked() { /// RevocationStatus::Revoked(_) => diff --git a/openpgp/src/cert/key_amalgamation.rs b/openpgp/src/cert/key_amalgamation.rs index 1d736c1e..08a13139 100644 --- a/openpgp/src/cert/key_amalgamation.rs +++ b/openpgp/src/cert/key_amalgamation.rs @@ -219,7 +219,7 @@ impl<'a, P: 'a + key::KeyParts> KeyAmalgamation<'a, P> { /// if any. /// /// Note: this function is not exported. Users of this interface - /// should do: ka.set_policy(time)?.binding_signature(). + /// should do: ka.with_policy(time)?.binding_signature(). fn binding_signature<T>(&self, policy: &'a dyn Policy, time: T) -> Option<&'a Signature> where T: Into<Option<time::SystemTime>> @@ -249,7 +249,7 @@ impl<'a, P: 'a + key::KeyParts> KeyAmalgamation<'a, P> { /// /// This transforms the `KeyAmalgamation` into a /// `ValidKeyAmalgamation`. - pub fn set_policy<T>(self, policy: &'a dyn Policy, time: T) + pub fn with_policy<T>(self, policy: &'a dyn Policy, time: T) -> Result<ValidKeyAmalgamation<'a, P>> where T: Into<Option<time::SystemTime>> { @@ -330,11 +330,11 @@ impl<'a, P: key::KeyParts> PrimaryKeyAmalgamation<'a, P> { /// /// This transforms the `KeyAmalgamation` into a /// `ValidKeyAmalgamation`. - pub fn set_policy<T>(self, policy: &'a dyn Policy, time: T) + pub fn with_policy<T>(self, policy: &'a dyn Policy, time: T) -> Result<ValidPrimaryKeyAmalgamation<'a, P>> where T: Into<Option<time::SystemTime>> { - Ok(ValidPrimaryKeyAmalgamation::new(self.a.set_policy(policy, time)?)) + Ok(ValidPrimaryKeyAmalgamation::new(self.a.with_policy(policy, time)?)) } } @@ -443,11 +443,11 @@ impl<'a, P: 'a + key::KeyParts> Amalgamation<'a> for ValidKeyAmalgamation<'a, P> /// Changes the amalgamation's policy. /// /// If `time` is `None`, the current time is used. - fn set_policy<T>(self, policy: &'a dyn Policy, time: T) -> Result<Self> + fn with_policy<T>(self, policy: &'a dyn Policy, time: T) -> Result<Self> where T: Into<Option<time::SystemTime>> { let time = time.into().unwrap_or_else(SystemTime::now); - self.a.set_policy(policy, time) + self.a.with_policy(policy, time) } /// Returns the key's binding signature as of the reference time, @@ -712,9 +712,9 @@ impl<'a, P: key::KeyParts> ValidPrimaryKeyAmalgamation<'a, P> { /// Changes the amalgamation's policy. /// /// If `time` is `None`, the current time is used. - pub fn set_policy<T>(self, policy: &'a dyn Policy, time: T) -> Result<Self> + pub fn with_policy<T>(self, policy: &'a dyn Policy, time: T) -> Result<Self> where T: Into<Option<time::SystemTime>> { - Ok(Self::new(self.a.set_policy(policy, time)?)) + Ok(Self::new(self.a.with_policy(policy, time)?)) } } diff --git a/openpgp/src/cert/keyiter.rs b/openpgp/src/cert/keyiter.rs index e1bd03c6..6aa3ea3b 100644 --- a/openpgp/src/cert/keyiter.rs +++ b/openpgp/src/cert/keyiter.rs @@ -287,7 +287,7 @@ impl<'a, P: 'a + key::KeyParts> KeyIter<'a, P> /// } else if let Err(_) = cert.alive(p, None) { /// // The certificate is not alive, don't use any keys from it. /// } else { - /// for key in cert.keys().set_policy(p, None).alive().revoked(false).for_signing() { + /// for key in cert.keys().with_policy(p, None).alive().revoked(false).for_signing() { /// // We can sign the message with this key. /// } /// } @@ -326,7 +326,7 @@ impl<'a, P: 'a + key::KeyParts> KeyIter<'a, P> /// } else if let Err(_) = cert.alive(p, None) { /// // The certificate is not alive, don't use any keys from it. /// } else { - /// for key in cert.keys().set_policy(p, timestamp).alive().revoked(false).for_signing() { + /// for key in cert.keys().with_policy(p, timestamp).alive().revoked(false).for_signing() { /// // Verify the message with this keys. /// } /// } @@ -372,7 +372,7 @@ impl<'a, P: 'a + key::KeyParts> KeyIter<'a, P> /// # let (cert, _) = /// # CertBuilder::general_purpose(None, Some("alice@example.org")) /// # .generate()?; - /// let decryption_keys = cert.keys().set_policy(p, None) + /// let decryption_keys = cert.keys().with_policy(p, None) /// .for_storage_encryption().for_transport_encryption() /// .collect::<Vec<_>>(); /// # Ok(()) @@ -381,7 +381,7 @@ impl<'a, P: 'a + key::KeyParts> KeyIter<'a, P> /// /// [signature expirations]: https://tools.ietf.org/html/rfc4880#section-5.2.3.10 /// [this discussion]: https://crypto.stackexchange.com/a/12138 . - pub fn set_policy<T>(self, policy: &'a dyn Policy, time: T) + pub fn with_policy<T>(self, policy: &'a dyn Policy, time: T) -> ValidKeyIter<'a, P> where T: Into<Option<SystemTime>> { @@ -569,7 +569,7 @@ impl<'a, P: 'a + key::KeyParts> ValidKeyIter<'a, P> { = if ! self.primary { self.primary = true; let ka = KeyAmalgamation::new_primary(cert); - match ka.set_policy(self.policy, self.time) { + match ka.with_policy(self.policy, self.time) { Ok(ka) => ka, Err(err) => { // The primary key is bad. Abort. @@ -580,7 +580,7 @@ impl<'a, P: 'a + key::KeyParts> ValidKeyIter<'a, P> { } else { let ka = KeyAmalgamation::new_subordinate( cert.into(), self.subkey_iter.next()?); - match ka.set_policy(self.policy, self.time) { + match ka.with_policy(self.policy, self.time) { Ok(ka) => ka, Err(err) => { // The subkey is bad, abort. @@ -780,7 +780,7 @@ impl<'a, P: 'a + key::KeyParts> ValidKeyIter<'a, P> /// # let timestamp = None; /// let non_revoked_keys = cert /// .keys() - /// .set_policy(p, timestamp) + /// .with_policy(p, timestamp) /// .filter(|ka| { /// match ka.revoked() { /// RevocationStatus::Revoked(_) => @@ -1054,7 +1054,7 @@ mod test { .generate().unwrap(); let flags = KeyFlags::default().set_transport_encryption(true); - assert_eq!(cert.keys().set_policy(p, None).key_flags(flags).count(), 0); + assert_eq!(cert.keys().with_policy(p, None).key_flags(flags).count(), 0); } #[test] @@ -1065,7 +1065,7 @@ mod test { .generate().unwrap(); let flags = KeyFlags::default().set_transport_encryption(true); - assert_eq!(cert.keys().set_policy(p, None).key_flags(flags).count(), 1); + assert_eq!(cert.keys().with_policy(p, None).key_flags(flags).count(), 1); } #[test] @@ -1077,7 +1077,7 @@ mod test { .generate().unwrap(); let flags = KeyFlags::default().set_transport_encryption(true); - assert_eq!(cert.keys().set_policy(p, None).key_flags(flags).count(), 1); + assert_eq!(cert.keys().with_policy(p, None).key_flags(flags).count(), 1); } #[test] @@ -1090,7 +1090,7 @@ mod test { let now = SystemTime::now() - std::time::Duration::new(52 * 7 * 24 * 60 * 60, 0); - assert_eq!(cert.keys().set_policy(p, now).key_fl |