RS256_PK_NEW(3)
π RS256_PK_NEW π
okay bestie, gather round, because we're about to talk about rs256_pk_new(3) β that's the manual page name, and the manual itself is the Library Functions Manual. yes it's giving "niche cryptography" but trust me, it's lowkey iconic once you get it. π
β¨ NAME β¨
rs256_pk_new, rs256_pk_free, rs256_pk_from_RSA, rs256_pk_from_EVP_PKEY, rs256_pk_from_ptr, rs256_pk_to_EVP_PKEY β the FIDO2 COSE RS256 API, aka your little conversion station between RSA public key types π¦
πΈ SYNOPSIS πΈ
#include <openssl/rsa.h>
#include <fido/rs256.h>
rs256_pk_t *
rs256_pk_new(void);
void
rs256_pk_free(rs256_pk_t **pkp);
int
rs256_pk_from_EVP_PKEY(rs256_pk_t *pk, const EVP_PKEY *pkey);
int
rs256_pk_from_RSA(rs256_pk_t *pk, const RSA *rsa);
int
rs256_pk_from_ptr(rs256_pk_t *pk, const void *ptr, size_t len);
EVP_PKEY *
rs256_pk_to_EVP_PKEY(const rs256_pk_t *pk);
no cap, that's the whole lineup π
π DESCRIPTION π
okay so first things first: RS256 is the name that the CBOR Object Signing and Encryption (COSE) RFC gives to PKCS#1.5 2048-bit RSA with SHA-256. yes, that's a mouthful, and yes, it ate. π₯
The COSE RS256 API of libfido2 is an auxiliary API β think of it as the little side quest with routines that convert between the different RSA public key types used in libfido2 and OpenSSL. it's giving "translator friend who speaks both languages." π
In libfido2, RS256 public keys are abstracted by the rs256_pk_t type. that's the main character of this whole page, periodt. π
rs256_pk_new()β returns a pointer to a newly allocated, emptyrs256_pk_ttype. if memory cannot be allocated,NULLis returned. (sad girl moment, but that's the deal.) πrs256_pk_free()β releases the memory backing*pkp, where*pkpmust have been previously allocated byrs256_pk_new(). on return,*pkpis set toNULL. eitherpkpor*pkpmay beNULL, and in that casers256_pk_free()is a NOP. so it just... does nothing. chillest function ever. π§rs256_pk_from_EVP_PKEY()β fillspkwith the contents ofpkey. no references topkeyare kept. π«Άrs256_pk_from_RSA()β fillspkwith the contents ofrsa. no references torsaare kept. β¨rs256_pk_from_ptr()β fillspkwith the contents ofptr, whereptrpoints tolenbytes. no references toptrare kept. πΈrs256_pk_to_EVP_PKEY()β convertspkto a newly allocatedEVP_PKEYtype with a reference count of1. no internal references to the returned pointer are kept. if an error occurs,rs256_pk_to_EVP_PKEY()returnsNULL. π
heads up bestie: all those "no references are kept" lines are real and they matter β the API is not holding onto your stuff for you. π
β RETURN VALUES β
The rs256_pk_from_EVP_PKEY(), rs256_pk_from_RSA(), and rs256_pk_from_ptr() functions return FIDO_OK on success. slay. β
On error, a different error code defined in <fido/err.h> is returned. so if it's not FIDO_OK, go check that header, because the tea is in there. π
π¦ SEE ALSO π¦
go read the whole friend group, they're all connected, iykyk π«
Debian π July 15, 2022 β that's the source, the version vibe, and the date, all wrapped up like a little gift. mwah, that's the whole page bestie, you understood it perfectly, no cap. πβ¨π¦
π¦ 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