How can I read RSA keys in Java?

后端 未结 1 780
盖世英雄少女心
盖世英雄少女心 2021-01-22 06:33

I am trying to read the RSA public and private keys files in Java.

My RSA public and private key is generated using PuttyGen. (SSH-2 RSA, 1024 bits)

The code I a

1条回答
  •  被撕碎了的回忆
    2021-01-22 07:15

    Putty uses its own key format. You need to export the Putty key to the OpenSSH format - see How to convert SSH keypairs generated using PuttyGen(Windows) into key-pairs used by ssh-agent and KeyChain(Linux).

    Then, you need to convert the OpenSSH key to pkcs8 format - see How to Load RSA Private Key From File. The Cygwin version of openssh will work just fine for this; there's no need to find a Unix system to run openssh.

    0 讨论(0)
提交回复
热议问题