diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2019-12-03 17:38:49 +0100 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2019-12-04 13:20:26 +0100 |
commit | 807eee2432de52715a2e3c7167d5e859ca3315a8 (patch) | |
tree | ca712d38feec4caa46c0105f1f0f9d45400c7d55 /openpgp/src | |
parent | daee0e230c36cec119d523ca33407789b6fd109f (diff) |
openpgp: Rename KeyIter filters.
- See #359.
Diffstat (limited to 'openpgp/src')
-rw-r--r-- | openpgp/src/cert/builder.rs | 4 | ||||
-rw-r--r-- | openpgp/src/cert/keyiter.rs | 24 | ||||
-rw-r--r-- | openpgp/src/packet/signature/mod.rs | 2 | ||||
-rw-r--r-- | openpgp/src/parse/stream.rs | 2 | ||||
-rw-r--r-- | openpgp/src/serialize/stream.rs | 6 |
5 files changed, 19 insertions, 19 deletions
diff --git a/openpgp/src/cert/builder.rs b/openpgp/src/cert/builder.rs index dcaf4c22..d9f266ad 100644 --- a/openpgp/src/cert/builder.rs +++ b/openpgp/src/cert/builder.rs @@ -649,13 +649,13 @@ mod tests { assert!(sig.key_alive(key, now + 599 * s)); assert!(! sig.key_alive(key, now + 601 * s)); - let (sig, key) = cert.keys_valid().signing_capable() + let (sig, key) = cert.keys_valid().for_signing() .nth(0).map(|(s, _, k)| (s.unwrap(), k)).unwrap(); assert!(sig.key_alive(key, now)); assert!(sig.key_alive(key, now + 299 * s)); assert!(! sig.key_alive(key, now + 301 * s)); - let (sig, key) = cert.keys_valid().authentication_capable() + let (sig, key) = cert.keys_valid().for_authentication() .nth(0).map(|(s, _, k)| (s.unwrap(), k)).unwrap(); assert!(sig.key_alive(key, now)); assert!(sig.key_alive(key, now + 599 * s)); diff --git a/openpgp/src/cert/keyiter.rs b/openpgp/src/cert/keyiter.rs index 170a6d6c..13813388 100644 --- a/openpgp/src/cert/keyiter.rs +++ b/openpgp/src/cert/keyiter.rs @@ -275,10 +275,10 @@ impl<'a, P: 'a + key::KeyParts, R: 'a + key::KeyRole> KeyIter<'a, P, R> /// Returns keys that have the at least one of the flags specified /// in `flags`. /// - /// If you call this function (or one of `certification_capable` - /// or `signing_capable` functions) multiple times, the *union* of + /// If you call this function (or one of `for_certification` + /// or `for_signing` functions) multiple times, the *union* of /// the values is used. Thus, - /// `cert.flags().certification_capable().signing_capable()` will + /// `cert.flags().for_certification().for_signing()` will /// return keys that are certification capable or signing capable. /// /// If you need more complex filtering, e.g., you want a key that @@ -298,35 +298,35 @@ impl<'a, P: 'a + key::KeyParts, R: 'a + key::KeyRole> KeyIter<'a, P, R> /// Returns keys that are certification capable. /// /// See `key_flags` for caveats. - pub fn certification_capable(self) -> Self { + pub fn for_certification(self) -> Self { self.key_flags(KeyFlags::default().set_certify(true)) } /// Returns keys that are signing capable. /// /// See `key_flags` for caveats. - pub fn signing_capable(self) -> Self { + pub fn for_signing(self) -> Self { self.key_flags(KeyFlags::default().set_sign(true)) } /// Returns keys that are authentication capable. /// /// See `key_flags` for caveats. - pub fn authentication_capable(self) -> Self { + pub fn for_authentication(self) -> Self { self.key_flags(KeyFlags::default().set_authenticate(true)) } /// Returns keys that are capable of encrypting data at rest. /// /// See `key_flags` for caveats. - pub fn encrypting_capable_at_rest(self) -> Self { + pub fn for_storage_encryption(self) -> Self { self.key_flags(KeyFlags::default().set_encrypt_at_rest(true)) } /// Returns keys that are capable of encrypting data for transport. /// /// See `key_flags` for caveats. - pub fn encrypting_capable_for_transport(self) -> Self { + pub fn for_transport_encryption(self) -> Self { self.key_flags(KeyFlags::default().set_encrypt_for_transport(true)) } @@ -489,11 +489,11 @@ mod test { .add_encryption_subkey() .add_authentication_subkey() .generate().unwrap(); - assert_eq!(cert.keys_valid().certification_capable().count(), 2); - assert_eq!(cert.keys_valid().encrypting_capable_for_transport().count(), + assert_eq!(cert.keys_valid().for_certification().count(), 2); + assert_eq!(cert.keys_valid().for_transport_encryption().count(), 1); - assert_eq!(cert.keys_valid().encrypting_capable_at_rest().count(), 1); - assert_eq!(cert.keys_valid().signing_capable().count(), 1); + assert_eq!(cert.keys_valid().for_storage_encryption().count(), 1); + assert_eq!(cert.keys_valid().for_signing().count(), 1); assert_eq!(cert.keys_valid().key_flags( KeyFlags::default().set_authenticate(true)).count(), 1); } diff --git a/openpgp/src/packet/signature/mod.rs b/openpgp/src/packet/signature/mod.rs index b05ffe4d..1083d423 100644 --- a/openpgp/src/packet/signature/mod.rs +++ b/openpgp/src/packet/signature/mod.rs @@ -1398,7 +1398,7 @@ mod test { let test1 = Cert::from_bytes( crate::tests::key("test1-certification-key.pgp")).unwrap(); let cert_key1 = test1.keys_all() - .certification_capable() + .for_certification() .nth(0) .map(|x| x.2) .unwrap(); diff --git a/openpgp/src/parse/stream.rs b/openpgp/src/parse/stream.rs index 9b202a5f..4b632601 100644 --- a/openpgp/src/parse/stream.rs +++ b/openpgp/src/parse/stream.rs @@ -2052,7 +2052,7 @@ mod test { // sign 30MiB message let mut buf = vec![]; { - let key = cert.keys_all().signing_capable().nth(0).unwrap().2; + let key = cert.keys_all().for_signing().nth(0).unwrap().2; let keypair = key.clone().mark_parts_secret().unwrap() .into_keypair().unwrap(); diff --git a/openpgp/src/serialize/stream.rs b/openpgp/src/serialize/stream.rs index 3e7e6532..1afdb547 100644 --- a/openpgp/src/serialize/stream.rs +++ b/openpgp/src/serialize/stream.rs @@ -228,7 +228,7 @@ impl<'a> Signer<'a> { /// # let tsk = Cert::from_bytes(&include_bytes!( /// # "../../tests/data/keys/testy-new-private.pgp")[..]) /// # .unwrap(); - /// # let keypair = tsk.keys_valid().signing_capable().nth(0).unwrap().2 + /// # let keypair = tsk.keys_valid().for_signing().nth(0).unwrap().2 /// # .clone().mark_parts_secret().unwrap().into_keypair().unwrap(); /// # f(tsk, keypair).unwrap(); /// # fn f(cert: Cert, mut signing_keypair: KeyPair<key::UnspecifiedRole>) @@ -331,7 +331,7 @@ impl<'a> Signer<'a> { /// # let tsk = Cert::from_bytes(&include_bytes!( /// # "../../tests/data/keys/testy-new-private.pgp")[..]) /// # .unwrap(); - /// # let keypair = tsk.keys_valid().signing_capable().nth(0).unwrap().2 + /// # let keypair = tsk.keys_valid().for_signing().nth(0).unwrap().2 /// # .clone().mark_parts_secret().unwrap().into_keypair().unwrap(); /// # f(tsk, keypair).unwrap(); /// # fn f(cert: Cert, mut signing_keypair: KeyPair<key::UnspecifiedRole>) @@ -1468,7 +1468,7 @@ mod test { Cert::from_bytes(crate::tests::key("testy-private.pgp")).unwrap(), Cert::from_bytes(crate::tests::key("testy-new-private.pgp")).unwrap(), ] { - for key in tsk.keys_all().signing_capable().map(|x| x.2) + for key in tsk.keys_all().for_signing().map(|x| x.2) { keys.insert(key.fingerprint(), key.clone()); } |