NAME
Crypt::OpenSSL::Common - Common services from the OpenSSL libraries.
SYNOPSIS
use Crypt::OpenSSL::Foo;
use Crypt::OpenSSL::Common;
# Now use the functionality of Crypt::OpenSSL::Foo as usual.
INTRODUCTION
There are in CPAN a lot of modules that provides bindings to many parts of the OpenSSL libraries. Among them:
Crypt::OpenSSL::RSA OpenSSL's RSA API
Crypt::OpenSSL::X509 OpenSSL's X509 API
Crypt::OpenSSL::PKCS10 PKCS#10 creation and handling
Crypt::OpenSSL::Bignum Multiprecision integer arithmetic (OpenSSL "bn" library)
But the OpenSSL libraries provides a few common functions that are global in nature, for example, all the ERR_*
handling functions or the SSL_library_init
function.
The main purpose of this module is to provides perl bindings to all those functions.
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 encrypted private keys in the same way the C API does, ie. prompting the user for the pass phrase used to protect the private key.
This initialization can't be properly done in any one of the individual modules.
INTERFACE
Functions
None of the following are exported by default.
- version()
-
Returns the loaded OpenSSL library version number.
- version_atbuild()
-
Returns the OpenSSL library version used to build the module. It can be different to version above.
- get_error()
-
Returns the numeric code of the last error generated by an OpenSSL's API call.
- error_string(code)
-
Returns a human readable string from the error code code.
Extentions
This module provides some methods that I consider missing from other modules of the family.
- Crypt::OpenSSL::RSA->new_from_file($filename)
-
Returns a new Crypt::OpenSSL::RSA object from the PEM encoded file $filename.
If you maintains any of the modules mentioned, fell free to adopt de missing functionality and when doing so, please drop me a note.
AUTHOR
Salvador Ortiz <sortiz@cpan.org>