0

Using OpenSSL one can get parse and dump an ASN.1 DER file giving an output that looks like this:

  100:d=5  hl=2 l=   3 prim: OBJECT            :organizationalUnitName
  105:d=5  hl=2 l=  11 prim: PRINTABLESTRING   :Big Number Services
  118:d=3  hl=2 l=  20 cons: SET
  120:d=4  hl=2 l=  18 cons: SEQUENCE
  122:d=5  hl=2 l=   3 prim: OBJECT            :commonName
  127:d=5  hl=2 l=  11 prim: PRINTABLESTRING   :example.com
  140:d=2  hl=4 l= 290 cons: SEQUENCE
  144:d=3  hl=2 l=  13 cons: SEQUENCE

I would like to generate a similar output using Perl. One way, of course, would be to call openssl ans1parse from within Perl, but I was looking for a way that did not rely on calling an external executable.

I looked at the Perl module Convert::ASN1 but it appears that to use that you need the ASN.1 description which I do not have.

rlandster
  • 7,294
  • 14
  • 58
  • 96

1 Answers1

0

Try looking at the Crypt::OpenSSL::* modules on cpan. Most will use libcrypto to access the OpenSSL supplied functions, so you should get similar information, if you can find a similar method/sub in a module.

kbenson
  • 1,464
  • 9
  • 13