use of com.adaptris.security.exc.AdaptrisSecurityException in project interlok by adaptris.
the class DecryptionServiceTest method testFailedDecryptionWithBranch.
@Test
public void testFailedDecryptionWithBranch() throws Exception {
String url = createKeystore();
EncryptionSigningService input = new EncryptionSigningService();
applyConfigForTests(input, url);
DecryptionService output = new DecryptionService();
applyConfigForTests(output, url);
output.setFailId(FAIL);
output.setSuccessId(SUCCESS);
output.setLocalPartner(NON_EXISTENT_ALIAS);
AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage(EXAMPLE_MSG);
execute(input, msg);
execute(output, msg);
assertEquals(FAIL, msg.getNextServiceId());
assertTrue(msg.getObjectHeaders().containsKey(CoreConstants.OBJ_METADATA_EXCEPTION));
assertTrue(msg.getObjectHeaders().get(CoreConstants.OBJ_METADATA_EXCEPTION) instanceof AdaptrisSecurityException);
}
use of com.adaptris.security.exc.AdaptrisSecurityException in project interlok by adaptris.
the class TestKeyStore method testKeystoreImportCertificateInvalidFilename.
@Test
public void testKeystoreImportCertificateInvalidFilename() throws Exception {
ksp = KeystoreFactory.getDefault().create(kloc);
ksp.load();
try {
ksp.setCertificate(String.valueOf(new Random().nextInt()), "XXXX");
fail("Import of missing cert succeeded");
} catch (AdaptrisSecurityException e) {
// expected
;
}
}
use of com.adaptris.security.exc.AdaptrisSecurityException in project interlok by adaptris.
the class TestKeyStore method testKeystoreImportCertificateChainInvalidAlias.
@Test
public void testKeystoreImportCertificateChainInvalidAlias() throws Exception {
config.importPrivateKey(cfg.getProperty(Config.KEYSTORE_TEST_URL), cfg.getProperty(Config.KEYSTORE_IMPORT_PKCS12_FILE), true);
ksp = KeystoreFactory.getDefault().create(kloc);
ksp.load();
try {
ksp.importCertificateChain(String.valueOf(new Random().nextInt()), cfg.getProperty(Config.KEYSTORE_COMMON_KEYSTORE_PW).toCharArray(), cfg.getProperty(Config.KEYSTORE_IMPORT_CERTCHAIN_FILE));
fail("Import of non-existent certchain succeeded");
} catch (AdaptrisSecurityException e) {
// expected
;
}
ksp.commit();
}
Aggregations