0

I need to convert a CSR file in PEM encoding to a DER encoded file.

This is the openssl command for that but I need to do it in Java without BouncyCastle.

openssl req -inform pem -outform der -in file_one.csr -out file_two.der

What is the equivalent code for this in Java?

jww
  • 97,681
  • 90
  • 411
  • 885
Hulk Man
  • 153
  • 1
  • 15

1 Answers1

1

The PEM is the Base64 encoding of the binary DER with header an trailer lines. Just ignore the header and trailer and use Base64.Decoder on the content and there you are.

Jonathan Rosenne
  • 2,159
  • 17
  • 27