The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

WWW::LetsEncrypt::JWA

SYNOPSIS

use Moose;

with qw(WWW::LetsEncrypt::JWA ...)

sub sign { my ($self, $message) = @_; ... return ...; }

sub _set_hash { ... }

DESCRIPTION

This is a role that when used together with WWW::LetsEncrypt::JWK as parents will create a JSON Web Key that implements all the functions needed for signing JSON Web Signature objects.

Attributes

'alg' a scalar attribute meant to hold the algorithm that will be used for signing, as defined in the JWA RFC.

Currently allowed algorithms: ES256, ES384, ES512, RS256, RS384, RS512,

Public Functions

sign($message)

Abstract object function that takes an argument and signs it based off of the internal configuration of the JWA subclass.

Input

        $self    - Object Reference
        $message - scalar string of what needs to be signed

Output

        scalar octets representing the signature of the message.

Private Functions

_set_hash($hash)

Abstract object function that takes a number argument, which is used to determine which SHA2 algorithm will be used for hashing.

Implementers should permit values of (256, 384, 512). All other values should throw an error.

Input

        $self - Object Reference
        $hash - numerical value

Output

        boolean if setting the value was successful
_verify_alg($alg)

Trigger function that is called after the 'alg' parameter has been set. Assuming an accept algorithm was used, this function calls $self->_set_hash with the SHA2 hashing algorithm selected.