use of javax.net.ssl.KeyStoreBuilderParameters in project robovm by robovm.
the class ProtectionParameterImpl method test_initLjavax_net_ssl_ManagerFactoryParameters.
/**
* Test for <code>init(ManagerFactoryParameters params)</code>
* Assertion:
* throws InvalidAlgorithmParameterException when params is null
*/
public void test_initLjavax_net_ssl_ManagerFactoryParameters() throws NoSuchAlgorithmException {
if (!DEFSupported) {
fail(NotSupportedMsg);
return;
}
ManagerFactoryParameters par = null;
KeyManagerFactory[] keyMF = createKMFac();
assertNotNull("KeyManagerFactory object were not created", keyMF);
for (int i = 0; i < keyMF.length; i++) {
try {
keyMF[i].init(par);
fail("InvalidAlgorithmParameterException must be thrown");
} catch (InvalidAlgorithmParameterException e) {
}
}
KeyStore.ProtectionParameter pp = new ProtectionParameterImpl();
KeyStore.Builder bld = KeyStore.Builder.newInstance("testType", null, pp);
assertNotNull("Null object KeyStore.Builder", bld);
try {
KeyManagerFactory kmf = KeyManagerFactory.getInstance(defaultAlgorithm);
KeyStoreBuilderParameters ksp = new KeyStoreBuilderParameters(bld);
assertNotNull(ksp.getParameters());
kmf.init(ksp);
fail("InvalidAlgorithmParameterException must be thrown");
} catch (InvalidAlgorithmParameterException e) {
}
}
use of javax.net.ssl.KeyStoreBuilderParameters in project robovm by robovm.
the class KeyStoreBuilderParametersTest method test_init_Builder.
public void test_init_Builder() {
TestKeyStore testKeyStore = TestKeyStore.getClient();
Builder builder = Builder.newInstance(testKeyStore.keyStore, new PasswordProtection(testKeyStore.storePassword));
KeyStoreBuilderParameters ksbp = new KeyStoreBuilderParameters(builder);
assertNotNull(ksbp);
assertNotNull(ksbp.getParameters());
assertEquals(1, ksbp.getParameters().size());
assertSame(builder, ksbp.getParameters().get(0));
}
use of javax.net.ssl.KeyStoreBuilderParameters in project robovm by robovm.
the class KeyStoreBuilderParametersTest method test_getParameters.
/**
* javax.net.ssl.KeyStoreBuilderParameters#getParameters()
*/
public void test_getParameters() {
String[] param = { "Parameter1", "Parameter2", "Parameter3" };
List ls = new ArrayList<String>();
for (int i = 0; i < param.length; i++) {
ls.add(param[i]);
}
KeyStoreBuilderParameters ksp = new KeyStoreBuilderParameters(ls);
List res_list = ksp.getParameters();
try {
res_list.add("test");
fail();
} catch (UnsupportedOperationException expected) {
}
Object[] res = res_list.toArray();
assertEquals(res.length, param.length);
for (int i = 0; i < res.length; i++) {
assertEquals(param[i], res[i]);
}
}
Aggregations