Author image Salvador Ortiz


Crypt::OpenSSL::Common - Common services from the OpenSSL libraries.


    use Crypt::OpenSSL::Foo;
    use Crypt::OpenSSL::Common;

    # Now use the functionality of Crypt::OpenSSL::Foo as usual.


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.


    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.



None of the following are exported by default.


Returns the loaded OpenSSL library version number.


Returns the OpenSSL library version used to build the module. It can be different to version above.


Returns the numeric code of the last error generated by an OpenSSL's API call.


Returns a human readable string from the error code code.


This module provides some methods that I consider missing from other modules of the family.


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.


Salvador Ortiz <>


perl(1), ssl(3), err(3ssl)