@@ -47,6 +47,9 @@ const CERT_SK_ECDSA_SHA2_P256: &str = "sk-ecdsa-sha2-nistp256-cert-v01@openssh.c
4747/// OpenSSH certificate for Ed25519 U2F/FIDO security key
4848const CERT_SK_SSH_ED25519 : & str = "sk-ssh-ed25519-cert-v01@openssh.com" ;
4949
50+ /// OpenSSH certificate for MLDSA44-Ed25519 composite public key
51+ const CERT_MLDSA44_ED25519 : & str = "ssh-mldsa44-ed25519-cert-v01@openssh.com" ;
52+
5053/// ECDSA with SHA-256 + NIST P-256
5154const ECDSA_SHA2_P256 : & str = "ecdsa-sha2-nistp256" ;
5255
@@ -86,6 +89,9 @@ const SK_ECDSA_SHA2_P256: &str = "sk-ecdsa-sha2-nistp256@openssh.com";
8689/// U2F/FIDO security key with Ed25519
8790const SK_SSH_ED25519 : & str = "sk-ssh-ed25519@openssh.com" ;
8891
92+ /// MLDSA44-Ed25519-SHA512 composite signature algorithm
93+ const SSH_MLDSA44_ED25519 : & str = "ssh-mldsa44-ed25519@openssh.com" ;
94+
8995/// SSH key algorithms, i.e. digital signature algorithms used with SSH private/public keys.
9096#[ derive( Clone , Debug , Default , Eq , Hash , PartialEq , PartialOrd , Ord ) ]
9197#[ non_exhaustive]
@@ -121,6 +127,9 @@ pub enum Algorithm {
121127 /// FIDO/U2F key with Ed25519
122128 SkEd25519 ,
123129
130+ /// MLDSA44-Ed25519-SHA512 composite signature algorithm.
131+ MlDsa44Ed25519 ,
132+
124133 /// Other
125134 #[ cfg( feature = "alloc" ) ]
126135 Other ( AlgorithmName ) ,
@@ -138,6 +147,7 @@ impl Algorithm {
138147 /// - `ssh-rsa`
139148 /// - `sk-ecdsa-sha2-nistp256@openssh.com` (FIDO/U2F key)
140149 /// - `sk-ssh-ed25519@openssh.com` (FIDO/U2F key)
150+ /// - `ssh-mldsa44-ed25519@openssh.com`
141151 ///
142152 /// Any other algorithms are mapped to the [`Algorithm::Other`] variant.
143153 ///
@@ -161,6 +171,7 @@ impl Algorithm {
161171 /// - `ssh-ed25519-cert-v01@openssh.com`
162172 /// - `sk-ecdsa-sha2-nistp256-cert-v01@openssh.com` (FIDO/U2F key)
163173 /// - `sk-ssh-ed25519-cert-v01@openssh.com` (FIDO/U2F key)
174+ /// - `ssh-mldsa44-ed25519-cert-v01@openssh.com`
164175 ///
165176 /// Any other algorithms are mapped to the [`Algorithm::Other`] variant.
166177 ///
@@ -190,6 +201,7 @@ impl Algorithm {
190201 } ) ,
191202 CERT_SK_ECDSA_SHA2_P256 => Ok ( Algorithm :: SkEcdsaSha2NistP256 ) ,
192203 CERT_SK_SSH_ED25519 => Ok ( Algorithm :: SkEd25519 ) ,
204+ CERT_MLDSA44_ED25519 => Ok ( Algorithm :: MlDsa44Ed25519 ) ,
193205 #[ cfg( feature = "alloc" ) ]
194206 _ => Ok ( Algorithm :: Other ( AlgorithmName :: from_certificate_type ( id) ?) ) ,
195207 #[ cfg( not( feature = "alloc" ) ) ]
@@ -215,6 +227,7 @@ impl Algorithm {
215227 } ,
216228 Algorithm :: SkEcdsaSha2NistP256 => SK_ECDSA_SHA2_P256 ,
217229 Algorithm :: SkEd25519 => SK_SSH_ED25519 ,
230+ Algorithm :: MlDsa44Ed25519 => SSH_MLDSA44_ED25519 ,
218231 #[ cfg( feature = "alloc" ) ]
219232 Algorithm :: Other ( algorithm) => algorithm. as_str ( ) ,
220233 }
@@ -247,6 +260,7 @@ impl Algorithm {
247260 } => CERT_RSA_SHA2_512 ,
248261 Algorithm :: SkEcdsaSha2NistP256 => CERT_SK_ECDSA_SHA2_P256 ,
249262 Algorithm :: SkEd25519 => CERT_SK_SSH_ED25519 ,
263+ Algorithm :: MlDsa44Ed25519 => CERT_MLDSA44_ED25519 ,
250264 Algorithm :: Other ( algorithm) => return algorithm. certificate_type ( ) ,
251265 }
252266 . to_owned ( )
@@ -276,6 +290,12 @@ impl Algorithm {
276290 matches ! ( self , Algorithm :: Rsa { .. } )
277291 }
278292
293+ /// Is the algorithm the MLDSA44-Ed25519 composite scheme?
294+ #[ must_use]
295+ pub fn is_mldsa44_ed25519 ( self ) -> bool {
296+ matches ! ( self , Algorithm :: MlDsa44Ed25519 )
297+ }
298+
279299 /// Return an error indicating this algorithm is unsupported.
280300 #[ allow( dead_code) ]
281301 pub ( crate ) fn unsupported_error ( self ) -> Error {
@@ -322,6 +342,7 @@ impl str::FromStr for Algorithm {
322342 SSH_RSA => Ok ( Algorithm :: Rsa { hash : None } ) ,
323343 SK_ECDSA_SHA2_P256 => Ok ( Algorithm :: SkEcdsaSha2NistP256 ) ,
324344 SK_SSH_ED25519 => Ok ( Algorithm :: SkEd25519 ) ,
345+ SSH_MLDSA44_ED25519 => Ok ( Algorithm :: MlDsa44Ed25519 ) ,
325346 #[ cfg( feature = "alloc" ) ]
326347 _ => Ok ( Algorithm :: Other ( AlgorithmName :: from_str ( id) ?) ) ,
327348 #[ cfg( not( feature = "alloc" ) ) ]
0 commit comments