Search in sources :

Example 1 with Output

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);
        }
    }
}
Also used : ServiceException(com.adaptris.core.ServiceException) Output(com.adaptris.security.Output) ServiceException(com.adaptris.core.ServiceException) IOException(java.io.IOException) AdaptrisSecurityException(com.adaptris.security.exc.AdaptrisSecurityException)

Example 2 with Output

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;
}
Also used : Output(com.adaptris.security.Output)

Example 3 with 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);
        }
    }
}
Also used : ServiceException(com.adaptris.core.ServiceException) Output(com.adaptris.security.Output) ServiceException(com.adaptris.core.ServiceException) AdaptrisSecurityException(com.adaptris.security.exc.AdaptrisSecurityException)

Aggregations

Output (com.adaptris.security.Output)3 ServiceException (com.adaptris.core.ServiceException)2 AdaptrisSecurityException (com.adaptris.security.exc.AdaptrisSecurityException)2 IOException (java.io.IOException)1