Crypt::SMimeEngine

Perl interface to OpenSSL for SMIME commands with hardware engines support.
Download

Crypt::SMimeEngine Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Flavio Fanton
  • Publisher web site:
  • http://search.cpan.org/~flazan/

Crypt::SMimeEngine Tags


Crypt::SMimeEngine Description

Perl interface to OpenSSL for SMIME commands with hardware engines support. Crypt::SMimeEngine is a Perl interface to OpenSSL for SMIME commands with hardware engines support.SYNOPSIS use Crypt::SMimeEngine qw(&init &sign &verify &getFingerprint &getCertInfo &load_privk &getErrStr &ossl_version); $cert_dir = 'certs/'; # path trusted certificate $cert = 'certs/cert.pem'; # path signer certificate $key = 'certs/key.pem'; # path private key $other_cert = []; # certs to add # let me inizialize the module with openssl engine (no hw engine) $engine_type = 'openssl'; $out = init($cert_dir, $cert, $key, $other_cert, $engine_type); die "Errore in initialize process: ".getErrStr()." " if $out; print "Init OK "; # now inizialize the module with a hardware engine. # You can load every engine openssl compatible; # if you want a list of these engines try this command on your server # openssl engine # # ex: if you choose nCipher hardware engine support # try the next snip # XXX REMENBER # XXX this module is tested from me only upon nCipher netHsm!!! # XXX Please let me know if you try with succesfully with other hw engine $engine_type = 'chil'; $engine_lib = '/opt/nfast/toolkits/hwcrhk/libnfhwcrhk.so'; # XXX verify on your installation!!! $out = init($cert_dir, $cert, $key, $other_cert, $engine_type, $engine_lib); die "Errore in initialize process: ".getErrStr()." " if $out; print "Init OK "; # SIGN $mail_in = 'MAIL/mail.txt'; $mail_out = 'MAIL/mail.txt.signed'; $out = sign($mail_in, $mail_out); print $out ? "Error sign: ".getErrStr()." ":"Sign OK "; # VERIFY $noverify = 1; # true no verify the chain, false otherwise $out = verify($mail_out, $cert, $noverify); print $out ? "Verify: ".getErrStr()." ":"Verify OK "; # LOAD NEW KEY-CERTIFICATE $out = load_privk($new_key, $new_cert); print $out ? "Error to load new key-cert: ".getErrStr()." ":"load_privk OK "; # get the certificate fingerprint $schema = 'sha1'; $out = getFingerprint($cert, $schema); if(defined $out){ print "Fingerprint ($cert): $out "; }else{ print "Errore to get fingerprint: ".getErrStr()," "; } # get the CERTIFICATE INFORMATION $obj = getCertInfo($cert); if(ref($obj)){ print "Cert information: "; print "ISSUER: ".$obj->{'issuer'}," "; print "SUBJECT: ".$obj->{'subject'}," "; print "SERIAL: ".$obj->{'serial'}," "; print "STARTDATE: ".$obj->{'startdate'}," "; print "ENDDATE: ".$obj->{'enddate'}," "; print "EMAIL: ".$obj->{'v3_email'}," "; }else{ print "Error in getCertInfo: ".getErrStr()," " ; }This module is a simple interface with native function of openssl for SMIME manipulation. It can be work with compatible openssl hardware engines. At this time the module does not realize encription/description functions. Write to the author if you are interested. Requirements: · Perl


Crypt::SMimeEngine Related Software