/* encrypt the key and save the cert */
EncryptedPrivateKeyInfo epki = new EncryptedPrivateKeyInfo(
(PrivateKeyInfo)kp.getPrivate());
epki.encrypt(getPassword("Certificate password"),
AlgorithmID.pbeWithMD5AndDES_CBC, null);
new KeyAndCertificate(epki, chain).saveTo(args[0], ASN1.PEM);
} catch (Exception e) {
System.out.println("OOPS: " + e);
e.printStackTrace();