How to authenticate my own provider( only for testing purposes)
Posted
by user308806
on Stack Overflow
See other posts from Stack Overflow
or by user308806
Published on 2010-04-05T13:03:20Z
Indexed on
2010/04/05
13:43 UTC
Read the original article
Hit count: 319
Dear all
Now, I wrote a new provider (ESMJCE provider), and I also write a simple application to test it, but I have some exceptions like that
java.lang.SecurityException: JCE cannot authenticate the provider ESMJCE
at javax.crypto.Cipher.getInstance(DashoA13*..)
at javax.crypto.Cipher.getInstance(DashoA13*..)
at testprovider.main(testprovider.java:27)
Caused by: java.util.jar.JarException: Cannot parse file:/C:/Program%20Files/Java/jre1.6.0_02/lib/ext/abc.jar
at javax.crypto.SunJCE_c.a(DashoA13*..)
at javax.crypto.SunJCE_b.b(DashoA13*..)
at javax.crypto.SunJCE_b.a(DashoA13*..)
... 3 more
And here is my source code
import java.security.Provider;
import java.security.Security;
import javax.crypto.Cipher;
import esm.jce.provider.ESMProvider;
public class testprovider {
/
@param args
/
public static void main(String[] args) {
// TODO Auto-generated method stub
ESMProvider esmprovider = new esm.jce.provider.ESMProvider();
Security.insertProviderAt(esmprovider,2);
Provider[] temp = Security.getProviders();
for (int i= 0; i<temp.length; i++){
System.out.println("Providers: " temp[i].getName());
}
try{
Cipher cipher = Cipher.getInstance("DES", "ESMJCE");
System.out.println("Cipher: " cipher);
int blockSize= cipher.getBlockSize();
System.out.println("blockSize= " + blockSize);
}catch (Exception e){
e.printStackTrace();
}
}
}
Please help me solve this issue
Thanks
© Stack Overflow or respective owner