diff options
-rw-r--r-- | openpgp/src/message/mod.rs | 4 | ||||
-rw-r--r-- | openpgp/src/packet/key.rs | 10 | ||||
-rw-r--r-- | openpgp/src/packet/signature/mod.rs | 2 | ||||
-rw-r--r-- | openpgp/src/packet/signature/subpacket.rs | 2 | ||||
-rw-r--r-- | openpgp/src/tpk/builder.rs | 6 | ||||
-rw-r--r-- | openpgp/src/tpk/mod.rs | 2 |
6 files changed, 13 insertions, 13 deletions
diff --git a/openpgp/src/message/mod.rs b/openpgp/src/message/mod.rs index d1c80f9c..a0ccc812 100644 --- a/openpgp/src/message/mod.rs +++ b/openpgp/src/message/mod.rs @@ -756,7 +756,7 @@ mod tests { lit.set_body(b"data".to_vec()); let hash = ::constants::HashAlgorithm::SHA512; - let key = ::packet::Key::new(PublicKeyAlgorithm::EdDSA).unwrap(); + let key = ::packet::Key::generate(PublicKeyAlgorithm::EdDSA).unwrap(); let sec = if let Some(SecretKey::Unencrypted { ref mpis }) = key.secret() { mpis.clone() @@ -872,7 +872,7 @@ mod tests { lit.set_body(b"data".to_vec()); let hash = ::constants::HashAlgorithm::SHA512; - let key = ::packet::Key::new(PublicKeyAlgorithm::EdDSA).unwrap(); + let key = ::packet::Key::generate(PublicKeyAlgorithm::EdDSA).unwrap(); let sec = if let Some(SecretKey::Unencrypted { ref mpis }) = key.secret() { mpis.clone() diff --git a/openpgp/src/packet/key.rs b/openpgp/src/packet/key.rs index aa24c2c7..2b75e676 100644 --- a/openpgp/src/packet/key.rs +++ b/openpgp/src/packet/key.rs @@ -132,7 +132,7 @@ impl Key { /// Returns a new `Key` packet. This can be used to hold either a /// public key, a public subkey, a private key, or a private subkey. - pub fn new(pk_algo: PublicKeyAlgorithm) -> Result<Self> { + pub fn generate(pk_algo: PublicKeyAlgorithm) -> Result<Self> { use nettle::{ rsa, Yarrow, @@ -482,7 +482,7 @@ mod tests { for &pk_algo in &[PublicKeyAlgorithm::RSAEncryptSign, PublicKeyAlgorithm::EdDSA, PublicKeyAlgorithm::ECDH] { - let key = Key::new(pk_algo).unwrap(); + let key = Key::generate(pk_algo).unwrap(); let clone = key.clone(); assert_eq!(key, clone); } @@ -493,7 +493,7 @@ mod tests { for &pk_algo in &[PublicKeyAlgorithm::RSAEncryptSign, PublicKeyAlgorithm::EdDSA, PublicKeyAlgorithm::ECDH] { - let mut key = Key::new(pk_algo).unwrap(); + let mut key = Key::generate(pk_algo).unwrap(); let mut b = Vec::new(); key.serialize(&mut b, Tag::SecretKey).unwrap(); @@ -535,7 +535,7 @@ mod tests { for &pk_algo in &[PublicKeyAlgorithm::RSAEncryptSign, PublicKeyAlgorithm::ECDH] { - let key = Key::new(pk_algo).unwrap(); + let key = Key::generate(pk_algo).unwrap(); let secret = if let Some(SecretKey::Unencrypted { ref mpis, @@ -562,7 +562,7 @@ mod tests { for &pk_algo in &[PublicKeyAlgorithm::RSAEncryptSign, PublicKeyAlgorithm::EdDSA, PublicKeyAlgorithm::ECDH] { - let key = Key::new(pk_algo).unwrap(); + let key = Key::generate(pk_algo).unwrap(); assert!(! key.secret().unwrap().is_encrypted()); let password = Password::from("foobarbaz"); diff --git a/openpgp/src/packet/signature/mod.rs b/openpgp/src/packet/signature/mod.rs index 940314e2..0b083944 100644 --- a/openpgp/src/packet/signature/mod.rs +++ b/openpgp/src/packet/signature/mod.rs @@ -1003,7 +1003,7 @@ mod test { use constants::PublicKeyAlgorithm; use packet::key::SecretKey; - let key = Key::new(PublicKeyAlgorithm::EdDSA) + let key = Key::generate(PublicKeyAlgorithm::EdDSA) .unwrap(); let msg = b"Hello, World"; diff --git a/openpgp/src/packet/signature/subpacket.rs b/openpgp/src/packet/signature/subpacket.rs index 48059a62..dccb8b60 100644 --- a/openpgp/src/packet/signature/subpacket.rs +++ b/openpgp/src/packet/signature/subpacket.rs @@ -2290,7 +2290,7 @@ fn accessors() { let hash_algo = HashAlgorithm::SHA512; let hash = hash_algo.context().unwrap(); let mut sig = signature::Builder::new(::constants::SignatureType::Binary); - let mut key = ::packet::Key::new(PublicKeyAlgorithm::EdDSA).unwrap(); + let mut key = ::packet::Key::generate(PublicKeyAlgorithm::EdDSA).unwrap(); let sec = if let Some(SecretKey::Unencrypted { ref mpis }) = key.secret() { mpis.clone() } else { diff --git a/openpgp/src/tpk/builder.rs b/openpgp/src/tpk/builder.rs index 47a91210..94960f2d 100644 --- a/openpgp/src/tpk/builder.rs +++ b/openpgp/src/tpk/builder.rs @@ -33,15 +33,15 @@ impl CipherSuite { fn generate_key(self, flags: &KeyFlags) -> Result<Key> { match self { CipherSuite::RSA3k => - Key::new(PublicKeyAlgorithm::RSAEncryptSign), + Key::generate(PublicKeyAlgorithm::RSAEncryptSign), CipherSuite::Cv25519 => { let sign = flags.can_certify() || flags.can_sign(); let encrypt = flags.can_encrypt_for_transport() || flags.can_encrypt_at_rest(); match (sign, encrypt) { - (true, false) => Key::new(PublicKeyAlgorithm::EdDSA), - (false, true) => Key::new(PublicKeyAlgorithm::ECDH), + (true, false) => Key::generate(PublicKeyAlgorithm::EdDSA), + (false, true) => Key::generate(PublicKeyAlgorithm::ECDH), (true, true) => Err(Error::InvalidOperation( "Can't use key for encryption and signing".into()) diff --git a/openpgp/src/tpk/mod.rs b/openpgp/src/tpk/mod.rs index e8c5d4a2..90191b7c 100644 --- a/openpgp/src/tpk/mod.rs +++ b/openpgp/src/tpk/mod.rs @@ -3454,7 +3454,7 @@ mod test { let t1 = time::strptime("2000-1-1", "%F").unwrap(); let t2 = time::strptime("2001-1-1", "%F").unwrap(); let t3 = time::strptime("2002-1-1", "%F").unwrap(); - let key = Key::new(PublicKeyAlgorithm::EdDSA).unwrap(); + let key = Key::generate(PublicKeyAlgorithm::EdDSA).unwrap(); let (bind1, rev, bind2) = { let mpis = match key.secret() { Some(SecretKey::Unencrypted{ ref mpis }) => mpis, |