use of com.adaptris.security.Output in project interlok by adaptris.
the class EncryptionService method doService.
/**
* @see com.adaptris.core.Service#doService(AdaptrisMessage)
*/
@Override
public final void doService(AdaptrisMessage m) throws ServiceException {
try {
Output output = doEncryption(addLength(m), retrieveRemotePartner(m));
m.setPayload(output.getBytes());
if (branchingEnabled) {
m.setNextServiceId(getSuccessId());
}
} catch (Exception e) {
if (branchingEnabled) {
m.setNextServiceId(getFailId());
m.getObjectHeaders().put(CoreConstants.OBJ_METADATA_EXCEPTION, e);
} else {
throw new ServiceException(e);
}
}
}
use of com.adaptris.security.Output in project interlok by adaptris.
the class EncryptionSigningService method doEncryption.
/**
* @see EncryptionService#doEncryption(byte[], Alias)
*/
@Override
protected Output doEncryption(byte[] payload, Alias remoteAlias) throws AdaptrisSecurityException {
Output output = retrieveSecurityImplementation().encrypt(payload, retrieveLocalPartner(), remoteAlias);
output = retrieveSecurityImplementation().sign(payload, retrieveLocalPartner(), output);
return output;
}
use of com.adaptris.security.Output in project interlok by adaptris.
the class DecryptionService method doService.
/**
* @see com.adaptris.core.Service#doService(AdaptrisMessage)
*/
public void doService(AdaptrisMessage msg) throws ServiceException {
try {
Output output = retrieveSecurityImplementation().verify(msg.getPayload(), retrieveLocalPartner(), retrieveRemotePartner(msg));
msg.setPayload(removeLength(output));
if (branchingEnabled) {
msg.setNextServiceId(getSuccessId());
}
} catch (Exception e) {
if (branchingEnabled) {
msg.setNextServiceId(getFailId());
msg.getObjectHeaders().put(CoreConstants.OBJ_METADATA_EXCEPTION, e);
} else {
throw new ServiceException(e);
}
}
}
Aggregations