diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2019-05-07 17:04:22 +0200 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2019-05-07 17:17:16 +0200 |
commit | 83a109af5039cb764aa9b7ffddc14bafd3d42dca (patch) | |
tree | b60d711082632c8c13a4fea8cc3a7aacc09fd30d /openpgp/src/tpk | |
parent | 6911aed99b5a5bd50eecd6864d1106088d4f2de3 (diff) |
openpgp: Remove {Subkey,UserID}Binding::new().
- These functions are quite unflexible, and are therefore quite
opinionated. Nowadays, we have a more flexible way of adding
components to a TPK.
- Fixes #175.
Diffstat (limited to 'openpgp/src/tpk')
-rw-r--r-- | openpgp/src/tpk/mod.rs | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/openpgp/src/tpk/mod.rs b/openpgp/src/tpk/mod.rs index 13ca6d5b..5ddd1a73 100644 --- a/openpgp/src/tpk/mod.rs +++ b/openpgp/src/tpk/mod.rs @@ -520,34 +520,6 @@ pub struct SubkeyBinding { } impl SubkeyBinding { - /// Creates a new subkey binding signature certified by - /// `signer`. The subkey can be used for encrypting transport and - /// expires in three years. - pub fn new(subkey: Key, primary_key: &Key, signer: &mut Signer) - -> Result<Self> { - use packet::KeyFlags; - use constants::HashAlgorithm; - use SignatureType; - - let sig = signature::Builder::new(SignatureType::SubkeyBinding) - .set_key_flags(&KeyFlags::default().set_encrypt_for_transport(true))? - .set_signature_creation_time(time::now().canonicalize())? - .set_key_expiration_time(Some(time::Duration::weeks(3 * 52)))? - .set_issuer_fingerprint(signer.public().fingerprint())? - .set_issuer(signer.public().keyid())? - .sign_subkey_binding(signer, - primary_key, &subkey, - HashAlgorithm::SHA512)?; - - Ok(SubkeyBinding{ - subkey: subkey, - selfsigs: vec![sig.into()], - certifications: vec![], - self_revocations: vec![], - other_revocations: vec![], - }) - } - /// The key. pub fn subkey(&self) -> &Key { &self.subkey @@ -642,31 +614,6 @@ pub struct UserIDBinding { } impl UserIDBinding { - /// Creates a new self-signature binding `uid` to `key`, certified by `signer`. The signature - /// asserts that the bound key can sign and certify and expires in three years. - pub fn new(key: &Key, uid: UserID, signer: &mut Signer) -> Result<Self> { - use packet::KeyFlags; - use constants::HashAlgorithm; - use SignatureType; - - let sig = signature::Builder::new(SignatureType::PositiveCertificate) - .set_key_flags(&KeyFlags::default().set_certify(true).set_sign(true))? - .set_signature_creation_time(time::now().canonicalize())? - .set_key_expiration_time(Some(time::Duration::weeks(3 * 52)))? - .set_issuer_fingerprint(signer.public().fingerprint())? - .set_issuer(signer.public().keyid())? - .set_preferred_hash_algorithms(vec![HashAlgorithm::SHA512])? - .sign_userid_binding(signer, key, &uid, HashAlgorithm::SHA512)?; - - Ok(UserIDBinding{ - userid: uid, - selfsigs: vec![sig.into()], - certifications: vec![], - self_revocations: vec![], - other_revocations: vec![], - }) - } - /// Returns the user id certified by this binding. pub fn userid(&self) -> &UserID { &self.userid |