Two Laptop Bag*
The moose likes Security and the fly likes InvalidAlgorithmParameter Exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Engineering » Security
Bookmark "InvalidAlgorithmParameter Exception" Watch "InvalidAlgorithmParameter Exception" New topic
Author

InvalidAlgorithmParameter Exception

Ben Pagan
Greenhorn

Joined: Mar 21, 2007
Posts: 5
Hi Folks,

I am currently receiving the following error when I attempt to sign an input stream using S/MIME.


com.baltimore.jsmt.smime.JSMTException: Vault.signDigest(); nested exception is:
com.baltimore.jpkiplus.vaults.VaultException: Vault.signDigest(); nested exception is:
java.security.InvalidAlgorithmParameterException: The AlgorithmParameterSpec is not of type NullwithRSASignatureParams or RSASignatureWithPadding.
at com.baltimore.jcrypto.provider.crypto.signatures.JCRYPTO_NullwithRSASignature.engineSetParameter([DashoPro-V1.3-013000])
at java.security.Signature$Delegate.engineSetParameter(Unknown Source)
at java.security.Signature.setParameter(Unknown Source)
at com.baltimore.jpkiplus.vaults.Vault.signDigest([DashoPro-V1.3-013000])
at com.baltimore.jsmt.smime.SMIMEv2.sign(SMIMEv2.java:676)
at com.baltimore.jsmt.smime.SMIMEv2.sign(SMIMEv2.java:367)
at com.gro.applet.GROSignSubmitApplet.sendMessage(GROSignSubmitApplet.java:343)
at com.gro.applet.GROSignSubmitApplet.signAndSubmit(GROSignSubmitApplet.java:131)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.plugin.javascript.invoke.JSInvoke.invoke(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.plugin.javascript.JSClassLoader.invoke(Unknown Source)
at sun.plugin.com.MethodDispatcher.invoke(Unknown Source)
at sun.plugin.com.DispatchImpl.invokeImpl(Unknown Source)
at sun.plugin.com.DispatchImpl$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.plugin.com.DispatchImpl.invoke(Unknown Source)

My applet is part of a .jar file and produces this error every time.
It's really odd as when I build a test applet with identical code and hard code the values in (instead of getting them etc.) it signs the message correctly.
Is it possible that by jarring my applet I am creating this problem?
Any pointers?
Ben Pagan
Greenhorn

Joined: Mar 21, 2007
Posts: 5
I am still stuck on this problem but have found out a few more things.

I jarred up my test applet (that was working) with my other files and called it from a web page. It still works.

So I then called my first applet which is used on a user login page. I logged in successfully and then called my test applet again. It threw the same InvalidAlgorithmParameterException as before.

My question is, is it possible for the application to hold on to some settings/values etc between applets. All my variables that the two applets have in common are re-initialised.
Is it possible that the browser is holding on to a setting?
What is the bleedin story?
Ben Pagan
Greenhorn

Joined: Mar 21, 2007
Posts: 5
In case anyone is interested I fixed this problem. The cause of the problem was that my first applet retrieved all the required algorithms etc by specifying the crypto provider as

Security.addProvider(new JCRYPTO());

My second applet had very similar code to the first and despite adding the crypto provider as above it produced the invalidalgorithmexception.

To fix it I used the following code on my second applet.

String provider = "JCRYPTO";
Security.removeProvider(provider);
Security.addProvider(new JCRYPTO());
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: InvalidAlgorithmParameter Exception