I have successfully installed cryptography library on my machine, so that after installation I see these lines in jre\lib\security\java.security
:
security.provider.11=ru.CryptoPro.JCP.JCP
security.provider.12=ru.CryptoPro.Crypto.CryptoProvider
security.provider.13=ru.CryptoPro.reprov.RevCheck
security.provider.14=ru.CryptoPro.ssl.Provider
security.provider.15=ru.CryptoPro.JCSP.JCSP
These lines appeared in java.security
file automatically. Besides, when I import needed modules, I do not get any error:
import ru.CryptoPro.JCP.*;
import ru.CryptoPro.JCP.KeyStore.*;
import ru.CryptoPro.JCP.params.JCPProtectionParameter;
import ru.CryptoPro.JCSP.JCSP;
It is totally ok. When, however, I add one tiny command to my code:
KeyStore ks = KeyStore.getInstance("REGISTRY", JCSP.PROVIDER_NAME);
I get a long list of errors:
java.security.NoSuchProviderException: no such provider: JCSP at
sun.security.jca.GetInstance.getService(Unknown Source) at
sun.security.jca.GetInstance.getInstance(Unknown Source) at
java.security.Security.getImpl(Unknown Source) at
java.security.KeyStore.getInstance(Unknown Source) at
com.test.examples.Test.doGet(Test.java:40) at
javax.servlet.http.HttpServlet.service(HttpServlet.java:622) at
javax.servlet.http.HttpServlet.service(HttpServlet.java:729) at
... list goes on
What are possible reasons of these error messages?
I had the similar issue with different security provider (ERACOM
) and solved it with explicit provider registration:
Security.addProvider(new ERACOMProvider());
Try to register your provider in the same way, just create and instance and register it with java.security.Security#addProvider
method. I hope, it will help you.