1# Copyright (c) 2018 Linaro
2# Copyright (c) 2024 BayLibre SAS
3# SPDX-License-Identifier: Apache-2.0
4
5menuconfig JWT
6	bool "JSON Web Token generation"
7	select JSON_LIBRARY
8	help
9	  Enable creation of JWT tokens
10
11if JWT
12
13choice
14	prompt "JWT signature algorithm"
15	default JWT_SIGN_RSA_PSA
16	help
17	  Select which algorithm to use for signing JWT tokens.
18
19config JWT_SIGN_RSA_LEGACY
20	bool "Use RSA signature (RS-256). Use Mbed TLS as crypto library."
21	depends on CSPRNG_AVAILABLE
22	select MBEDTLS
23	select MBEDTLS_MD
24	select MBEDTLS_RSA_C
25	select MBEDTLS_PKCS1_V15
26	select MBEDTLS_PKCS1_V21
27	select MBEDTLS_KEY_EXCHANGE_RSA_ENABLED
28
29config JWT_SIGN_RSA_PSA
30	bool "Use RSA signature (RS-256). Use PSA Crypto API."
31	select MBEDTLS if !BUILD_WITH_TFM
32	select MBEDTLS_PSA_CRYPTO_C if !BUILD_WITH_TFM
33	select PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY
34	select PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_IMPORT
35	select PSA_WANT_ALG_RSA_PKCS1V15_SIGN
36	select PSA_WANT_ALG_SHA_256
37
38config JWT_SIGN_ECDSA_PSA
39	bool "Use ECDSA signature (ES-256). Use PSA Crypto API."
40	select MBEDTLS if !BUILD_WITH_TFM
41	select MBEDTLS_PSA_CRYPTO_C if !BUILD_WITH_TFM
42	select PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_IMPORT
43	select PSA_WANT_ALG_ECDSA
44	select PSA_WANT_ECC_SECP_R1_256
45	select PSA_WANT_ALG_SHA_256
46
47endchoice
48
49endif # JWT
50