outputStreamWriter.write("\r\n");
}
}
outputStreamWriter.write("\r\n");
outputStreamWriter.close();
attachmentInputStream = new MultiInputStream(
new ByteArrayInputStream(byteArrayOutputStream.toByteArray()),
attachment.getSourceStream()
);
} catch (UnsupportedEncodingException e) {
throw new WSSecurityException(WSSecurityException.ErrorCode.FAILED_ENCRYPTION, e);
} catch (IOException e) {
throw new WSSecurityException(WSSecurityException.ErrorCode.FAILED_ENCRYPTION, e);
}
} else {
attachmentInputStream = attachment.getSourceStream();
}
final ByteArrayInputStream ivInputStream = new ByteArrayInputStream(cipher.getIV());
final CipherInputStream cipherInputStream = new CipherInputStream(attachmentInputStream, cipher);
return new MultiInputStream(ivInputStream, cipherInputStream);
}