I have a X509Certificate and I'd like to save it into a PKCS#7 .p7b file. Currently, I'm able to save it into a .cer file with the following code:
private void writeCertificate(Writer writer,
X509Certificate cert)
throws Exception
{
writer.write(BEGIN_CERTIFICATE_MARKER);
writer.write("\n");
writer.write(new String(Base64.encode(cert.getEncoded())));
writer.write("\n");
writer.write(END_CERTIFICATE_MARKER);
writer.close();
}
What do I need to do to save as a .p7b file instead?