I'm making a project, and in the project it's part of our work to remake a cipher algorithm and others and then to use them using the JCA (java criptographic architecture) rules.
I have made a provider that provides multiple classes. All seems to be working well until I try to use getInstance(). I made, among others, a DH (extends KeyAgreementSpi) class for KeyAgreement different usages
KeyAgreement dh = KeyAgreement.getInstance("DH", myProvider);
I get:
Exception in thread "Thread-0" java.lang.SecurityException: JCE cannot authenticate the provider Ts001Proj1Provider
at javax.crypto.JceSecurity.getInstance(JceSecurity.java:114)
at javax.crypto.KeyAgreement.getInstance(KeyAgreement.java:263)
at fcul.ts001.proj1.SecuredStream.(SecuredStream.java:194)
at fcul.ts001.proj1.SecureStreamTest.run(SecureStreamTest.java:24)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.SecurityException: Cannot verify jar:file:/*pathToProject*/proj/Main/bin/!/
at javax.crypto.JarVerifier.verifySingleJar(JarVerifier.java:406)
at javax.crypto.JarVerifier.verifyJars(JarVerifier.java:322)
at javax.crypto.JarVerifier.verify(JarVerifier.java:250)
at javax.crypto.JceSecurity.verifyProviderJar(JceSecurity.java:161)
at javax.crypto.JceSecurity.getVerificationResult(JceSecurity.java:187)
at javax.crypto.JceSecurity.getInstance(JceSecurity.java:110)
... 4 more
Caused by: java.security.PrivilegedActionException: java.io.FileNotFoundException: *pathToProject*\proj\Main\bin (Access is denied)
at java.security.AccessController.doPrivileged(Native Method)
at javax.crypto.JarVerifier.verifySingleJar(JarVerifier.java:384)
... 9 more
Caused by: java.io.FileNotFoundException: *pathToProject*\proj\Main\bin (Access is denied)
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.(ZipFile.java:214)
at java.util.zip.ZipFile.(ZipFile.java:144)
at java.util.jar.JarFile.(JarFile.java:153)
at java.util.jar.JarFile.(JarFile.java:90)
at sun.net.www.protocol.jar.URLJarFile.(URLJarFile.java:93)
at sun.net.www.protocol.jar.URLJarFile.getJarFile(URLJarFile.java:69)
at sun.net.www.protocol.jar.JarFileFactory.get(JarFileFactory.java:98)
at sun.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.java:122)
at sun.net.www.protocol.jar.JarURLConnection.getJarFile(JarURLConnection.java:89)
at javax.crypto.JarVerifier$2.run(JarVerifier.java:399)
... 11 more
The best part is that this code executed well:
KeyPairGenerator dhKeyPairGen = KeyPairGenerator.getInstance("DH", myProvider);
Why do I get it?
I'm working on win6.1 x64