table of contents
| ES256_PK_NEW(3) | Library Functions Manual | ES256_PK_NEW(3) |
NAME¶
es256_pk_new,es256_pk_free,es256_pk_from_EC_KEY,es256_pk_from_EVP_PKEY,es256_pk_from_ptr,es256_pk_to_EVP_PKEY—FIDO2
COSE ES256 API
SYNOPSIS¶
#include<openssl/ec.h>
#include<fido/es256.h>
es256_pk_t*
es256_pk_new(void);
void
es256_pk_free(es256_pk_t
**pkp);
int
es256_pk_from_EC_KEY(es256_pk_t
*pk,const EC_KEY
*ec);
int
es256_pk_from_EVP_PKEY(es256_pk_t
*pk,const EVP_PKEY
*pkey);
int
es256_pk_from_ptr(es256_pk_t
*pk,const void
*ptr,size_t
len);
EVP_PKEY*
es256_pk_to_EVP_PKEY(const
es256_pk_t *pk);
DESCRIPTION¶
ES256 is the name given in the CBOR Object Signing and Encryption(COSE) RFC to ECDSA over P-256 with SHA-256.The COSE ES256 API oflibfido2is an auxiliary API with routines to convert between the differentECDSA public key types used inlibfido2andOpenSSL.
Inlibfido2,ES256 public keys are abstracted by thees256_pk_ttype.
Thees256_pk_new()function
returns a pointer to a newly allocated,
emptyes256_pk_ttype.If memory cannot be allocated,
NULL is returned.
Thees256_pk_free()function
releases the memory
backing*pkp,where*pkpmust have
been previously allocated byes256_pk_new().On
return,*pkpis set to
NULL.Eitherpkpor*pkpmay be NULL,
in which casees256_pk_free()is a NOP.
Thees256_pk_from_EC_KEY()function
fillspkwith the contents ofec.No
references toecare kept.
Thees256_pk_from_EVP_PKEY()function
fillspkwith the contents
ofpkey.No references topkeyare
kept.
Thees256_pk_from_ptr()function
fillspkwith the contents
ofptr,whereptrpoints
tolenbytes.Theptrpointer may
point to an uncompressed point, or to theconcatenation of the x and y
coordinates.No references toptrare kept.
Thees256_pk_to_EVP_PKEY()function
convertspkto a newly
allocatedEVP_PKEYtype with a reference count of 1.No
internal references to the returned pointer are kept.If an error
occurs,es256_pk_to_EVP_PKEY()returns NULL.
RETURN VALUES¶
Thees256_pk_from_EC_KEY(),es256_pk_from_EVP_PKEY(),andes256_pk_from_ptr()functions
returnFIDO_OKon success.On error, a different error
code defined
in<fido/err.h>is
returned.
SEE ALSO¶
eddsa_pk_new(3),es384_pk_new(3),fido_assert_verify(3),fido_cred_pubkey_ptr(3),rs256_pk_new(3)
| July 15, 2022 | Nixpkgs |