pkcs#7 is not a keyStore provider. If you want to read certificate
chain in a pkcs#7 file, use "keytool -importcert -file filename".
To find out all KeyStore providers, write a small program. See
http://exampledepot.com/egs/java.security/ListServices.html
Call getCryptoImpls("KeyStore") to find out what's available. For a
Sun JDK out of box, there should be al least pkcs12, jks, jceks. You
also get the pkcs11 one on Solaris and MSCAPI ones on Windows.
- Speedo
> pkcs#7 is not a keyStore provider. If you want to read certificate
> chain in a pkcs#7 file, use "keytool-importcert -file filename".
[quoted text clipped - 23 lines]
> > Thanks,
> >Efi
Thanks.
It still does not work.
When using keytool -printcert -file cert.p7 it prints everything fine
however when trying to import I receive Input not an X.509
certificate.
I tried to follow thawte tutorial on the subject :
https://search.thawte.com/support/ssl-digital-certificates/index?page=content&id
=SO7108
still no help there.
Any ideas ?
Efi
Speedo - 17 Apr 2008 15:40 GMT
Are you importing the pkcs#7 file (as a reply from a CA) into an
existing private key entry? Or, are you simply trying to create a new
trusted certificate entry?
If I remember correctly, it should succeed in the first case but the
second case demands a *single* X.509 certificate in the file.
If you really want to create a trusted certificate entry, you can
first -printcert it using the -rfc option, choose the BASE64 format
certificate you need and copy/paste it into a file, and -importcert
it.
- Speedo
> > pkcs#7 is not a keyStore provider. If you want to read certificate
> > chain in a pkcs#7 file, use "keytool-importcert -file filename".
[quoted text clipped - 36 lines]
>
> Efi
howdyraju2@gmail.com - 17 Apr 2008 17:49 GMT
As mentioned before, since pkcs#7 is not a keystore provider; hence
the JDK keytool command will not be able to parse a pkcs#7 file.
However, you can easily extract the certificate chain
programmatically. See the method below:
private X509Certificate[] getCertificateChain(InputStream in) throws
CertificateException {
CertificateFactory certFac = CertificateFactory.getInstance("X.509");
CertPath certPath = certFac.generateCertPath(in, ENCODING);
X509Certificate[] chain =
(X509Certificate[])certPath.getCertificates().toArray(new
X509Certificate[1]);
return chain;
}
> > pkcs#7 is not a keyStore provider. If you want to read certificate
> > chain in a pkcs#7 file, use "keytool-importcert -file filename".
[quoted text clipped - 36 lines]
>
> Efi