use of com.adaptris.core.common.PayloadInputStreamWrapper in project interlok by adaptris.
the class SymmetricKeyCryptographyServiceTest method testDoServiceEncrypt_WithSourceTarget.
@Test
public void testDoServiceEncrypt_WithSourceTarget() throws Exception {
SymmetricKeyCryptographyService service = new SymmetricKeyCryptographyService();
service.setAlgorithm(ALGORITHM);
service.setCipherTransformation(CIPHER);
service.setOperationMode(SymmetricKeyCryptographyService.OpMode.ENCRYPT);
service.setKey(new ConstantDataInputParameter(Conversion.byteArrayToBase64String(key)));
service.setInitialVector(new ConstantDataInputParameter(Conversion.byteArrayToBase64String(iv)));
service.setSource(new PayloadInputStreamWrapper());
service.setTarget(new PayloadOutputStreamWrapper());
AdaptrisMessage message = AdaptrisMessageFactory.getDefaultInstance().newMessage(PAYLOAD);
ServiceCase.execute(service, message);
assertTrue(Arrays.equals(encryptedPayload, message.getPayload()));
}
Aggregations