I have a generated a private key using CertAndKeyGen class. Now I want to encrypt the private key with a password and use it as key while starting PostgreSQL server. Can some one please help me with java code to encrypt the private key, where googling dint help me out. Below is my code I use to generate Private Key.
CertAndKeyGen keypair = new CertAndKeyGen("RSA", "SHA1WithRSA", null);
PrivateKey privKey = keypair.getPrivateKey();
Any help or suggestion will be really appreciated.
1 Answer