Kaloyan Manev
Kaloyan Manev

Reputation: 448

Java Security java.security.NoSuchAlgorithmException

I am trying to validate a SHA1 DSA signature with this code:

X509EncodedKeySpec bobPubKeySpec = new X509EncodedKeySpec(bobEncodedPubKey);
KeyFactory keyFactory = KeyFactory.getInstance("DSA");
PublicKey bobPubKey = keyFactory.generatePublic(bobPubKeySpec);
Signature sig = Signature.getInstance("SHAwithDSA");
sig.initVerify(bobPubKey);
sig.update(data);
sig.verify(signature);

Basically load my pub key and compute a signature, then compare with a signature I already have... The thing is that this line throws an java.security.NoSuchAlgorithmException:

KeyFactory keyFactory = KeyFactory.getInstance("DSA");

My Java skills aren't impresive so I may be missing something... I run Java 8 and I have JDK 13 if that might be helpful in any way...

Upvotes: 0

Views: 942

Answers (0)

Related Questions