@@ -297,6 +297,27 @@ impl AlgorithmIdentifier {
297297 parameters : AlgorithmIdentifierParameters :: None ,
298298 }
299299 }
300+
301+ pub fn new_mldsa_44 ( ) -> Self {
302+ Self {
303+ algorithm : oids:: id_mldsa_44 ( ) . into ( ) ,
304+ parameters : AlgorithmIdentifierParameters :: None ,
305+ }
306+ }
307+
308+ pub fn new_mldsa_65 ( ) -> Self {
309+ Self {
310+ algorithm : oids:: id_mldsa_65 ( ) . into ( ) ,
311+ parameters : AlgorithmIdentifierParameters :: None ,
312+ }
313+ }
314+
315+ pub fn new_mldsa_87 ( ) -> Self {
316+ Self {
317+ algorithm : oids:: id_mldsa_87 ( ) . into ( ) ,
318+ parameters : AlgorithmIdentifierParameters :: None ,
319+ }
320+ }
300321}
301322
302323impl ser:: Serialize for AlgorithmIdentifier {
@@ -379,7 +400,10 @@ impl<'de> de::Deserialize<'de> for AlgorithmIdentifier {
379400 | oids:: ED25519
380401 | oids:: ED448
381402 | oids:: X25519
382- | oids:: X448 => AlgorithmIdentifierParameters :: None ,
403+ | oids:: X448
404+ | oids:: ID_MLDSA_44
405+ | oids:: ID_MLDSA_65
406+ | oids:: ID_MLDSA_87 => AlgorithmIdentifierParameters :: None ,
383407 oids:: DSA_WITH_SHA1 => {
384408 // A note from [RFC 3927](https://www.ietf.org/rfc/rfc3279.txt)
385409 // When the id-dsa-with-sha1 algorithm identifier appears as the
@@ -1324,4 +1348,31 @@ mod tests {
13241348 pretty_assertions:: assert_eq!( decoded, expected) ;
13251349 check_serde ! ( decoded: RawAlgorithmIdentifier in encoded) ;
13261350 }
1351+
1352+ #[ test]
1353+ fn mldsa_44 ( ) {
1354+ let expected = [
1355+ 0x30 , 0x0B , 0x06 , 0x09 , 0x60 , 0x86 , 0x48 , 0x01 , 0x65 , 0x03 , 0x04 , 0x03 , 0x11 ,
1356+ ] ;
1357+ let mldsa = AlgorithmIdentifier :: new_mldsa_44 ( ) ;
1358+ check_serde ! ( mldsa: AlgorithmIdentifier in expected) ;
1359+ }
1360+
1361+ #[ test]
1362+ fn mldsa_65 ( ) {
1363+ let expected = [
1364+ 0x30 , 0x0B , 0x06 , 0x09 , 0x60 , 0x86 , 0x48 , 0x01 , 0x65 , 0x03 , 0x04 , 0x03 , 0x12 ,
1365+ ] ;
1366+ let mldsa = AlgorithmIdentifier :: new_mldsa_65 ( ) ;
1367+ check_serde ! ( mldsa: AlgorithmIdentifier in expected) ;
1368+ }
1369+
1370+ #[ test]
1371+ fn mldsa_87 ( ) {
1372+ let expected = [
1373+ 0x30 , 0x0B , 0x06 , 0x09 , 0x60 , 0x86 , 0x48 , 0x01 , 0x65 , 0x03 , 0x04 , 0x03 , 0x13 ,
1374+ ] ;
1375+ let mldsa = AlgorithmIdentifier :: new_mldsa_87 ( ) ;
1376+ check_serde ! ( mldsa: AlgorithmIdentifier in expected) ;
1377+ }
13271378}
0 commit comments