NAME

Crypt::JWS::OpenSSL::Util::PEM - Utility to generate pem encoded keys.

VERSION

version 0.003

SYNOPSIS

use Crypt::JWS::OpenSSL::Util::PEM;

my $gen = Crypt::JWS::OpenSSL::Util::PEM->new;

my( $private_rsa_pem, $public_rsa_pem ) = $gen->generate_rsa_key_pair(2048);

my( $private_ecc_pem, $public_ecc_pem ) = $gen->generate_ecc_key_pair('ES384');

DESCRIPTION

Generate pem encoded keys suitable for algorithms supported by Crypt::JWS::OpenSSL.

METHODS

generate_rsa_key_pair($bits)

Returns an array containing private and public keys. In a scalar context, returns a reference to the array.

The keys support signing using algorithms RS256, RS384, RS512, PS256, PS384 and PS512.

bits

Accepts bits in the range 1024 to 4096

generate_ecc_key_pair($algorithm)

Returns an array containing private and public keys. In a scalar context, returns a reference to the array.

The keys support signing using algorithms ES256, ES384 and ES512.

algorithm

Accepts an algorithm name to indicate the curve required. ES256, ES384 or ES512.

AUTHOR

Mark Dootson <mdootson@cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2026 by Mark Dootson

This library is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.