summaryrefslogtreecommitdiffstats
path: root/openpgp
diff options
context:
space:
mode:
authorNeal H. Walfield <neal@pep.foundation>2019-05-15 15:43:36 +0200
committerNeal H. Walfield <neal@pep.foundation>2019-05-15 15:45:30 +0200
commit0e655002843c2754f2e24773d8117499a8b30a54 (patch)
treeaf68b488de46650f292f3a32cceaa0d66458209a /openpgp
parent9853283156cdfaa3bb6556d36a3a0c98a6bca244 (diff)
openpgp: Support generating 2k RSA keys
Diffstat (limited to 'openpgp')
-rw-r--r--openpgp/src/tpk/builder.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/openpgp/src/tpk/builder.rs b/openpgp/src/tpk/builder.rs
index 912ca97d..f824309c 100644
--- a/openpgp/src/tpk/builder.rs
+++ b/openpgp/src/tpk/builder.rs
@@ -31,6 +31,8 @@ pub enum CipherSuite {
P384,
/// EdDSA and ECDH over NIST P-521 with SHA512 and AES256
P521,
+ /// 2048 bit RSA with SHA512 and AES256
+ RSA2k,
}
impl Default for CipherSuite {
@@ -44,6 +46,8 @@ impl CipherSuite {
use constants::Curve;
match self {
+ CipherSuite::RSA2k =>
+ Key4::generate_rsa(2048),
CipherSuite::RSA3k =>
Key4::generate_rsa(3072),
CipherSuite::Cv25519 | CipherSuite::P256 |
@@ -572,7 +576,7 @@ mod tests {
fn all_ciphersuites() {
use self::CipherSuite::*;
- for cs in vec![Cv25519, RSA3k, P256, P384, P521] {
+ for cs in vec![Cv25519, RSA3k, P256, P384, P521, RSA2k] {
assert!(TPKBuilder::new()
.set_cipher_suite(cs)
.generate().is_ok());