feat: rsa3072,4096
This commit is contained in:
@@ -56,6 +56,8 @@ impl Command for CommandImpl {
|
|||||||
let rsa_bit_size: Option<usize> = match key_type.as_str() {
|
let rsa_bit_size: Option<usize> = match key_type.as_str() {
|
||||||
"rsa1024" => Some(1024),
|
"rsa1024" => Some(1024),
|
||||||
"rsa2048" => Some(2048),
|
"rsa2048" => Some(2048),
|
||||||
|
"rsa3072" => Some(3072),
|
||||||
|
"rsa4096" => Some(4096),
|
||||||
_ => None,
|
_ => None,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -108,6 +110,8 @@ impl Command for CommandImpl {
|
|||||||
"p521" => Some(KeyAlgorithmId::EccP521),
|
"p521" => Some(KeyAlgorithmId::EccP521),
|
||||||
"rsa1024" => Some(KeyAlgorithmId::Rsa1024),
|
"rsa1024" => Some(KeyAlgorithmId::Rsa1024),
|
||||||
"rsa2048" => Some(KeyAlgorithmId::Rsa2048),
|
"rsa2048" => Some(KeyAlgorithmId::Rsa2048),
|
||||||
|
"rsa3072" => Some(KeyAlgorithmId::Rsa3072),
|
||||||
|
"rsa4096" => Some(KeyAlgorithmId::Rsa4096),
|
||||||
_ => None,
|
_ => None,
|
||||||
};
|
};
|
||||||
if let (true, Some(algorithm_id)) = (with_hmac_encrypt, algorithm_id) {
|
if let (true, Some(algorithm_id)) = (with_hmac_encrypt, algorithm_id) {
|
||||||
|
|||||||
@@ -59,6 +59,8 @@ impl ToString for KeyUri {
|
|||||||
pub enum KeyAlgorithmId {
|
pub enum KeyAlgorithmId {
|
||||||
Rsa1024,
|
Rsa1024,
|
||||||
Rsa2048,
|
Rsa2048,
|
||||||
|
Rsa3072,
|
||||||
|
Rsa4096,
|
||||||
EccP256,
|
EccP256,
|
||||||
EccP384,
|
EccP384,
|
||||||
EccP521,
|
EccP521,
|
||||||
@@ -78,6 +80,8 @@ impl KeyAlgorithmId {
|
|||||||
match self {
|
match self {
|
||||||
KeyAlgorithmId::Rsa1024 => Some(AlgorithmId::Rsa1024),
|
KeyAlgorithmId::Rsa1024 => Some(AlgorithmId::Rsa1024),
|
||||||
KeyAlgorithmId::Rsa2048 => Some(AlgorithmId::Rsa2048),
|
KeyAlgorithmId::Rsa2048 => Some(AlgorithmId::Rsa2048),
|
||||||
|
KeyAlgorithmId::Rsa3072 => None,
|
||||||
|
KeyAlgorithmId::Rsa4096 => None,
|
||||||
KeyAlgorithmId::EccP256 => Some(AlgorithmId::EccP256),
|
KeyAlgorithmId::EccP256 => Some(AlgorithmId::EccP256),
|
||||||
KeyAlgorithmId::EccP384 => Some(AlgorithmId::EccP384),
|
KeyAlgorithmId::EccP384 => Some(AlgorithmId::EccP384),
|
||||||
KeyAlgorithmId::EccP521 => None,
|
KeyAlgorithmId::EccP521 => None,
|
||||||
@@ -86,14 +90,16 @@ impl KeyAlgorithmId {
|
|||||||
|
|
||||||
pub fn is_rsa(&self) -> bool {
|
pub fn is_rsa(&self) -> bool {
|
||||||
match self {
|
match self {
|
||||||
KeyAlgorithmId::Rsa1024 | KeyAlgorithmId::Rsa2048 => true,
|
KeyAlgorithmId::Rsa1024 | KeyAlgorithmId::Rsa2048
|
||||||
|
| KeyAlgorithmId::Rsa3072 | KeyAlgorithmId::Rsa4096 => true,
|
||||||
KeyAlgorithmId::EccP256 | KeyAlgorithmId::EccP384 | KeyAlgorithmId::EccP521 => false,
|
KeyAlgorithmId::EccP256 | KeyAlgorithmId::EccP384 | KeyAlgorithmId::EccP521 => false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_ecc(&self) -> bool {
|
pub fn is_ecc(&self) -> bool {
|
||||||
match self {
|
match self {
|
||||||
KeyAlgorithmId::Rsa1024 | KeyAlgorithmId::Rsa2048 => false,
|
KeyAlgorithmId::Rsa1024 | KeyAlgorithmId::Rsa2048
|
||||||
|
| KeyAlgorithmId::Rsa3072 | KeyAlgorithmId::Rsa4096 => false,
|
||||||
KeyAlgorithmId::EccP256 | KeyAlgorithmId::EccP384 | KeyAlgorithmId::EccP521 => true,
|
KeyAlgorithmId::EccP256 | KeyAlgorithmId::EccP384 | KeyAlgorithmId::EccP521 => true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -107,6 +113,8 @@ impl FromStr for KeyAlgorithmId {
|
|||||||
match s {
|
match s {
|
||||||
"rsa1024" => Some(KeyAlgorithmId::Rsa1024),
|
"rsa1024" => Some(KeyAlgorithmId::Rsa1024),
|
||||||
"rsa2048" => Some(KeyAlgorithmId::Rsa2048),
|
"rsa2048" => Some(KeyAlgorithmId::Rsa2048),
|
||||||
|
"rsa3072" => Some(KeyAlgorithmId::Rsa3072),
|
||||||
|
"rsa4096" => Some(KeyAlgorithmId::Rsa4096),
|
||||||
"p256" => Some(KeyAlgorithmId::EccP256),
|
"p256" => Some(KeyAlgorithmId::EccP256),
|
||||||
"p384" => Some(KeyAlgorithmId::EccP384),
|
"p384" => Some(KeyAlgorithmId::EccP384),
|
||||||
"p521" => Some(KeyAlgorithmId::EccP521),
|
"p521" => Some(KeyAlgorithmId::EccP521),
|
||||||
@@ -120,6 +128,8 @@ impl ToStr for KeyAlgorithmId {
|
|||||||
match self {
|
match self {
|
||||||
KeyAlgorithmId::Rsa1024 => "rsa1024",
|
KeyAlgorithmId::Rsa1024 => "rsa1024",
|
||||||
KeyAlgorithmId::Rsa2048 => "rsa2048",
|
KeyAlgorithmId::Rsa2048 => "rsa2048",
|
||||||
|
KeyAlgorithmId::Rsa3072 => "rsa3072",
|
||||||
|
KeyAlgorithmId::Rsa4096 => "rsa4096",
|
||||||
KeyAlgorithmId::EccP256 => "p256",
|
KeyAlgorithmId::EccP256 => "p256",
|
||||||
KeyAlgorithmId::EccP384 => "p384",
|
KeyAlgorithmId::EccP384 => "p384",
|
||||||
KeyAlgorithmId::EccP521 => "p521",
|
KeyAlgorithmId::EccP521 => "p521",
|
||||||
|
|||||||
Reference in New Issue
Block a user