SignerInfoGenerator signer = new JcaSimpleSignerInfoGeneratorBuilder().setProvider("BC").build("SHA1WITHRSA", privateKey, cert);
gen.addSignerInfoGenerator(signer);
MimeMultipart mp = gen.generate(createMsg());
ByteArrayOutputStream os = new ByteArrayOutputStream();
mp.writeTo(os);
String contentType = mp.getContentType();
contentType = contentType.replace("\r\n", "").replace("\t", " ");
System.out.println(contentType);
String s = new String(os.toByteArray());
StringBuilder builder = new StringBuilder();