Skip to content

Commit 5b22856

Browse files
authored
Merge branch 'master' into rsa-sha1
2 parents 2e96c3f + 023b360 commit 5b22856

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ssh-key/src/algorithm.rs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ const CERT_ED25519: &str = "[email protected]";
3737
/// OpenSSH certificate with RSA public key
3838
const CERT_RSA: &str = "[email protected]";
3939

40+
/// OpenSSH certificate with RSA + SHA-256 as described in RFC8332 § 3
41+
const CERT_RSA_SHA2_256: &str = "[email protected]";
42+
43+
/// OpenSSH certificate with RSA + SHA-512 as described in RFC8332 § 3
44+
const CERT_RSA_SHA2_512: &str = "[email protected]";
45+
4046
/// OpenSSH certificate for ECDSA (NIST P-256) U2F/FIDO security key
4147
const CERT_SK_ECDSA_SHA2_P256: &str = "[email protected]";
4248

@@ -176,6 +182,12 @@ impl Algorithm {
176182
}),
177183
CERT_ED25519 => Ok(Algorithm::Ed25519),
178184
CERT_RSA => Ok(Algorithm::Rsa { hash: None }),
185+
CERT_RSA_SHA2_256 => Ok(Algorithm::Rsa {
186+
hash: Some(HashAlg::Sha256),
187+
}),
188+
CERT_RSA_SHA2_512 => Ok(Algorithm::Rsa {
189+
hash: Some(HashAlg::Sha512),
190+
}),
179191
CERT_SK_ECDSA_SHA2_P256 => Ok(Algorithm::SkEcdsaSha2NistP256),
180192
CERT_SK_SSH_ED25519 => Ok(Algorithm::SkEd25519),
181193
#[cfg(feature = "alloc")]
@@ -224,7 +236,13 @@ impl Algorithm {
224236
EcdsaCurve::NistP521 => CERT_ECDSA_SHA2_P521,
225237
},
226238
Algorithm::Ed25519 => CERT_ED25519,
227-
Algorithm::Rsa { .. } => CERT_RSA,
239+
Algorithm::Rsa { hash: None } => CERT_RSA,
240+
Algorithm::Rsa {
241+
hash: Some(HashAlg::Sha256),
242+
} => CERT_RSA_SHA2_256,
243+
Algorithm::Rsa {
244+
hash: Some(HashAlg::Sha512),
245+
} => CERT_RSA_SHA2_512,
228246
Algorithm::SkEcdsaSha2NistP256 => CERT_SK_ECDSA_SHA2_P256,
229247
Algorithm::SkEd25519 => CERT_SK_SSH_ED25519,
230248
Algorithm::Other(algorithm) => return algorithm.certificate_type(),

0 commit comments

Comments
 (0)