Export Certificate From Key Manager
To export a certificate (without the public and private keys) from the Key Manager:
Create an
NAESession
object (session).Create an
NAECertificate
object (mycert).Call the
certificateExport()
method of theNAECertificate
object and store the data in a byte array. ThecertificateExport()
method only exports the certificate no keys.Use a
FileOutputStream
(fos) to put the byte array into a file on the client.Close the stream.
Code sample
NAESession session = NAESession.getSession("userOne", "1234".toCharArray());
NAECertificate mycert = new NAECertificate ("CertOne", session);
byte[] exportData = mycert.certificateExport();
FileOutputStream fos = new FileOutputStream("/outputCertificate.crt");
fos.write(exportData);
fos.close();