1RS256_PK_NEW(3)          BSD Library Functions Manual          RS256_PK_NEW(3)
2

NAME

4     rs256_pk_new, rs256_pk_free, rs256_pk_from_RSA, rs256_pk_from_EVP_PKEY,
5     rs256_pk_from_ptr, rs256_pk_to_EVP_PKEY — FIDO2 COSE RS256 API
6

SYNOPSIS

8     #include <openssl/rsa.h>
9     #include <fido/rs256.h>
10
11     rs256_pk_t *
12     rs256_pk_new(void);
13
14     void
15     rs256_pk_free(rs256_pk_t **pkp);
16
17     int
18     rs256_pk_from_EVP_PKEY(rs256_pk_t *pk, const EVP_PKEY *pkey);
19
20     int
21     rs256_pk_from_RSA(rs256_pk_t *pk, const RSA *rsa);
22
23     int
24     rs256_pk_from_ptr(rs256_pk_t *pk, const void *ptr, size_t len);
25
26     EVP_PKEY *
27     rs256_pk_to_EVP_PKEY(const rs256_pk_t *pk);
28

DESCRIPTION

30     RS256 is the name given in the CBOR Object Signing and Encryption (COSE)
31     RFC to PKCS#1.5 2048-bit RSA with SHA-256.  The COSE RS256 API of
32     libfido2 is an auxiliary API with routines to convert between the differ‐
33     ent RSA public key types used in libfido2 and OpenSSL.
34
35     In libfido2, RS256 public keys are abstracted by the rs256_pk_t type.
36
37     The rs256_pk_new() function returns a pointer to a newly allocated, empty
38     rs256_pk_t type.  If memory cannot be allocated, NULL is returned.
39
40     The rs256_pk_free() function releases the memory backing *pkp, where *pkp
41     must have been previously allocated by rs256_pk_new().  On return, *pkp
42     is set to NULL.  Either pkp or *pkp may be NULL, in which case
43     rs256_pk_free() is a NOP.
44
45     The rs256_pk_from_EVP_PKEY() function fills pk with the contents of pkey.
46     No references to pkey are kept.
47
48     The rs256_pk_from_RSA() function fills pk with the contents of rsa.  No
49     references to rsa are kept.
50
51     The rs256_pk_from_ptr() function fills pk with the contents of ptr, where
52     ptr points to len bytes.  No references to ptr are kept.
53
54     The rs256_pk_to_EVP_PKEY() function converts pk to a newly allocated
55     EVP_PKEY type with a reference count of 1.  No internal references to the
56     returned pointer are kept.  If an error occurs, rs256_pk_to_EVP_PKEY()
57     returns NULL.
58

RETURN VALUES

60     The rs256_pk_from_EVP_PKEY(), rs256_pk_from_RSA(), and
61     rs256_pk_from_ptr() functions return FIDO_OK on success.  On error, a
62     different error code defined in <fido/err.h> is returned.
63

SEE ALSO

65     eddsa_pk_new(3), es256_pk_new(3), fido_assert_verify(3),
66     fido_cred_pubkey_ptr(3)
67
68BSD                              May 24, 2018                              BSD
Impressum