diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2020-08-05 11:53:22 +0200 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2020-08-05 13:05:09 +0200 |
commit | 7d4090c4c862e6f38f5a17a9ad77484bf219909d (patch) | |
tree | f70a89f90b06616557b151bea15b63d7e2e81a7d | |
parent | 78e9b6626ba96fa918f53e524720d595a6bb9340 (diff) |
openpgp: Don't implement Default for the Bitflags types.
- See #525.
-rw-r--r-- | autocrypt/src/cert.rs | 4 | ||||
-rw-r--r-- | openpgp-ffi/src/packet/signature.rs | 15 | ||||
-rw-r--r-- | openpgp/examples/encrypt-for.rs | 4 | ||||
-rw-r--r-- | openpgp/examples/pad.rs | 4 | ||||
-rw-r--r-- | openpgp/src/cert/amalgamation/key.rs | 12 | ||||
-rw-r--r-- | openpgp/src/cert/amalgamation/key/iter.rs | 22 | ||||
-rw-r--r-- | openpgp/src/cert/bindings.rs | 8 | ||||
-rw-r--r-- | openpgp/src/cert/builder.rs | 28 | ||||
-rw-r--r-- | openpgp/src/cert/mod.rs | 8 | ||||
-rw-r--r-- | openpgp/src/packet/signature/subpacket.rs | 10 | ||||
-rw-r--r-- | openpgp/src/policy.rs | 10 | ||||
-rw-r--r-- | openpgp/src/serialize/cert.rs | 2 | ||||
-rw-r--r-- | openpgp/src/types/key_flags.rs | 12 | ||||
-rw-r--r-- | openpgp/src/types/server_preferences.rs | 21 | ||||
-rw-r--r-- | openpgp/src/types/timestamp.rs | 4 | ||||
-rw-r--r-- | sqv/tests/revoked-key.rs | 8 | ||||
-rw-r--r-- | tool/src/commands/key.rs | 2 | ||||
-rw-r--r-- | tool/src/sq.rs | 6 |
18 files changed, 87 insertions, 93 deletions
diff --git a/autocrypt/src/cert.rs b/autocrypt/src/cert.rs index d0b1fdc1..7bbe2545 100644 --- a/autocrypt/src/cert.rs +++ b/autocrypt/src/cert.rs @@ -28,11 +28,11 @@ pub fn cert_builder<'a, V, U>(version: V, userid: Option<U>) Autocrypt::V1_1 => CipherSuite::Cv25519, }) .set_primary_key_flags( - KeyFlags::default() + KeyFlags::empty() .set_certification() .set_signing()) .add_subkey( - KeyFlags::default() + KeyFlags::empty() .set_transport_encryption() .set_storage_encryption(), None, diff --git a/openpgp-ffi/src/packet/signature.rs b/openpgp-ffi/src/packet/signature.rs index fdab2d4f..b6ee4061 100644 --- a/openpgp-ffi/src/packet/signature.rs +++ b/openpgp-ffi/src/packet/signature.rs @@ -11,6 +11,7 @@ use libc::time_t; use libc::c_uint; extern crate sequoia_openpgp as openpgp; +use openpgp::types::KeyFlags; use super::Packet; use super::super::fingerprint::Fingerprint; use super::super::keyid::KeyID; @@ -71,14 +72,14 @@ fn pgp_signature_issuer_fingerprint(sig: *const Signature) /// make certifications. #[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" fn pgp_signature_for_certification(sig: *const Signature) -> bool { - sig.ref_raw().key_flags().unwrap_or_default().for_certification() + sig.ref_raw().key_flags().unwrap_or_else(KeyFlags::empty).for_certification() } /// Returns whether the KeyFlags indicates that the key can be used to /// make signatures. #[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" fn pgp_signature_for_signing(sig: *const Signature) -> bool { - sig.ref_raw().key_flags().unwrap_or_default().for_signing() + sig.ref_raw().key_flags().unwrap_or_else(KeyFlags::empty).for_signing() } /// Returns whether the KeyFlags indicates that the key can be used to @@ -86,35 +87,35 @@ fn pgp_signature_for_signing(sig: *const Signature) -> bool { #[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" fn pgp_signature_for_transport_encryption(sig: *const Signature) -> bool { - sig.ref_raw().key_flags().unwrap_or_default().for_transport_encryption() + sig.ref_raw().key_flags().unwrap_or_else(KeyFlags::empty).for_transport_encryption() } /// Returns whether the KeyFlags indicates that the key can be used to /// encrypt data at rest. #[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" fn pgp_signature_for_storage_encryption(sig: *const Signature) -> bool { - sig.ref_raw().key_flags().unwrap_or_default().for_storage_encryption() + sig.ref_raw().key_flags().unwrap_or_else(KeyFlags::empty).for_storage_encryption() } /// Returns whether the KeyFlags indicates that the key can be used /// for authentication. #[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" fn pgp_signature_for_authentication(sig: *const Signature) -> bool { - sig.ref_raw().key_flags().unwrap_or_default().for_authentication() + sig.ref_raw().key_flags().unwrap_or_else(KeyFlags::empty).for_authentication() } /// Returns whether the KeyFlags indicates that the key is a split /// key. #[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" fn pgp_signature_is_split_key(sig: *const Signature) -> bool { - sig.ref_raw().key_flags().unwrap_or_default().is_split_key() + sig.ref_raw().key_flags().unwrap_or_else(KeyFlags::empty).is_split_key() } /// Returns whether the KeyFlags indicates that the key is a group /// key. #[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" fn pgp_signature_is_group_key(sig: *const Signature) -> bool { - sig.ref_raw().key_flags().unwrap_or_default().is_group_key() + sig.ref_raw().key_flags().unwrap_or_else(KeyFlags::empty).is_group_key() } diff --git a/openpgp/examples/encrypt-for.rs b/openpgp/examples/encrypt-for.rs index e1b580ef..80fe52e5 100644 --- a/openpgp/examples/encrypt-for.rs +++ b/openpgp/examples/encrypt-for.rs @@ -24,8 +24,8 @@ fn main() { } let mode = match args[1].as_ref() { - "at-rest" => KeyFlags::default().set_storage_encryption(), - "for-transport" => KeyFlags::default().set_transport_encryption(), + "at-rest" => KeyFlags::empty().set_storage_encryption(), + "for-transport" => KeyFlags::empty().set_transport_encryption(), x => panic!("invalid mode: {:?}, \ must be either 'at-rest' or 'for-transport'", x), diff --git a/openpgp/examples/pad.rs b/openpgp/examples/pad.rs index d0c7a759..5d31d969 100644 --- a/openpgp/examples/pad.rs +++ b/openpgp/examples/pad.rs @@ -24,8 +24,8 @@ fn main() { } let mode = match args[1].as_ref() { - "at-rest" => KeyFlags::default().set_storage_encryption(), - "for-transport" => KeyFlags::default().set_transport_encryption(), + "at-rest" => KeyFlags::empty().set_storage_encryption(), + "for-transport" => KeyFlags::empty().set_transport_encryption(), x => panic!("invalid mode: {:?}, \ must be either 'at-rest' or 'for-transport'", x), diff --git a/openpgp/src/cert/amalgamation/key.rs b/openpgp/src/cert/amalgamation/key.rs index 78f34f5d..beea857d 100644 --- a/openpgp/src/cert/amalgamation/key.rs +++ b/openpgp/src/cert/amalgamation/key.rs @@ -1548,7 +1548,7 @@ impl<'a, P, R, R2> ValidKeyAmalgamation<'a, P, R, R2> pub fn has_any_key_flag<F>(&self, flags: F) -> bool where F: Borrow<KeyFlags> { - let our_flags = self.key_flags().unwrap_or_default(); + let our_flags = self.key_flags().unwrap_or_else(KeyFlags::empty); !(&our_flags & flags.borrow()).is_empty() } @@ -1599,7 +1599,7 @@ impl<'a, P, R, R2> ValidKeyAmalgamation<'a, P, R, R2> /// [Section 12.1 of RFC 4880]: https://tools.ietf.org/html/rfc4880#section-5.2.3.21 /// [`ValidKeyAmalgamation::key_flags`]: #method.key_flags pub fn for_certification(&self) -> bool { - self.has_any_key_flag(KeyFlags::default().set_certification()) + self.has_any_key_flag(KeyFlags::empty().set_certification()) } /// Returns whether the key is signing capable. @@ -1632,7 +1632,7 @@ impl<'a, P, R, R2> ValidKeyAmalgamation<'a, P, R, R2> /// /// [`ValidKeyAmalgamation::key_flags`]: #method.key_flags pub fn for_signing(&self) -> bool { - self.has_any_key_flag(KeyFlags::default().set_signing()) + self.has_any_key_flag(KeyFlags::empty().set_signing()) } /// Returns whether the key is authentication capable. @@ -1666,7 +1666,7 @@ impl<'a, P, R, R2> ValidKeyAmalgamation<'a, P, R, R2> /// [`ValidKeyAmalgamation::key_flags`]: #method.key_flags pub fn for_authentication(&self) -> bool { - self.has_any_key_flag(KeyFlags::default().set_authentication()) + self.has_any_key_flag(KeyFlags::empty().set_authentication()) } /// Returns whether the key is storage-encryption capable. @@ -1713,7 +1713,7 @@ impl<'a, P, R, R2> ValidKeyAmalgamation<'a, P, R, R2> /// [`ValidKeyAmalgamation::key_flags`]: #method.key_flags pub fn for_storage_encryption(&self) -> bool { - self.has_any_key_flag(KeyFlags::default().set_storage_encryption()) + self.has_any_key_flag(KeyFlags::empty().set_storage_encryption()) } /// Returns whether the key is transport-encryption capable. @@ -1760,7 +1760,7 @@ impl<'a, P, R, R2> ValidKeyAmalgamation<'a, P, R, R2> /// [`ValidKeyAmalgamation::key_flags`]: #method.key_flags pub fn for_transport_encryption(&self) -> bool { - self.has_any_key_flag(KeyFlags::default().set_transport_encryption()) + self.has_any_key_flag(KeyFlags::empty().set_transport_encryption()) } /// Returns how long the key is live. diff --git a/openpgp/src/cert/amalgamation/key/iter.rs b/openpgp/src/cert/amalgamation/key/iter.rs index f1d66c0c..d14fdc0b 100644 --- a/openpgp/src/cert/amalgamation/key/iter.rs +++ b/openpgp/src/cert/amalgamation/key/iter.rs @@ -947,7 +947,7 @@ impl<'a, P, R> ValidKeyAmalgamationIter<'a, P, R> /// [Section 12.1 of RFC 4880]: https://tools.ietf.org/html/rfc4880#section-5.2.3.21 /// [`ValidKeyAmalgamation::key_flags`]: struct.ValidKeyAmalgamation.html#method.key_flags pub fn for_certification(self) -> Self { - self.key_flags(KeyFlags::default().set_certification()) + self.key_flags(KeyFlags::empty().set_certification()) } /// Returns signing-capable keys. @@ -990,7 +990,7 @@ impl<'a, P, R> ValidKeyAmalgamationIter<'a, P, R> /// /// [`ValidKeyAmalgamation::for_signing`]: struct.ValidKeyAmalgamation.html#method.for_signing pub fn for_signing(self) -> Self { - self.key_flags(KeyFlags::default().set_signing()) + self.key_flags(KeyFlags::empty().set_signing()) } /// Returns authentication-capable keys. @@ -1033,7 +1033,7 @@ impl<'a, P, R> ValidKeyAmalgamationIter<'a, P, R> /// /// [`ValidKeyAmalgamation::for_authentication`]: struct.ValidKeyAmalgamation.html#method.for_authentication pub fn for_authentication(self) -> Self { - self.key_flags(KeyFlags::default().set_authentication()) + self.key_flags(KeyFlags::empty().set_authentication()) } /// Returns encryption-capable keys for data at rest. @@ -1076,7 +1076,7 @@ impl<'a, P, R> ValidKeyAmalgamationIter<'a, P, R> /// /// [`ValidKeyAmalgamation::for_storage_encryption`]: struct.ValidKeyAmalgamation.html#method.for_storage_encryption pub fn for_storage_encryption(self) -> Self { - self.key_flags(KeyFlags::default().set_storage_encryption()) + self.key_flags(KeyFlags::empty().set_storage_encryption()) } /// Returns encryption-capable keys for data in transit. @@ -1119,7 +1119,7 @@ impl<'a, P, R> ValidKeyAmalgamationIter<'a, P, R> /// /// [`ValidKeyAmalgamation::for_transport_encryption`]: struct.ValidKeyAmalgamation.html#method.for_transport_encryption pub fn for_transport_encryption(self) -> Self { - self.key_flags(KeyFlags::default().set_transport_encryption()) + self.key_flags(KeyFlags::empty().set_transport_encryption()) } /// Returns keys that are alive. @@ -1533,7 +1533,7 @@ mod test { let p = &P::new(); let (cert, _) = CertBuilder::new() .generate().unwrap(); - let flags = KeyFlags::default().set_transport_encryption(); + let flags = KeyFlags::empty().set_transport_encryption(); assert_eq!(cert.keys().with_policy(p, None).key_flags(flags).count(), 0); } @@ -1544,7 +1544,7 @@ mod test { let (cert, _) = CertBuilder::new() .add_transport_encryption_subkey() .generate().unwrap(); - let flags = KeyFlags::default().set_transport_encryption(); + let flags = KeyFlags::empty().set_transport_encryption(); assert_eq!(cert.keys().with_policy(p, None).key_flags(flags).count(), 1); } @@ -1556,7 +1556,7 @@ mod test { .add_transport_encryption_subkey() .add_signing_subkey() .generate().unwrap(); - let flags = KeyFlags::default().set_transport_encryption(); + let flags = KeyFlags::empty().set_transport_encryption(); assert_eq!(cert.keys().with_policy(p, None).key_flags(flags).count(), 1); } @@ -1567,7 +1567,7 @@ mod test { let (cert, _) = CertBuilder::new() .add_transport_encryption_subkey() .generate().unwrap(); - let flags = KeyFlags::default().set_transport_encryption(); + let flags = KeyFlags::empty().set_transport_encryption(); let now = SystemTime::now() - std::time::Duration::new(52 * 7 * 24 * 60 * 60, 0); @@ -1581,7 +1581,7 @@ mod test { let (cert, _) = CertBuilder::new() .add_certification_subkey() .generate().unwrap(); - let flags = KeyFlags::default().set_certification(); + let flags = KeyFlags::empty().set_certification(); assert_eq!(cert.keys().with_policy(p, None).key_flags(flags).count(), 2); @@ -1611,7 +1611,7 @@ mod test { .for_signing().count(), 1); assert_eq!(cert.keys().with_policy(p, None).alive().revoked(false) - .key_flags(KeyFlags::default().set_authentication()) + .key_flags(KeyFlags::empty().set_authentication()) .count(), 1); } diff --git a/openpgp/src/cert/bindings.rs b/openpgp/src/cert/bindings.rs index a5a32976..1884fe72 100644 --- a/openpgp/src/cert/bindings.rs +++ b/openpgp/src/cert/bindings.rs @@ -38,7 +38,7 @@ impl<P: key::KeyParts> Key<P, key::SubordinateRole> { /// .parts_into_secret()?.into_keypair()?; /// /// // Let's add an encryption subkey. - /// let flags = KeyFlags::default().set_storage_encryption(); + /// let flags = KeyFlags::empty().set_storage_encryption(); /// assert_eq!(cert.keys().with_policy(p, None).alive().revoked(false) /// .key_flags(&flags).count(), /// 0); @@ -146,7 +146,7 @@ impl UserID { /// # fn f() -> Result<()> { /// // Generate a Cert, and create a keypair from the primary key. /// let (alice, _) = CertBuilder::new() - /// .set_primary_key_flags(KeyFlags::default().set_certification()) + /// .set_primary_key_flags(KeyFlags::empty().set_certification()) /// .add_userid("alice@example.org") /// .generate()?; /// let mut keypair = alice.primary_key().key().clone() @@ -154,7 +154,7 @@ impl UserID { /// /// // Generate a Cert for Bob. /// let (bob, _) = CertBuilder::new() - /// .set_primary_key_flags(KeyFlags::default().set_certification()) + /// .set_primary_key_flags(KeyFlags::empty().set_certification()) /// .add_userid("bob@example.org") /// .generate()?; /// @@ -294,7 +294,7 @@ impl UserAttribute { /// Image::Private(100, vec![0, 1, 2].into_boxed_slice())), /// ])?; /// let (bob, _) = CertBuilder::new() - /// .set_primary_key_flags(KeyFlags::default().set_certification()) + /// .set_primary_key_flags(KeyFlags::empty().set_certification()) /// .add_user_attribute(user_attr) /// .generate()?; /// diff --git a/openpgp/src/cert/builder.rs b/openpgp/src/cert/builder.rs index 0750143a..1f725732 100644 --- a/openpgp/src/cert/builder.rs +++ b/openpgp/src/cert/builder.rs @@ -211,7 +211,7 @@ impl CertBuilder { creation_time: None, ciphersuite: CipherSuite::default(), primary: KeyBlueprint{ - flags: KeyFlags::default().set_certification(), + flags: KeyFlags::empty().set_certification(), validity: None, ciphersuite: None, }, @@ -254,7 +254,7 @@ impl CertBuilder { creation_time: None, ciphersuite: ciphersuite.into().unwrap_or(Default::default()), primary: KeyBlueprint { - flags: KeyFlags::default() + flags: KeyFlags::empty() .set_certification() .set_signing(), validity: Some(time::Duration::new(3 * 52 * 7 * 24 * 60 * 60, 0)), @@ -262,7 +262,7 @@ impl CertBuilder { }, subkeys: vec![ KeyBlueprint { - flags: KeyFlags::default() + flags: KeyFlags::empty() .set_transport_encryption() .set_storage_encryption(), validity: None, @@ -551,7 +551,7 @@ impl CertBuilder { /// # } /// ``` pub fn add_signing_subkey(self) -> Self { - self.add_subkey(KeyFlags::default().set_signing(), None, None) + self.add_subkey(KeyFlags::empty().set_signing(), None, None) } /// Adds a subkey suitable for transport encryption. @@ -589,7 +589,7 @@ impl CertBuilder { /// # } /// ``` pub fn add_transport_encryption_subkey(self) -> Self { - self.add_subkey(KeyFlags::default().set_transport_encryption(), + self.add_subkey(KeyFlags::empty().set_transport_encryption(), None, None) } @@ -628,7 +628,7 @@ impl CertBuilder { /// # } /// ``` pub fn add_storage_encryption_subkey(self) -> Self { - self.add_subkey(KeyFlags::default().set_storage_encryption(), + self.add_subkey(KeyFlags::empty().set_storage_encryption(), None, None) } @@ -667,7 +667,7 @@ impl CertBuilder { /// # } /// ``` pub fn add_certification_subkey(self) -> Self { - self.add_subkey(KeyFlags::default().set_certification(), None, None) + self.add_subkey(KeyFlags::empty().set_certification(), None, None) } /// Adds an authentication-capable subkey. @@ -705,7 +705,7 @@ impl CertBuilder { /// # } /// ``` pub fn add_authentication_subkey(self) -> Self { - self.add_subkey(KeyFlags::default().set_authentication(), None, None) + self.add_subkey(KeyFlags::empty().set_authentication(), None, None) } /// Adds a custom subkey. @@ -1062,7 +1062,7 @@ impl CertBuilder { { let mut key = self.primary.ciphersuite .unwrap_or(self.ciphersuite) - .generate_key(&KeyFlags::default().set_certification())?; + .generate_key(&KeyFlags::empty().set_certification())?; key.set_creation_time(creation_time)?; let mut sig = signature::SignatureBuilder::new(SignatureType::DirectKey) // GnuPG wants at least a 512-bit hash for P521 keys. @@ -1182,7 +1182,7 @@ mod tests { let p = &P::new(); let (cert1, _) = CertBuilder::new() .set_cipher_suite(CipherSuite::Cv25519) - .set_primary_key_flags(KeyFlags::default()) + .set_primary_key_flags(KeyFlags::empty()) .add_transport_encryption_subkey() .generate().unwrap(); assert!(cert1.primary_key().with_policy(p, None).unwrap().for_certification()); @@ -1193,8 +1193,8 @@ mod tests { fn gen_wired_subkeys() { let (cert1, _) = CertBuilder::new() .set_cipher_suite(CipherSuite::Cv25519) - .set_primary_key_flags(KeyFlags::default()) - .add_subkey(KeyFlags::default().set_certification(), None, None) + .set_primary_key_flags(KeyFlags::empty()) + .add_subkey(KeyFlags::empty().set_certification(), None, None) .generate().unwrap(); let sig_pkts = cert1.subkeys().next().unwrap().bundle().self_signatures[0].hashed_area(); @@ -1265,9 +1265,9 @@ mod tests { let (cert,_) = CertBuilder::new() .set_creation_time(now) .set_validity_period(600 * s) - .add_subkey(KeyFlags::default().set_signing(), + .add_subkey(KeyFlags::empty().set_signing(), 300 * s, None) - .add_subkey(KeyFlags::default().set_authentication(), + .add_subkey(KeyFlags::empty().set_authentication(), None, None) .generate().unwrap(); diff --git a/openpgp/src/cert/mod.rs b/openpgp/src/cert/mod.rs index f932292a..75695e82 100644 --- a/openpgp/src/cert/mod.rs +++ b/openpgp/src/cert/mod.rs @@ -4073,7 +4073,7 @@ mod test { let (bind1, rev1, bind2, rev2) = { let bind1 = signature::SignatureBuilder::new(SignatureType::DirectKey) .set_features(&Features::sequoia()).unwrap() - .set_key_flags(&KeyFlags::default()).unwrap() + .set_key_flags(&KeyFlags::empty()).unwrap() .set_signature_creation_time(t1).unwrap() .set_key_validity_period(Some(time::Duration::new(10 * 52 * 7 * 24 * 60 * 60, 0))).unwrap() .set_preferred_hash_algorithms(vec![HashAlgorithm::SHA512]).unwrap() @@ -4087,7 +4087,7 @@ mod test { let bind2 = signature::SignatureBuilder::new(SignatureType::DirectKey) .set_features(&Features::sequoia()).unwrap() - .set_key_flags(&KeyFlags::default()).unwrap() + .set_key_flags(&KeyFlags::empty()).unwrap() .set_signature_creation_time(t3).unwrap() .set_key_validity_period(Some(time::Duration::new(10 * 52 * 7 * 24 * 60 * 60, 0))).unwrap() .set_preferred_hash_algorithms(vec![HashAlgorithm::SHA512]).unwrap() @@ -4751,7 +4751,7 @@ Pu1xwz57O4zo1VYf6TqHJzVC3OMvMUM2hhdecMUe5x6GorNaj6g= for i in 0..N { let binding = signature::SignatureBuilder::new(SignatureType::DirectKey) .set_features(&Features::sequoia()).unwrap() - .set_key_flags(&KeyFlags::default()).unwrap() + .set_key_flags(&KeyFlags::empty()).unwrap() .set_signature_creation_time(t1).unwrap() // Vary this... .set_key_validity_period(Some( @@ -5017,7 +5017,7 @@ Pu1xwz57O4zo1VYf6TqHJzVC3OMvMUM2hhdecMUe5x6GorNaj6g= key::Key4::generate_ecc(false, Curve::Cv25519)?.into(); let subkey_pub = subkey_sec.clone().take_secret().0; let builder = signature::SignatureBuilder::new(SignatureType::SubkeyBinding) - .set_key_flags(&KeyFlags::default() + .set_key_flags(&KeyFlags::empty() .set_transport_encryption())?; let binding = subkey_sec.bind(&mut primary_pair, &cert, builder)?; diff --git a/openpgp/src/packet/signature/subpacket.rs b/openpgp/src/packet/signature/subpacket.rs index 875a3a73..c776b0f8 100644 --- a/openpgp/src/packet/signature/subpacket.rs +++ b/openpgp/src/packet/signature/subpacket.rs @@ -3018,7 +3018,7 @@ fn accessors() { sig.clone().sign_hash(&mut keypair, hash.clone()).unwrap(); assert_eq!(sig_.preferred_compression_algorithms(), Some(&pref[..])); - let pref = KeyServerPreferences::default() + let pref = KeyServerPreferences::empty() .set_no_modify(); sig = sig.set_key_server_preferences(pref.clone()).unwrap(); let sig_ = @@ -3039,7 +3039,7 @@ fn accessors() { sig.clone().sign_hash(&mut keypair, hash.clone()).unwrap(); assert_eq!(sig_.policy_uri(), Some(&b"foobar"[..])); - let key_flags = KeyFlags::default() + let key_flags = KeyFlags::empty() .set_certification() .set_signing(); sig = sig.set_key_flags(&key_flags).unwrap(); @@ -3322,13 +3322,13 @@ fn subpacket_test_2() { )})); assert_eq!(sig.key_server_preferences().unwrap(), - KeyServerPreferences::default().set_no_modify()); + KeyServerPreferences::empty().set_no_modify()); assert_eq!(sig.subpacket(SubpacketTag::KeyServerPreferences), Some(&Subpacket { length: 2.into(), critical: false, value: SubpacketValue::KeyServerPreferences( - KeyServerPreferences::default().set_no_modify()), + KeyServerPreferences::empty().set_no_modify()), })); assert!(sig.key_flags().unwrap().for_certification()); @@ -3338,7 +3338,7 @@ fn subpacket_test_2() { length: 2.into(), critical: false, value: SubpacketValue::KeyFlags( - KeyFlags::default().set_certification().set_signing()) + KeyFlags::empty().set_certification().set_signing()) })); assert_eq!(sig.features().unwrap(), Features::empty().set_mdc()); diff --git a/openpgp/src/policy.rs b/openpgp/src/policy.rs index 641a756d..43c448ae 100644 --- a/openpgp/src/policy.rs +++ b/openpgp/src/policy.rs @@ -1510,7 +1510,7 @@ mod test { let subkey: key::SecretSubkey = Key4::generate_rsa(4096)?.into(); let binding = signature::SignatureBuilder::new(SignatureType::SubkeyBinding) - .set_key_flags(&KeyFlags::default().set_transport_encryption())? + .set_key_flags(&KeyFlags::empty().set_transport_encryption())? .sign_subkey_binding(&mut pk.clone().into_keypair()?, |