ES256_PK_NEW(3)
π ES256_PK_NEW π
okay bestie, welcome to section 3 of the manual β Library Functions Manual energy β and today we're talking about ES256_PK_NEW(3). yes this is a whole family of functions under one page name, it's giving ensemble cast π«Ά
β¨ 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 β the FIDO2 COSE ES256 API, no cap π
πΈ 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 π¦
so ES256 is literally the name the CBOR Object Signing and Encryption (COSE) RFC gave to ECDSA over P-256 with SHA-256. periodt. and the COSE ES256 API in libfido2 is this lil auxiliary API β a side-quest, if you will β with routines that convert between the different ECDSA public key types floating around in libfido2 and OpenSSL. it's the translator bestie of the group chat π₯
in libfido2, ES256 public keys are abstracted by the es256_pk_t type. that's the moment, that's the icon, that's the main character π
es256_pk_new() β returns a pointer to a newly allocated, empty es256_pk_t type. if memory cannot be allocated, NULL is returned. that's it, that's the whole vibe β¨
es256_pk_free() β releases the memory backing *pkp, where *pkp must have been previously allocated by es256_pk_new(). on return, *pkp is set to NULL. and here's the cute part: either pkp or *pkp may be NULL, in which case es256_pk_free() is a NOP. it's just chill like that π
es256_pk_from_EC_KEY() β fills pk with the contents of ec. no references to ec are kept. nope, none, zero, ghosted π
es256_pk_from_EVP_PKEY() β fills pk with the contents of pkey. no references to pkey are kept either. we copy and we move on π
es256_pk_from_ptr() β fills pk with the contents of ptr, where ptr points to len bytes. now ptr may point to an uncompressed point, or to the concatenation of the x and y coordinates β dealer's choice, both slay. no references to ptr are kept.
es256_pk_to_EVP_PKEY() β converts pk to a newly allocated EVP_PKEY type 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 β
es256_pk_from_EC_KEY(), es256_pk_from_EVP_PKEY(), and es256_pk_from_ptr() return FIDO_OK on success. π on error, a different error code defined in <fido/err.h> is returned. so like, check your codes bestie, don't just assume π
π SEE ALSO π
and that's the whole page, you ate it, i'm obsessed π this one came from the Debian crew and it's dated July 15, 2022 β so it's vintage, it's iconic, it's the moment. go forth and convert those keys, bestie ππ§
π¦ where this page comes from
- alpine 3.22: libfido2-doc 1.16.0-r0 Β· BSD-2-Clause
- alpine 3.23: libfido2-doc 1.16.0-r2 Β· BSD-2-Clause
- alpine 3.24: libfido2-doc 1.16.0-r4 Β· BSD-2-Clause
- arch rolling: libfido2 1.17.0-1 Β· BSD-2-Clause
- centos-stream 10: libfido2-devel 1.14.0-7.el10 Β· BSD-2-Clause
- centos-stream 9: libfido2-devel 1.13.0-2.el9 Β· BSD
- centos-stream 9: libfido2-devel 1.13.0-2.el9 Β· BSD
- debian bookworm: libfido2-doc 1.12.0-2 Β· BSD-2-Clause
- debian trixie: libfido2-doc 1.15.0-1 Β· BSD-2-Clause
- fedora 43: libfido2-devel 1.16.0-3.fc43 Β· BSD-2-Clause
- fedora 43: libfido2-devel 1.16.0-3.fc43 Β· BSD-2-Clause
- fedora 44: libfido2-devel 1.16.0-5.fc44 Β· BSD-2-Clause
- fedora 44: libfido2-devel 1.16.0-5.fc44 Β· BSD-2-Clause
- nixos 26.05: fido2-manage 0-unstable-2025-06-06
- nixpkgs unstable: fido2-manage 0-unstable-2025-06-06
- nixpkgs unstable: libfido2 1.17.0
- opensuse-leap 16.0: libfido2-devel 1.15.0-160000.3.2 Β· BSD-2-Clause
- opensuse-leap 16.0: libfido2-devel 1.15.0-160000.3.2 Β· BSD-2-Clause
- opensuse-leap 16.0: libfido2-devel 1.15.0-160000.3.2 Β· BSD-2-Clause
- opensuse-leap 16.0: libfido2-devel 1.15.0-160000.3.2 Β· BSD-2-Clause
- ubuntu noble: libfido2-doc 1.14.0-1build3 Β· BSD-2-Clause
- ubuntu questing: libfido2-doc 1.16.0-2
- ubuntu resolute: libfido2-doc 1.16.0-2build1 Β· BSD-2-Clause
- ubuntu stonking: libfido2-doc 1.17.0-2build1 Β· BSD-2-Clause
- π the page's license: BSD-2-Clause
- Copyright (c) 2018-2022 Yubico AB. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms