File tree Expand file tree Collapse file tree 6 files changed +16
-12
lines changed
prov/src/main/java/org/bouncycastle/jcajce/provider/asymmetric Expand file tree Collapse file tree 6 files changed +16
-12
lines changed Original file line number Diff line number Diff line change @@ -134,14 +134,14 @@ public void configure(ConfigurableProvider provider)
134134 {
135135 NISTObjectIdentifiers .id_slh_dsa_sha2_128s ,
136136 NISTObjectIdentifiers .id_slh_dsa_sha2_128f ,
137- NISTObjectIdentifiers .id_slh_dsa_shake_128s ,
138- NISTObjectIdentifiers .id_slh_dsa_shake_128f ,
139137 NISTObjectIdentifiers .id_slh_dsa_sha2_192s ,
140138 NISTObjectIdentifiers .id_slh_dsa_sha2_192f ,
141- NISTObjectIdentifiers .id_slh_dsa_shake_192s ,
142- NISTObjectIdentifiers .id_slh_dsa_shake_192f ,
143139 NISTObjectIdentifiers .id_slh_dsa_sha2_256s ,
144140 NISTObjectIdentifiers .id_slh_dsa_sha2_256f ,
141+ NISTObjectIdentifiers .id_slh_dsa_shake_128s ,
142+ NISTObjectIdentifiers .id_slh_dsa_shake_128f ,
143+ NISTObjectIdentifiers .id_slh_dsa_shake_192s ,
144+ NISTObjectIdentifiers .id_slh_dsa_shake_192f ,
145145 NISTObjectIdentifiers .id_slh_dsa_shake_256s ,
146146 NISTObjectIdentifiers .id_slh_dsa_shake_256f
147147 };
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ public BCMLDSAPrivateKey(
3131 MLDSAPrivateKeyParameters params )
3232 {
3333 this .params = params ;
34- this .algorithm = MLDSAParameterSpec .fromName (params .getParameters ().getName ()).getName (). toUpperCase ( );
34+ this .algorithm = Strings . toUpperCase ( MLDSAParameterSpec .fromName (params .getParameters ().getName ()).getName ());
3535 }
3636
3737 public BCMLDSAPrivateKey (PrivateKeyInfo keyInfo )
Original file line number Diff line number Diff line change @@ -22,11 +22,13 @@ public class BCMLDSAPublicKey
2222 private static final long serialVersionUID = 1L ;
2323
2424 private transient MLDSAPublicKeyParameters params ;
25+ private transient String algorithm ;
2526
2627 public BCMLDSAPublicKey (
2728 MLDSAPublicKeyParameters params )
2829 {
2930 this .params = params ;
31+ this .algorithm = Strings .toUpperCase (MLDSAParameterSpec .fromName (params .getParameters ().getName ()).getName ());
3032 }
3133
3234 public BCMLDSAPublicKey (SubjectPublicKeyInfo keyInfo )
@@ -39,6 +41,7 @@ private void init(SubjectPublicKeyInfo keyInfo)
3941 throws IOException
4042 {
4143 this .params = (MLDSAPublicKeyParameters )PublicKeyFactory .createKey (keyInfo );
44+ this .algorithm = Strings .toUpperCase (MLDSAParameterSpec .fromName (params .getParameters ().getName ()).getName ());
4245 }
4346
4447 /**
@@ -74,7 +77,7 @@ public int hashCode()
7477 */
7578 public final String getAlgorithm ()
7679 {
77- return MLDSAParameterSpec . fromName ( params . getParameters (). getName ()). getName () ;
80+ return algorithm ;
7881 }
7982
8083 public byte [] getPublicData ()
Original file line number Diff line number Diff line change 1313import org .bouncycastle .jcajce .spec .MLDSAParameterSpec ;
1414import org .bouncycastle .pqc .crypto .mldsa .MLDSAParameters ;
1515import org .bouncycastle .pqc .crypto .mldsa .MLDSASigner ;
16+ import org .bouncycastle .util .Strings ;
1617
1718public class SignatureSpi
1819 extends java .security .Signature
@@ -48,7 +49,7 @@ protected void engineInitVerify(PublicKey publicKey)
4849 if (parameters != null )
4950 {
5051 String canonicalAlg = MLDSAParameterSpec .fromName (parameters .getName ()).getName ();
51- if (!canonicalAlg .equals (key .getAlgorithm ()))
52+ if (!canonicalAlg .equals (Strings . toLowerCase ( key .getAlgorithm () )))
5253 {
5354 throw new InvalidKeyException ("signature configured for " + canonicalAlg );
5455 }
@@ -81,7 +82,7 @@ protected void engineInitSign(PrivateKey privateKey)
8182 if (parameters != null )
8283 {
8384 String canonicalAlg = MLDSAParameterSpec .fromName (parameters .getName ()).getName ();
84- if (!canonicalAlg .equals (key .getAlgorithm ()))
85+ if (!canonicalAlg .equals (Strings . toLowerCase ( key .getAlgorithm () )))
8586 {
8687 throw new InvalidKeyException ("signature configured for " + canonicalAlg );
8788 }
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ public BCMLKEMPrivateKey(
3030 MLKEMPrivateKeyParameters params )
3131 {
3232 this .params = params ;
33- this .algorithm = params .getParameters ().getName ();
33+ this .algorithm = Strings . toUpperCase ( params .getParameters ().getName () );
3434 }
3535
3636 public BCMLKEMPrivateKey (PrivateKeyInfo keyInfo )
@@ -44,7 +44,7 @@ private void init(PrivateKeyInfo keyInfo)
4444 {
4545 this .attributes = keyInfo .getAttributes ();;
4646 this .params = (MLKEMPrivateKeyParameters )PrivateKeyFactory .createKey (keyInfo );
47- this .algorithm = MLKEMParameterSpec .fromName (params .getParameters ().getName ()).getName (). toUpperCase ( );
47+ this .algorithm = Strings . toUpperCase ( MLKEMParameterSpec .fromName (params .getParameters ().getName ()).getName ());
4848 }
4949
5050 /**
Original file line number Diff line number Diff line change @@ -40,13 +40,13 @@ private void init(SubjectPublicKeyInfo keyInfo)
4040 throws IOException
4141 {
4242 this .params = (MLKEMPublicKeyParameters )PublicKeyFactory .createKey (keyInfo );
43- this .algorithm = MLKEMParameterSpec .fromName (params .getParameters ().getName ()).getName (). toUpperCase ( );
43+ this .algorithm = Strings . toUpperCase ( MLKEMParameterSpec .fromName (params .getParameters ().getName ()).getName ());
4444 }
4545
4646 private void init (MLKEMPublicKeyParameters params )
4747 {
4848 this .params = params ;
49- this .algorithm = MLKEMParameterSpec .fromName (params .getParameters ().getName ()).getName (). toUpperCase ( );
49+ this .algorithm = Strings . toUpperCase ( MLKEMParameterSpec .fromName (params .getParameters ().getName ()).getName ());
5050 }
5151 /**
5252 * Compare this ML-KEM public key with another object.
You can’t perform that action at this time.
0 commit comments