1ES256_PK_NEW(3) BSD Library Functions Manual ES256_PK_NEW(3)
2
4 es256_pk_new, es256_pk_free, es256_pk_from_EC_KEY,
5 es256_pk_from_EVP_PKEY, es256_pk_from_ptr, es256_pk_to_EVP_PKEY — FIDO2
6 COSE ES256 API
7
9 #include <openssl/ec.h>
10 #include <fido/es256.h>
11
12 es256_pk_t *
13 es256_pk_new(void);
14
15 void
16 es256_pk_free(es256_pk_t **pkp);
17
18 int
19 es256_pk_from_EC_KEY(es256_pk_t *pk, const EC_KEY *ec);
20
21 int
22 es256_pk_from_EVP_PKEY(es256_pk_t *pk, const EVP_PKEY *pkey);
23
24 int
25 es256_pk_from_ptr(es256_pk_t *pk, const void *ptr, size_t len);
26
27 EVP_PKEY *
28 es256_pk_to_EVP_PKEY(const es256_pk_t *pk);
29
31 ES256 is the name given in the CBOR Object Signing and Encryption (COSE)
32 RFC to ECDSA over P-256 with SHA-256. The COSE ES256 API of libfido2 is
33 an auxiliary API with routines to convert between the different ECDSA
34 public key types used in libfido2 and OpenSSL.
35
36 In libfido2, ES256 public keys are abstracted by the es256_pk_t type.
37
38 The es256_pk_new() function returns a pointer to a newly allocated, empty
39 es256_pk_t type. If memory cannot be allocated, NULL is returned.
40
41 The es256_pk_free() function releases the memory backing *pkp, where *pkp
42 must have been previously allocated by es256_pk_new(). On return, *pkp
43 is set to NULL. Either pkp or *pkp may be NULL, in which case
44 es256_pk_free() is a NOP.
45
46 The es256_pk_from_EC_KEY() function fills pk with the contents of ec. No
47 references to ec are kept.
48
49 The es256_pk_from_EVP_PKEY() function fills pk with the contents of pkey.
50 No references to pkey are kept.
51
52 The es256_pk_from_ptr() function fills pk with the contents of ptr, where
53 ptr points to len bytes. The ptr pointer may point to an uncompressed
54 point, or to the concatenation of the x and y coordinates. No references
55 to ptr are kept.
56
57 The es256_pk_to_EVP_PKEY() function converts pk to a newly allocated
58 EVP_PKEY type with a reference count of 1. No internal references to the
59 returned pointer are kept. If an error occurs, es256_pk_to_EVP_PKEY()
60 returns NULL.
61
63 The es256_pk_from_EC_KEY(), es256_pk_from_EVP_PKEY(), and
64 es256_pk_from_ptr() functions return FIDO_OK on success. On error, a
65 different error code defined in <fido/err.h> is returned.
66
68 eddsa_pk_new(3), es384_pk_new(3), fido_assert_verify(3),
69 fido_cred_pubkey_ptr(3), rs256_pk_new(3)
70
71BSD July 15, 2022 BSD