1.. zephyr:code-sample:: persistent_key
2   :name: PSA Crypto persistent key
3
4   Manage and use persistent keys via the PSA Crypto API.
5
6Overview
7********
8
9This sample demonstrates usage of persistent keys in the :ref:`PSA Crypto API <psa_crypto>`.
10
11Requirements
12************
13
14In addition to the PSA Crypto API, an implementation of the
15`PSA Internal Trusted Storage (ITS) API <https://arm-software.github.io/psa-api/storage/1.0/overview/architecture.html#the-internal-trusted-storage-api>`_
16(for storage of the persistent keys) must be present for this sample to work.
17It can be provided by:
18
19* :ref:`tfm`, for ``*/ns`` :term:`board targets<board target>`.
20* The :ref:`secure storage subsystem <secure_storage>`, for the other board targets.
21
22Building
23********
24
25This sample is located in :zephyr_file:`samples/psa/persistent_key`.
26
27Different configurations are defined in the :file:`sample.yaml` file.
28You can use them to build the sample, depending on the PSA ITS provider, as follows:
29
30.. tabs::
31
32   .. tab:: TF-M
33
34     For board targets with TF-M:
35
36      .. zephyr-app-commands::
37         :zephyr-app: samples/psa/persistent_key
38         :tool: west
39         :goals: build
40         :board: <ns_board_target>
41         :west-args: -T sample.psa.persistent_key.tfm
42
43   .. tab:: secure storage subsystem
44
45      For board targets without TF-M.
46
47      If the board target to compile for has an entropy driver (preferable):
48
49      .. zephyr-app-commands::
50         :zephyr-app: samples/psa/persistent_key
51         :tool: west
52         :goals: build
53         :board: <board_target>
54         :west-args: -T sample.psa.persistent_key.secure_storage.entropy_driver
55
56      Or, to use an insecure entropy source (only for testing):
57
58      .. zephyr-app-commands::
59         :zephyr-app: samples/psa/persistent_key
60         :tool: west
61         :goals: build
62         :board: <board_target>
63         :west-args: -T sample.psa.persistent_key.secure_storage.entropy_not_secure
64
65To flash it, see :ref:`west-flashing`.
66
67API reference
68*************
69
70`PSA Crypto key management API reference <https://arm-software.github.io/psa-api/crypto/1.2/api/keys/index.html>`_
71