use of org.bouncycastle.mail.smime.SMIMEEnveloped in project nhin-d by DirectProject.
the class SplitDirectRecipientInformationFactory_createInstanceTest method createSMIMEEnv.
protected SMIMEEnveloped createSMIMEEnv() throws Exception {
// get the cert
final X509Certificate cert = TestUtils.getExternalCert("user1");
// create an encrypted message
final MimeEntity entity = new MimeEntity();
entity.setText("Hello world.");
entity.setHeader(MimeStandard.ContentTypeHeader, "text/plain");
entity.setHeader(MimeStandard.ContentTransferEncodingHeader, "7bit");
final SMIMECryptographerImpl encryptor = new SMIMECryptographerImpl();
return new SMIMEEnveloped(encryptor.encrypt(entity, Arrays.asList(cert)));
}
Aggregations