{
headers.putSingle("Content-Disposition", "attachment; filename=\"smime.p7m\"");
headers.putSingle("Content-Type", "application/pkcs7-mime; smime-type=enveloped-data; name=\"smime.p7m\"");
headers.putSingle("Content-Transfer-Encoding", "base64");
OutputEncryptor encryptor = new JceCMSContentEncryptorBuilder(CMSAlgorithm.DES_EDE3_CBC)
.setProvider("BC")
.build();
if (out.getCertificate() == null) throw new NullPointerException("The certificate object was not set.");
JceKeyTransRecipientInfoGenerator infoGenerator = new JceKeyTransRecipientInfoGenerator(out.getCertificate());
infoGenerator.setProvider("BC");