http://www.perlmonks.org?node_id=801915

shug94 has asked for the wisdom of the Perl Monks concerning the following question:

I have a certificate file which was generated by the simpleCA tool. I want to know what the easiest way is to use this certificate file to sign some data in Perl.

I am running an Apache HTTP Server on a Centos box, and I need to digitally sign some text.

I read in the file (Client.crt), and output it to standard output. It appears to be Base64Encoded. Here is a sample:
-----BEGIN CERTIFICATE----- MIICqzCCAhSgAwIBAgICEAAwDQYJKoZIhvcNAQEEBQAwgZwxCzAJBgNVBAYTAkFV ... EmsqLqgiS/OejqRYmaJe -----END CERTIFICATE-----


Is there a Perl module which will read in this certificate file and allow me to use it to sign data?

Cheers,
Shug

Replies are listed 'Best First'.
Re: Using Certificate files in Perl
by Anonymous Monk on Oct 19, 2009 at 02:48 UTC
      I clearly didn't ask my question well enough.

      I will probably be wanting to sign it using Crypt::RSA, but what I really need to know is how to retrieve the public and private keys from the certificate file. Although I suppose this is not really a perl question, and is more of a simpleCA question. I will try elsewhere on the net.

      I have now read the file further using the decode function of MIME::Base64, and it seems to contain some plaintext and a lot of binary. Now all I need is to understand the format.