@@ -238,36 +238,34 @@ public void testImportHardcoded() throws Exception {
238238 EncodedKeySpec privateKeySpec = new PKCS8EncodedKeySpec (HexFormat .of ().parseHex (private_secp256r1 ));
239239 PrivateKey importPrivateKey = keyFactory .generatePrivate (privateKeySpec );
240240
241- System .out .println ("Algorithm name: " + ((PKCS8Key ) importPrivateKey ).getAlgorithmId ().getName ());
242-
243- assertTrue ("secp256r1" .equals (((PKCS8Key ) importPrivateKey ).getAlgorithmId ().getName ()), "Curve is not what is expected." );
241+ assertTrue (((PKCS8Key ) importPrivateKey ).getAlgorithmId ().toString ().contains ("secp256r1" ), "Curve is not what is expected." );
244242
245243 EncodedKeySpec publicKeySpec = new X509EncodedKeySpec (HexFormat .of ().parseHex (public_secp256r1 ));
246244 PublicKey importPublicKey = keyFactory .generatePublic (publicKeySpec );
247245
248- assertTrue ("secp256r1" . equals ((( X509Key ) importPublicKey ).getAlgorithmId ().getName () ), "Curve is not what is expected." );
246+ assertTrue ((( X509Key ) importPublicKey ).getAlgorithmId ().toString (). contains ( "secp256r1" ), "Curve is not what is expected." );
249247
250248 // secp384r1
251249 privateKeySpec = new PKCS8EncodedKeySpec (HexFormat .of ().parseHex (private_secp384r1 ));
252250 importPrivateKey = keyFactory .generatePrivate (privateKeySpec );
253251
254- assertTrue ("secp384r1" . equals ((( PKCS8Key ) importPrivateKey ).getAlgorithmId ().getName () ), "Curve is not what is expected." );
252+ assertTrue ((( PKCS8Key ) importPrivateKey ).getAlgorithmId ().toString (). contains ( "secp384r1" ), "Curve is not what is expected." );
255253
256254 publicKeySpec = new X509EncodedKeySpec (HexFormat .of ().parseHex (public_secp384r1 ));
257255 importPublicKey = keyFactory .generatePublic (publicKeySpec );
258256
259- assertTrue ("secp384r1" . equals ((( X509Key ) importPublicKey ).getAlgorithmId ().getName () ), "Curve is not what is expected." );
257+ assertTrue ((( X509Key ) importPublicKey ).getAlgorithmId ().toString (). contains ( "secp384r1" ), "Curve is not what is expected." );
260258
261259 // secp521r1
262260 privateKeySpec = new PKCS8EncodedKeySpec (HexFormat .of ().parseHex (private_secp521r1 ));
263261 importPrivateKey = keyFactory .generatePrivate (privateKeySpec );
264262
265- assertTrue ("secp521r1" . equals ((( PKCS8Key ) importPrivateKey ).getAlgorithmId ().getName () ), "Curve is not what is expected." );
263+ assertTrue ((( PKCS8Key ) importPrivateKey ).getAlgorithmId ().toString (). contains ( "secp521r1" ), "Curve is not what is expected." );
266264
267265 publicKeySpec = new X509EncodedKeySpec (HexFormat .of ().parseHex (public_secp521r1 ));
268266 importPublicKey = keyFactory .generatePublic (publicKeySpec );
269267
270- assertTrue ("secp521r1" . equals ((( X509Key ) importPublicKey ).getAlgorithmId ().getName () ), "Curve is not what is expected." );
268+ assertTrue ((( X509Key ) importPublicKey ).getAlgorithmId ().toString (). contains ( "secp521r1" ), "Curve is not what is expected." );
271269 }
272270}
273271
0 commit comments