convert DER encoded cert to PEM encoded cert  
Author Message
Carla Schaffner





PostPosted: 2003-9-25 21:40:00 Top

java-programmer, convert DER encoded cert to PEM encoded cert hi

i read a certificate from a smartcard with the pkcs#11 API. i get the
certificate in a hex string DER encoded. how can i convert a hex-string
from a DER encoded certificate to e PEM encoded certificate.

i try the method Certificate cert = cf.generateCertificate(fis);

but i works just for base64 encoded certs

-----BEGIN CERTIFICATE-----
MIIDgjCCAuugAwIBAgIBGzANBgkqhkiG9w0BAQUFADB+MQswCQYDVQQGEwJDSDEL
MAkGA1UECBMCWkgxEDAOBgNVBAcTB1p1ZXJpY2gxFTATBgNVBAoTDE1hcmMgVGVz
dCBDQTEXMBUGA1UECxMOVGVzdCBDQ .....
-----END CERTIFICATE-----

i have this sting:

30820345308202aea003020102020102300d06092a864886f70d01 ....

has anyone a idea?

thanks
carla
 
Carla Schaffner





PostPosted: 2003-9-25 21:57:00 Top

java-programmer >> convert DER encoded cert to PEM encoded cert hi

i read a certificate from a smartcard with the pkcs#11 API. i get the
certificate in a hex string DER encoded. how can i convert a hex-string
from a DER encoded certificate to e PEM encoded certificate.

i try the method Certificate cert = cf.generateCertificate(fis);

but i works just for base64 encoded certs

-----BEGIN CERTIFICATE-----
MIIDgjCCAuugAwIBAgIBGzANBgkqhkiG9w0BAQUFADB+MQswCQYDVQQGEwJDSDEL
MAkGA1UECBMCWkgxEDAOBgNVBAcTB1p1ZXJpY2gxFTATBgNVBAoTDE1hcmMgVGVz
dCBDQTEXMBUGA1UECxMOVGVzdCBDQ .....
-----END CERTIFICATE-----

i have this sting:

30820345308202aea003020102020102300d06092a864886f70d01 ....

has anyone a idea?

thanks
carla
 
Peter Huber





PostPosted: 2003-9-26 23:35:00 Top

java-programmer >> convert DER encoded cert to PEM encoded cert Don't know a out of the box solution, but maybe you could check the APIs
provided with those various
Security Providers such as BouncyCastel or FlexiProvider. I think
FlexiProvider, the ASN1 included codec respectivley, has some sort of
pkcs#11 package.

"Carla Schaffner" <email***@***.com> schrieb im Newsbeitrag
news:3f72f033$0$3677$email***@***.com...
> hi
>
> i read a certificate from a smartcard with the pkcs#11 API. i get the
> certificate in a hex string DER encoded. how can i convert a hex-string
> from a DER encoded certificate to e PEM encoded certificate.
>
> i try the method Certificate cert = cf.generateCertificate(fis);
>
> but i works just for base64 encoded certs
>
> -----BEGIN CERTIFICATE-----
> MIIDgjCCAuugAwIBAgIBGzANBgkqhkiG9w0BAQUFADB+MQswCQYDVQQGEwJDSDEL
> MAkGA1UECBMCWkgxEDAOBgNVBAcTB1p1ZXJpY2gxFTATBgNVBAoTDE1hcmMgVGVz
> dCBDQTEXMBUGA1UECxMOVGVzdCBDQ .....
> -----END CERTIFICATE-----
>
> i have this sting:
>
> 30820345308202aea003020102020102300d06092a864886f70d01 ....
>
> has anyone a idea?
>
> thanks
> carla


 
 
Deepak Nayal





PostPosted: 2003-10-1 5:52:00 Top

java-programmer >> convert DER encoded cert to PEM encoded cert Weblogic Server comes up along with a utils.der2pem tool,
which you can run using the following command :-
java utils.der2pem <DER File name>

Hope it helps.
:-)



Carla Schaffner wrote:
> hi
>
> i read a certificate from a smartcard with the pkcs#11 API. i get the
> certificate in a hex string DER encoded. how can i convert a hex-string
> from a DER encoded certificate to e PEM encoded certificate.
>
> i try the method Certificate cert = cf.generateCertificate(fis);
>
> but i works just for base64 encoded certs
>
> -----BEGIN CERTIFICATE-----
> MIIDgjCCAuugAwIBAgIBGzANBgkqhkiG9w0BAQUFADB+MQswCQYDVQQGEwJDSDEL
> MAkGA1UECBMCWkgxEDAOBgNVBAcTB1p1ZXJpY2gxFTATBgNVBAoTDE1hcmMgVGVz
> dCBDQTEXMBUGA1UECxMOVGVzdCBDQ .....
> -----END CERTIFICATE-----
>
> i have this sting:
>
> 30820345308202aea003020102020102300d06092a864886f70d01 ....
>
> has anyone a idea?
>
> thanks
> carla