Crypt-OpenSSL-Common

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

functionality of the OpenSSL libraries.

It complements the other modules in the Crypt::OpenSSL::* hierarchy in many ways:
providing proper OpenSSL initialization, access to extended error information, etc.

For example:

    use Crypt::OpenSSL::RSA;
    use Crypt::OpenSSL::Common;

    my $private = Crypt::OpenSSL::RSA->new_private_key($pem_encrypted_key);

With out Crypt::OpenSSL::Common, the C::O::RSA's new_private_key method can't
handle encrypted keys. Now it can handle them.

INSTALLATION

To install this module type the following:

   perl Makefile.PL
   make
   make test
   make install

lib/Crypt/OpenSSL/Common.pm  view on Meta::CPAN

sub import {
    load_crypto_strings();
    Exporter::export_to_level(__PACKAGE__, 1, @_);
}

# A missing C::O::RSA method
sub Crypt::OpenSSL::RSA::new_from_file {
    my($proto, $file) = @_;
    open(my $pkfh, '<', $file) or die "Can't open key file: $!\n";
    local $/ = undef;
    return $proto->new_private_key(<$pkfh>);
}

require XSLoader;
XSLoader::load('Crypt::OpenSSL::Common', $VERSION);

1;
__END__

=head1 NAME

lib/Crypt/OpenSSL/Common.pm  view on Meta::CPAN

=head1 DESCRIPTION

    use Crypt::OpenSSL::Common;
    # now 'use' other OpenSSL modules

The first time that your program uses this module, the OpenSSL is properly initialized.
This initialization loads from the library all the available cryptographic algorithms.

The main visible effect is that some other APIs can now automatically recognize them.

For example, the Crypt::OpenSSL::RSA's new_private_key class method now can handle
I<encrypted> private keys in the same way the C API does, ie. prompting the user for
the I<pass phrase> used to protect the private key.

This initialization can't be properly done in any one of the individual modules.

=head1 INTERFACE

=head2 Functions

None of the following are exported by default.



( run in 1.499 second using v1.01-cache-2.11-cpan-a5abf4f5562 )