Issue Type: Bug Bug
Affects Versions: 1.3.1
Assignee: Unassigned
Components: crypto, security
Created: 08/Jan/14 9:27 AM
Description:

The following code fails on the last line, with the enclosed stacktrace.

DefaultEncryptionServiceFactory encryptionServiceFactory = new DefaultEncryptionServiceFactory();

PasswordEncryptionServices.PasswordProtectedKeystoreCryptoConfig config = new PasswordEncryptionServices
            .PasswordProtectedKeystoreCryptoConfig();
 
config.setAlias("alias");
config.setKeyStoreFile("file");
config.setPassword("password");
 
EncryptionService service = encryptionServiceFactory.getService(config,
            Robolectric.application.getApplicationContext());
java.lang.RuntimeException: java.security.NoSuchProviderException: JCE cannot authenticate the provider SC
	at org.jboss.aerogear.android.impl.security.PasswordEncryptionServices.createKey(PasswordEncryptionServices.java:138)
	at org.jboss.aerogear.android.impl.security.PasswordEncryptionServices.getCrypto(PasswordEncryptionServices.java:84)
	at org.jboss.aerogear.android.impl.security.PasswordEncryptionServices.<init>(PasswordEncryptionServices.java:61)
	at org.jboss.aerogear.android.impl.security.DefaultEncryptionServiceFactory.makePasswordKeyStoreService(DefaultEncryptionServiceFactory.java:43)
	at org.jboss.aerogear.android.impl.security.DefaultEncryptionServiceFactory.getService(DefaultEncryptionServiceFactory.java:32)
	at org.jboss.aerogear.android.impl.security.DefaultEncryptionServiceFactoryTest.testCreatePassKeyService(DefaultEncryptionServiceFactoryTest.java:48)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
	at com.xtremelabs.robolectric.RobolectricTestRunner$1.evaluate(RobolectricTestRunner.java:288)
	at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:74)
	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:202)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:65)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Caused by: java.security.NoSuchProviderException: JCE cannot authenticate the provider SC
	at javax.crypto.JceSecurity.getInstance(JceSecurity.java:101)
	at javax.crypto.KeyAgreement.getInstance(KeyAgreement.java:223)
	at org.jboss.aerogear.android.impl.security.PasswordEncryptionServices.createKey(PasswordEncryptionServices.java:119)
	... 33 more
Caused by: java.util.jar.JarException: Class is on the bootclasspath
	at javax.crypto.JarVerifier.verify(JarVerifier.java:247)
	at javax.crypto.JceSecurity.verifyProviderJar(JceSecurity.java:161)
	at javax.crypto.JceSecurity.getVerificationResult(JceSecurity.java:187)
	at javax.crypto.JceSecurity.getInstance(JceSecurity.java:98)
	... 35 more

The code used here is from a simple test, run with JUnit using RobolectricTestRunner.
JDK used was 1.7 on Mac OSX.
Tried with Ag-crypto version 0.1.0 and 0.1.2, same result.

Project: AeroGear Android
Priority: Major Major
Reporter: Tadeas Kriz
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira