Zephyr API
4.4.99
A Scalable Open Source RTOS
Toggle main menu visibility
Loading...
Searching...
No Matches
tls_credentials_keygen.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2026 Nordic Semiconductor ASA
3
*
4
* SPDX-License-Identifier: Apache-2.0
5
*/
6
11
12
#ifndef ZEPHYR_INCLUDE_NET_TLS_CREDENTIALS_KEYGEN_H_
13
#define ZEPHYR_INCLUDE_NET_TLS_CREDENTIALS_KEYGEN_H_
14
15
#include <stddef.h>
16
#include <
stdint.h
>
17
18
#include <
zephyr/net/tls_credentials.h
>
19
#include <psa/crypto.h>
20
21
#ifdef __cplusplus
22
extern
"C"
{
23
#endif
24
33
35
#define TLS_CREDENTIAL_KEYGEN_PUBKEY_MAX_SIZE 120
36
42
/* Largest P-384 CSR without the subject:
43
*
44
* Part Bytes
45
* CSR, request info and subject headers (4 each) 12
46
* Version 3
47
* SubjectPublicKeyInfo 120
48
* Empty attributes 2
49
* Signature algorithm 12
50
* Signature BIT STRING (DER ECDSA <= 104, + 3) 107
51
* Total 256
52
*
53
* Per character: "R=a" (emailAddress, 9-byte OID) is 18 bytes for 3 characters, the most of any
54
* attribute. Empty values are rejected.
55
*/
56
#define TLS_CREDENTIAL_KEYGEN_CSR_SIZE(subject_len) (256 + 6 * (subject_len))
57
59
enum
tls_credential_keygen_type
{
61
TLS_CREDENTIAL_KEYGEN_ECDSA_SECP256R1
,
63
TLS_CREDENTIAL_KEYGEN_ECDSA_SECP384R1
,
64
};
65
93
int
tls_credential_keygen_generate
(
sec_tag_t
tag,
enum
tls_credential_keygen_type
type);
94
113
int
tls_credential_keygen_delete
(
sec_tag_t
tag);
114
130
int
tls_credential_keygen_key_id_get
(
sec_tag_t
tag,
psa_key_id_t
*key_id);
131
153
int
tls_credential_keygen_csr
(
sec_tag_t
tag,
const
char
*subject,
uint8_t
*out,
size_t
out_size,
154
size_t
*out_len);
155
176
int
tls_credential_keygen_pubkey_get
(
sec_tag_t
tag,
uint8_t
*out,
size_t
out_size,
177
size_t
*out_len);
178
180
181
#ifdef __cplusplus
182
}
183
#endif
184
185
#endif
/* ZEPHYR_INCLUDE_NET_TLS_CREDENTIALS_KEYGEN_H_ */
tls_credential_keygen_delete
int tls_credential_keygen_delete(sec_tag_t tag)
Delete the device private key of a security tag.
tls_credential_keygen_csr
int tls_credential_keygen_csr(sec_tag_t tag, const char *subject, uint8_t *out, size_t out_size, size_t *out_len)
Generate a Certificate Signing Request (CSR) for the device private key.
tls_credential_keygen_generate
int tls_credential_keygen_generate(sec_tag_t tag, enum tls_credential_keygen_type type)
Generate a device private key for a security tag.
tls_credential_keygen_key_id_get
int tls_credential_keygen_key_id_get(sec_tag_t tag, psa_key_id_t *key_id)
Get the PSA key ID of the device private key of a security tag.
tls_credential_keygen_type
tls_credential_keygen_type
Type of the generated key pair.
Definition
tls_credentials_keygen.h:59
tls_credential_keygen_pubkey_get
int tls_credential_keygen_pubkey_get(sec_tag_t tag, uint8_t *out, size_t out_size, size_t *out_len)
Export the public key of the device key pair.
TLS_CREDENTIAL_KEYGEN_ECDSA_SECP256R1
@ TLS_CREDENTIAL_KEYGEN_ECDSA_SECP256R1
ECDSA key on the secp256r1 (P-256) curve.
Definition
tls_credentials_keygen.h:61
TLS_CREDENTIAL_KEYGEN_ECDSA_SECP384R1
@ TLS_CREDENTIAL_KEYGEN_ECDSA_SECP384R1
ECDSA key on the secp384r1 (P-384) curve.
Definition
tls_credentials_keygen.h:63
sec_tag_t
int sec_tag_t
Secure tag, a reference to TLS credential.
Definition
tls_credentials.h:90
psa_key_id_t
uint32_t psa_key_id_t
Definition
key_ids.h:25
stdint.h
uint8_t
__UINT8_TYPE__ uint8_t
Definition
stdint.h:88
tls_credentials.h
TLS credentials management.
zephyr
net
tls_credentials_keygen.h
Generated on
for Zephyr API by
1.17.0