diff options
Diffstat (limited to 'openpgp/src/cert')
-rw-r--r-- | openpgp/src/cert/amalgamation/key.rs | 3 | ||||
-rw-r--r-- | openpgp/src/cert/amalgamation/key/iter.rs | 4 | ||||
-rw-r--r-- | openpgp/src/cert/builder.rs | 18 |
3 files changed, 16 insertions, 9 deletions
diff --git a/openpgp/src/cert/amalgamation/key.rs b/openpgp/src/cert/amalgamation/key.rs index f8fbaa01..5962ea4b 100644 --- a/openpgp/src/cert/amalgamation/key.rs +++ b/openpgp/src/cert/amalgamation/key.rs @@ -154,7 +154,8 @@ //! # CertBuilder::general_purpose(None, Some("alice@example.org")) //! # .generate()?; //! # let timestamp = None; -//! # let issuer = cert.fingerprint(); +//! # let issuer = cert.with_policy(p, None)?.keys() +//! # .for_signing().nth(0).unwrap().fingerprint(); //! # let mut i = 0; //! let cert = cert.with_policy(p, timestamp)?; //! if let RevocationStatus::Revoked(_) = cert.revocation_status() { diff --git a/openpgp/src/cert/amalgamation/key/iter.rs b/openpgp/src/cert/amalgamation/key/iter.rs index 0601c2f0..53a72f79 100644 --- a/openpgp/src/cert/amalgamation/key/iter.rs +++ b/openpgp/src/cert/amalgamation/key/iter.rs @@ -434,7 +434,7 @@ impl<'a, P, R> KeyAmalgamationIter<'a, P, R> /// // Use it. /// # i += 1; /// } - /// # assert_eq!(i, 2); + /// # assert_eq!(i, 3); /// # Ok(()) } /// ``` pub fn supported(mut self) -> Self { @@ -1553,7 +1553,7 @@ impl<'a, P, R> ValidKeyAmalgamationIter<'a, P, R> /// // Use it. /// # i += 1; /// } - /// # assert_eq!(i, 2); + /// # assert_eq!(i, 3); /// # Ok(()) } /// ``` pub fn supported(mut self) -> Self { diff --git a/openpgp/src/cert/builder.rs b/openpgp/src/cert/builder.rs index 15d0a350..627bd4f0 100644 --- a/openpgp/src/cert/builder.rs +++ b/openpgp/src/cert/builder.rs @@ -233,9 +233,10 @@ impl CertBuilder<'_> { /// Generates a general-purpose certificate. /// /// The returned builder is set to generate a certificate with a - /// certification- and signature-capable primary key, and an - /// encryption-capable subkey. The subkey is marked as being - /// appropriate for both data in transit and data at rest. + /// certification-capable primary key, a signing-capable subkye, + /// and an encryption-capable subkey. The encryption subkey is + /// marked as being appropriate for both data in transit and data + /// at rest. /// /// # Examples /// @@ -248,7 +249,7 @@ impl CertBuilder<'_> { /// CertBuilder::general_purpose(None, /// Some("Alice Lovelace <alice@example.org>")) /// .generate()?; - /// # assert_eq!(cert.keys().count(), 2); + /// # assert_eq!(cert.keys().count(), 3); /// # assert_eq!(cert.userids().count(), 1); /// # Ok(()) /// # } @@ -262,14 +263,19 @@ impl CertBuilder<'_> { ciphersuite: ciphersuite.into().unwrap_or(Default::default()), primary: KeyBlueprint { flags: KeyFlags::empty() - .set_certification() - .set_signing(), + .set_certification(), validity: Some(time::Duration::new(3 * 52 * 7 * 24 * 60 * 60, 0)), ciphersuite: None, }, subkeys: vec![ KeyBlueprint { flags: KeyFlags::empty() + .set_signing(), + validity: None, + ciphersuite: None, + }, + KeyBlueprint { + flags: KeyFlags::empty() .set_transport_encryption() .set_storage_encryption(), validity: None, |