Zephyr API Documentation 4.5.99
A Scalable Open Source RTOS
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
19#include <psa/crypto.h>
20
21#ifdef __cplusplus
22extern "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
65
94
114
131
153int tls_credential_keygen_csr(sec_tag_t tag, const char *subject, uint8_t *out, size_t out_size,
154 size_t *out_len);
155
177 size_t *out_len);
178
180
181#ifdef __cplusplus
182}
183#endif
184
185#endif /* ZEPHYR_INCLUDE_NET_TLS_CREDENTIALS_KEYGEN_H_ */
int tls_credential_keygen_delete(sec_tag_t tag)
Delete the device private key of a security tag.
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.
int tls_credential_keygen_generate(sec_tag_t tag, enum tls_credential_keygen_type type)
Generate a device private key for a security tag.
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
Type of the generated key pair.
Definition tls_credentials_keygen.h:59
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
ECDSA key on the secp256r1 (P-256) curve.
Definition tls_credentials_keygen.h:61
@ TLS_CREDENTIAL_KEYGEN_ECDSA_SECP384R1
ECDSA key on the secp384r1 (P-384) curve.
Definition tls_credentials_keygen.h:63
int sec_tag_t
Secure tag, a reference to TLS credential.
Definition tls_credentials.h:99
uint32_t psa_key_id_t
Definition key_ids.h:25
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
TLS credentials management.