NAME
Web::Authn::COSE - COSE algorithm, key-type and curve constants
SYNOPSIS
use Web::Authn::COSE qw(EDDSA ECDSA_SHA_256 RSASSA_PKCS1_SHA_256);
my $authn = Web::Authn->new( rp_id => 'example.com', rp_name => 'Ex' );
$authn->generate_registration_options(
user_name => 'bob',
supported_pub_key_algs => [ EDDSA, ECDSA_SHA_256 ],
);
DESCRIPTION
IANA COSE / WebAuthn numeric identifiers. Export constants explicitly or call them as Web::Authn::COSE::NAME.
CONSTANTS
Algorithms: ECDSA_SHA_256 (-7), EDDSA (-8), ECDSA_SHA_384 (-35), ECDSA_SHA_512 (-36), RSASSA_PSS_SHA_256 (-37), RSASSA_PSS_SHA_384 (-38), RSASSA_PSS_SHA_512 (-39), RSASSA_PKCS1_SHA_256 (-257), RSASSA_PKCS1_SHA_384 (-258), RSASSA_PKCS1_SHA_512 (-259), RSASSA_PKCS1_SHA_1 (-65535), ML_DSA_44 (-48), ML_DSA_65 (-49), ML_DSA_87 (-50).
Key types: KTY_OKP (1), KTY_EC2 (2), KTY_RSA (3), KTY_ML_DSA (7).
Curves: CRV_P256 (1), CRV_P384 (2), CRV_P521 (3), CRV_ED25519 (6).
COSE key labels: KEY_KTY (1), KEY_ALG (3), KEY_CRV (-1), KEY_X (-2), KEY_Y (-3). RSA uses KEY_N/KEY_E at the same negative labels; ML-DSA uses KEY_PUB at -1.
FUNCTIONS
alg_hash_name
my $name = Web::Authn::COSE::alg_hash_name( -7 ); # SHA256
Maps a COSE algorithm identifier to the CryptX / Digest hash name used to verify signatures. Pass an integer such as -7 (ES256). The function returns undef when the identifier is not a hash-based algorithm known to this module.
curve_name
my $nist = Web::Authn::COSE::curve_name( 1 ); # secp256r1
Maps a COSE elliptic-curve identifier to the CryptX curve name. Pass an integer: 1 is P-256, 2 is P-384, 3 is P-521. The function returns undef for unknown curves, including Ed25519, which CryptX loads as Crypt::PK::Ed25519 instead.
default_supported_algs
my @algs = Web::Authn::COSE::default_supported_algs();
# (-8, -7, -257)
Returns the default list of COSE algorithm identifiers offered in registration options: EdDSA, ES256, and RS256. This function takes no arguments.
is_ecdsa
if( Web::Authn::COSE::is_ecdsa( $alg ) ) { ... }
Returns true when the COSE algorithm identifier you pass is ES256, ES384 or ES512.
is_rsa_pkcs
if( Web::Authn::COSE::is_rsa_pkcs( $alg ) ) { ... }
Returns true when the COSE algorithm identifier you pass is RS1, RS256, RS384 or RS512 (PKCS#1 v1.5).
is_rsa_pss
if( Web::Authn::COSE::is_rsa_pss( $alg ) ) { ... }
Returns true when the COSE algorithm identifier you pass is PS256, PS384 or PS512.
THREAD & PROCESS SAFETY
This module is designed to be fully thread-safe and process-safe, ensuring data integrity across Perl ithreads and mod_perl’s threaded Multi-Processing Modules (MPMs) such as Worker or Event.
AUTHOR
Jacques Deguest <jack@deguest.jp>
SEE ALSO
https://www.iana.org/assignments/cose/cose.xhtml, Web::Authn
COPYRIGHT & LICENSE
Copyright(c) 2026 DEGUEST Pte. Ltd.
All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.