use of com.adaptris.security.keystore.KeystoreProxy in project interlok by adaptris.
the class SingleEntryKeystoreBase method testContainsNonExistentAlias.
@Test
public void testContainsNonExistentAlias() throws Exception {
KeystoreProxy ksp = KeystoreFactory.getDefault().create(kloc);
ksp.load();
String alias = String.valueOf(new Random().nextInt());
if (ksp.containsAlias(alias)) {
fail(alias + " exists in the specified keystore!");
}
}
use of com.adaptris.security.keystore.KeystoreProxy in project interlok by adaptris.
the class SingleEntryKeystoreBase method testImportCertificate.
@Test
public void testImportCertificate() throws Exception {
KeystoreProxy ksp = KeystoreFactory.getDefault().create(kloc);
ksp.load();
try {
ksp.setCertificate("", "");
fail("Import successful");
} catch (Exception e) {
assertEquals(KeystoreException.class, e.getClass());
}
try {
ksp.setCertificate("", (Certificate) null);
fail("Import successful");
} catch (Exception e) {
assertEquals(KeystoreException.class, e.getClass());
}
try {
ksp.setCertificate("", (InputStream) null);
fail("Import successful");
} catch (Exception e) {
assertEquals(KeystoreException.class, e.getClass());
}
try {
ksp.setCertificate("", (File) null);
fail("Import successful");
} catch (Exception e) {
assertEquals(KeystoreException.class, e.getClass());
}
}
Aggregations