NAME

IO::Socket::SSL::Utils -- loading, storing, creating certificates and keys

SYNOPSIS

use IO::Socket::SSL::Utils; $cert = PEM_file2cert(cert.pem); # load certificate from file my $hash = CERT_asHash($cert); # get details from certificate PEM_cert2file($cert,cert.pem); # write certificate to file CERT_free($cert); # free memory within OpenSSL @certs = PEM_file2certs(chain.pem); # load multiple certificates from file PEM_certs2file(chain.pem, @certs); # write multiple certificates to file CERT_free(@certs); # free memory for all within OpenSSL my $cert = PEM_string2cert($pem); # load certificate from PEM string $pem = PEM_cert2string($cert); # convert certificate to PEM string $key = KEY_create_rsa(2048); # create new 2048-bit RSA key PEM_key2file($key,"key.pem"); # and write it to file KEY_free($key); # free memory within OpenSSL

DESCRIPTION

This module provides various utility functions to work with certificates and private keys, shielding some of the complexity of the underlying Net::SSLeay and OpenSSL.

FUNCTIONS

Functions for cleaning up. Each loaded or created cert and key must be freed to not leak memory.

CERT_free(@certs)
KEY_free(@keys)

KEY_create_rsa(bits) -> key Creates an RSA key pair, bits defaults to 2048.

AUTHOR

Steffen Ullrich