This
is the exception for invalid or inappropriate algorithm parameters.
Example
import java.security.InvalidAlgorithmParameterException; import java.security.NoSuchAlgorithmException; import javax.crypto.KeyGenerator; import javax.xml.crypto.dsig.spec.HMACParameterSpec; public class KeyGeneratorInitAlgorithm { public static void main(String args[]) throws NoSuchAlgorithmException, InvalidAlgorithmParameterException{ KeyGenerator keyGen = KeyGenerator.getInstance("Blowfish"); HMACParameterSpec hmac = new HMACParameterSpec(128); keyGen.init(hmac); } }
When
you tries to run the above program, below error thrown.
Exception in thread "main" java.security.InvalidAlgorithmParameterException: Blowfish key generation does not take any parameters at com.sun.crypto.provider.BlowfishKeyGenerator.engineInit(BlowfishKeyGenerator.java:77) at javax.crypto.KeyGenerator.init(KeyGenerator.java:439) at javax.crypto.KeyGenerator.init(KeyGenerator.java:415) at KeyGeneratorInitAlgorithm.main(KeyGeneratorInitAlgorithm.java:10) Java Result: 1
No comments:
Post a Comment