It is normal to use the public key for encryption since then only the holder of the private key can decrypt. If you encrypt with the private key then anyone can decrypt using the public key!
Using the private key to encrypt is just what one does when signing. Since only the private key holder can encrypt with the private key then you know that if the public key can be used to decrypt then the private key holder MUST have done the encryption. When signing it is normal to only encrypt a hash of the document rather than the document itself.
All..
I have to set up a PKI solution. I need to understand a few implementation details about keystore.
I will create an empty keystore..
I will then create a private/public key pair
I will them create a Cert Request which I send off to a CA to get it signed.
Then I import the cert that is provided by the CA into the keystore..
At what point will I need to get the public key of the client? Where will I import that? Will I receive it as a certificate. Should it be stored in the same keystore?
I have to send my public key to the client. Do I send them my singed certificate? How do I do that?
Kindly help me.
Sincerely
Kiran
> I will create an empty keystore..
> I will then create a private/public key pair
Correct, so at this point you have the public key.
> I will them create a Cert Request which I send off to
> a CA to get it signed.
> Then I import the cert that is provided by the CA
> into the keystore..
>
> At what point will I need to get the public key of
> the client?
See above. It's already in the keystore. It's also in the certificate request, and in the signed certificate.