javabouncycastlejava-security

I have RSA encrypted private key with passphrase how do I decrypt the private key file


Basically I want to do this in command in java

openssl rsa -in enc_private.key -out private.key -passin pass:passphrase_xyz

beginning of my encrypted key file looks like this

-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: DES-EDE3-CBC,59e5e15b3d9474e6

please assist.


Solution

  • You could use

    Runtime.getRuntime().exec("openssl rsa -in enc_private.key -out private.key -passin pass:passphrase_xyz");
    

    Maybe a bash or PowerShell script would be better suited?