To generate a KeyPair Object from a (encrypted using password) string

N

Night82

I need to save permanently a KeyPair Object (I mean a public RSA key
and a private RSA key). So I'm thinking to save it on a file protected
by a password.

How Can I do that?
 
T

Thomas Weidenfeller

Night82 said:
I need to save permanently a KeyPair Object (I mean a public RSA key
and a private RSA key). So I'm thinking to save it on a file protected
by a password.

How Can I do that?

The public key by definition does not need to be protected. For a
private key, you maybe want java.security.KeyStore. You can also add the
public key to the KeyStore by wrapping it in a self-signed certificate,
and then adding the certificate to the keyStore.

/Thomas
 
N

Night82

Thomas Weidenfeller ha scritto:
The public key by definition does not need to be protected. For a
private key, you maybe want java.security.KeyStore. You can also add the
public key to the KeyStore by wrapping it in a self-signed certificate,
and then adding the certificate to the keyStore.

/Thomas

Ok so I create a keystore with:
KeyStore ks = KeyStore.getInstance("JKS");
Now how I can store the key? I've seen the comand:
setKeyEntry(String alias, byte[] key, Certificate[] chain)
but I've no certificate. Only the PrivateKey (to store) and the
password to safe it.
PS what "JKS"?
 
T

Thomas Weidenfeller

N

Night82

In order to use the Signature with the algorithm "SHA1withDSA", what
provider have I to install?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top