views:

40

answers:

1
keytool -genkey -keyalg RSA -dname "cn=rahul,ou=OU,o=DEV,c=IN" -alias rahul12 -keypass rahul12 -keystore rahul12.jks -storepass rahul12 -validity 366

keytool -certreq -keyalg RSA -alias rahul12 -keypass rahul12 -keystore rahul12.jks -storepass rahul12 -file rahul12.cert

keytool -import -alias rahul12 -file rahul12.cert -keystore rahul_adapter -storepass rahul_adapter

In 1st command i am generating KeyStore, In 2nd command i am generating certificate and in 3rd step i am importing that certificate in rahul_adapter(universal keystore) . While importing it is giving Error java.lang.Exception: Input not an X.509 certificate.Can anybody tell me why i am getting this error.How to resolve that error and i also need certificate should be in CSR(Certificate Signing Requests) format not in any other format how to do that please help me????

+2  A: 

The answer to this is quite obvious - a CSR is being generate in the second step, and the same is being imported into the keytsore.

A CSR is not the same as a certificate, and it must be utilized to obtain the actual certificate from a certificate authority.

By the way, if this is a development environment that you are trying to setup, you are better off using self-signed certificates. Moreover, use JDK 6, as the genkeypair option of keytool in JDK 6 automatically creates a private key and a public key (with a X.509 certificate), which can be exported using the exportcert option.

Vineet Reynolds
Can you tell me how CA will make it as a certificate?? what is that process for that?How CA is signing the certificates??
Rahul
Well, its upto the CA to turn out a certificate for a CSR. Most CAs implement checks and request for document, when CSRs are submitted, to verify whether "you are, who you say you are". The generation of a certificate from a CSR, in plain terms, involves signing the applicant's CSR with the CA's private key.
Vineet Reynolds