Re: [Dev] Converting a Certificate Request from .PEM to .DER

2016-04-26 Thread Madhawa Perera
Thank you Dilshan it works :)

On Mon, Apr 25, 2016 at 3:30 PM, Dilshan Edirisuriya 
wrote:

> Its just a base64 decode version of PEM. Just execute
> Base64.decode(str.getBytes()) by removing BEGIN CERTIFICATE, END
> CERTIFICATE parts.
>
> Regards,
>
> Dilshan
>
> On 25 April 2016 at 15:22, Madhawa Perera  wrote:
>
>> I'm trying to convert a certificate request which is in PEM format as
>> shown below.
>>
>> -BEGIN CERTIFICATE REQUEST-
>> MIIC/jCCAeYCAQAwgZ0xCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJDQTEWMBQGA1UE
>> BwwNU2FuIEZyYW5jaXNjbzETMBEGA1UECgwKQnJvd24gQmVhcjEVMBMGA1UECwwM
>> YnJvd25iZWFyLm1lMRkwFwYDVQQDDBBhcHAuYnJvd25iZWFyLm1lMSIwIAYJKoZI
>> hvcNAQkBFhNnaXJvbGFtaXNAZ21haWwuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOC
>> AQ8AMIIBCgKCAQEA09S3Sn7leo53lko+A/l2UNvzxR34WNsIyORRWF68wphPoYsf
>> DEtOebG1U+iSRUjl/g0z7DCpNlBYboN3x1ac+upkyvyvrkk/k2cqTLh/zfjN67wM
>> 8W2tld+zBkT0EGzHHDqzrxsaCOurwHiQ4FqsrVl6frys3wPyPsXiH4UZFQeFCNKI
>> -END CERTIFICATE REQUEST-
>>
>> (This is not the full certificate request file I'm using, I have deleted
>> the content in the middle but it takes the above format)
>>
>> I can do the conversion by executing the following openssl command.
>>
>> *"openssl req -inform pem -outform der -in " + csrFileLocation + " -out
>> "+ derFileLocation + ".der"*
>>
>> However I need to use java to do the conversion (from pem to der) without
>> going through openssl command line tool or without executing the openssl
>> command using java.
>>
>> I have tried to do it with the bouncy castle but it didn't work for me.
>> Is there anyone out there who has tried this before?
>>
>> Any help appreciated.
>>
>> Thank you
>> Best Regards,
>> Madhawa
>>
>>
>> --
>> Madhawa Perera
>> *Software Engineer*
>> Mobile : +94 (0) 773655496
>> <%2B94%20%280%29%20773%20451194>
>> madha...@wso2.com
>>
>> ___
>> Dev mailing list
>> Dev@wso2.org
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>


-- 
Madhawa Perera
*Software Engineer*
Mobile : +94 (0) 773655496
<%2B94%20%280%29%20773%20451194>
madha...@wso2.com
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Converting a Certificate Request from .PEM to .DER

2016-04-25 Thread Dilshan Edirisuriya
Its just a base64 decode version of PEM. Just execute
Base64.decode(str.getBytes()) by removing BEGIN CERTIFICATE, END
CERTIFICATE parts.

Regards,

Dilshan

On 25 April 2016 at 15:22, Madhawa Perera  wrote:

> I'm trying to convert a certificate request which is in PEM format as
> shown below.
>
> -BEGIN CERTIFICATE REQUEST-
> MIIC/jCCAeYCAQAwgZ0xCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJDQTEWMBQGA1UE
> BwwNU2FuIEZyYW5jaXNjbzETMBEGA1UECgwKQnJvd24gQmVhcjEVMBMGA1UECwwM
> YnJvd25iZWFyLm1lMRkwFwYDVQQDDBBhcHAuYnJvd25iZWFyLm1lMSIwIAYJKoZI
> hvcNAQkBFhNnaXJvbGFtaXNAZ21haWwuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOC
> AQ8AMIIBCgKCAQEA09S3Sn7leo53lko+A/l2UNvzxR34WNsIyORRWF68wphPoYsf
> DEtOebG1U+iSRUjl/g0z7DCpNlBYboN3x1ac+upkyvyvrkk/k2cqTLh/zfjN67wM
> 8W2tld+zBkT0EGzHHDqzrxsaCOurwHiQ4FqsrVl6frys3wPyPsXiH4UZFQeFCNKI
> -END CERTIFICATE REQUEST-
>
> (This is not the full certificate request file I'm using, I have deleted
> the content in the middle but it takes the above format)
>
> I can do the conversion by executing the following openssl command.
>
> *"openssl req -inform pem -outform der -in " + csrFileLocation + " -out "+
> derFileLocation + ".der"*
>
> However I need to use java to do the conversion (from pem to der) without
> going through openssl command line tool or without executing the openssl
> command using java.
>
> I have tried to do it with the bouncy castle but it didn't work for me. Is
> there anyone out there who has tried this before?
>
> Any help appreciated.
>
> Thank you
> Best Regards,
> Madhawa
>
>
> --
> Madhawa Perera
> *Software Engineer*
> Mobile : +94 (0) 773655496
> <%2B94%20%280%29%20773%20451194>
> madha...@wso2.com
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


[Dev] Converting a Certificate Request from .PEM to .DER

2016-04-25 Thread Madhawa Perera
I'm trying to convert a certificate request which is in PEM format as shown
below.

-BEGIN CERTIFICATE REQUEST-
MIIC/jCCAeYCAQAwgZ0xCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJDQTEWMBQGA1UE
BwwNU2FuIEZyYW5jaXNjbzETMBEGA1UECgwKQnJvd24gQmVhcjEVMBMGA1UECwwM
YnJvd25iZWFyLm1lMRkwFwYDVQQDDBBhcHAuYnJvd25iZWFyLm1lMSIwIAYJKoZI
hvcNAQkBFhNnaXJvbGFtaXNAZ21haWwuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOC
AQ8AMIIBCgKCAQEA09S3Sn7leo53lko+A/l2UNvzxR34WNsIyORRWF68wphPoYsf
DEtOebG1U+iSRUjl/g0z7DCpNlBYboN3x1ac+upkyvyvrkk/k2cqTLh/zfjN67wM
8W2tld+zBkT0EGzHHDqzrxsaCOurwHiQ4FqsrVl6frys3wPyPsXiH4UZFQeFCNKI
-END CERTIFICATE REQUEST-

(This is not the full certificate request file I'm using, I have deleted
the content in the middle but it takes the above format)

I can do the conversion by executing the following openssl command.

*"openssl req -inform pem -outform der -in " + csrFileLocation + " -out "+
derFileLocation + ".der"*

However I need to use java to do the conversion (from pem to der) without
going through openssl command line tool or without executing the openssl
command using java.

I have tried to do it with the bouncy castle but it didn't work for me. Is
there anyone out there who has tried this before?

Any help appreciated.

Thank you
Best Regards,
Madhawa


-- 
Madhawa Perera
*Software Engineer*
Mobile : +94 (0) 773655496
<%2B94%20%280%29%20773%20451194>
madha...@wso2.com
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev