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_KEY_EXCHANGE_RSA_ENABLED
24
25config JWT_SIGN_RSA_PSA
26	bool "Use RSA signature (RS-256). Use PSA Crypto API."
27	select MBEDTLS if !BUILD_WITH_TFM
28	select MBEDTLS_PSA_CRYPTO_C if !BUILD_WITH_TFM
29	select PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY
30	select PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_IMPORT
31	select PSA_WANT_ALG_RSA_PKCS1V15_SIGN
32	select PSA_WANT_ALG_SHA_256
33
34config JWT_SIGN_ECDSA_PSA
35	bool "Use ECDSA signature (ES-256). Use PSA Crypto API."
36	select MBEDTLS if !BUILD_WITH_TFM
37	select MBEDTLS_PSA_CRYPTO_C if !BUILD_WITH_TFM
38	select PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_IMPORT
39	select PSA_WANT_ALG_ECDSA
40	select PSA_WANT_ECC_SECP_R1_256
41	select PSA_WANT_ALG_SHA_256
42
43endchoice
44
45endif # JWT
46