Skip to content

Conversation

@greg-fer
Copy link
Contributor

Updated the documentation of crypto samples.
Added sample output, cross-links to recently updated docs, more details in the overview sections.
Edited sample.yaml for term and style consistency. Future PRs will edit remaining crypto samples.
NCSDK-33435. Follow-up to #25032 and #25157.

@greg-fer greg-fer requested review from a team as code owners October 24, 2025 13:58
@NordicBuilder NordicBuilder added doc-required PR must not be merged without tech writer approval. changelog-entry-required Update changelog before merge. Remove label if entry is not needed or already added. labels Oct 24, 2025
@NordicBuilder
Copy link
Contributor

NordicBuilder commented Oct 24, 2025

CI Information

To view the history of this post, click the 'edited' button above
Build number: 2

Inputs:

Sources:

sdk-nrf: PR head: 9172a0ce14f9fa49806a6b2472534d3db8617d06

more details

sdk-nrf:

PR head: 9172a0ce14f9fa49806a6b2472534d3db8617d06
merge base: 4e54417757e1c380defe6bea9f9e0213b1ed3b38
target head (main): 9b25e68156335c2372bc6edd6b4a9206716f910b
Diff

Github labels

Enabled Name Description
ci-disabled Disable the ci execution
ci-all-test Run all of ci, no test spec filtering will be done
ci-force-downstream Force execution of downstream even if twister fails
ci-run-twister Force run twister
ci-run-zephyr-twister Force run zephyr twister
List of changed files detected by CI (38)
doc
│  ├── nrf
│  │  ├── security
│  │  │  ├── crypto
│  │  │  │  │ crypto_supported_features.rst
samples
│  ├── crypto
│  │  ├── aes_cbc
│  │  │  │ prj.conf
│  │  ├── aes_ccm
│  │  │  │ prj.conf
│  │  ├── aes_ctr
│  │  │  │ prj.conf
│  │  ├── aes_gcm
│  │  │  │ prj.conf
│  │  ├── chachapoly
│  │  │  │ prj.conf
│  │  ├── ecdh
│  │  │  │ prj.conf
│  │  ├── ecdsa
│  │  │  │ prj.conf
│  │  ├── ecjpake
│  │  │  ├── README.rst
│  │  │  ├── sample.yaml
│  │  │  ├── src
│  │  │  │  │ main.c
│  │  ├── eddsa
│  │  │  ├── README.rst
│  │  │  ├── prj.conf
│  │  │  ├── sample.yaml
│  │  │  ├── src
│  │  │  │  │ main.c
│  │  ├── hkdf
│  │  │  ├── README.rst
│  │  │  ├── prj.conf
│  │  │  ├── sample.yaml
│  │  │  ├── src
│  │  │  │  │ main.c
│  │  ├── hmac
│  │  │  ├── README.rst
│  │  │  ├── prj.conf
│  │  │  ├── sample.yaml
│  │  │  ├── src
│  │  │  │  │ main.c
│  │  ├── kmu_usage_nrf54l
│  │  │  │ prj.conf
│  │  ├── pbkdf2
│  │  │  ├── README.rst
│  │  │  ├── prj.conf
│  │  │  ├── sample.yaml
│  │  │  ├── src
│  │  │  │  │ main.c
│  │  ├── persistent_key_usage
│  │  │  ├── README.rst
│  │  │  ├── prj.conf
│  │  │  │ sample.yaml
│  │  ├── rng
│  │  │  ├── README.rst
│  │  │  ├── prj.conf
│  │  │  │ sample.yaml
│  │  ├── rsa
│  │  │  │ prj.conf
│  │  ├── sha256
│  │  │  │ prj.conf
│  │  ├── spake2p
│  │  │  │ prj.conf
tests
│  ├── psa_crypto
│  │  │ prj.conf

Outputs:

Toolchain

Version: cfa6b06338
Build docker image: docker-dtr.nordicsemi.no/sw-production/ncs-build:cfa6b06338_bba2ea5f2e

Test Spec & Results: ✅ Success; ❌ Failure; 🟠 Queued; 🟡 Progress; ◻️ Skipped; ⚠️ Quarantine

  • ◻️ Toolchain - Skipped: existing toolchain is used
  • ✅ Build twister
    • sdk-nrf test count: 4
  • ✅ Integration tests
    • ✅ test-fw-nrfconnect-nrf_crypto
    • ✅ test-secdom-samples-public
Disabled integration tests
    • test-fw-nrfconnect-nrf_lrcs_positioning
    • desktop52_verification
    • test-fw-nrfconnect-apps
    • test-fw-nrfconnect-ble_mesh
    • test-fw-nrfconnect-ble_samples
    • test-fw-nrfconnect-chip
    • test-fw-nrfconnect-fem
    • test-fw-nrfconnect-nfc
    • test-fw-nrfconnect-nrf-iot_cloud
    • test-fw-nrfconnect-nrf-iot_libmodem-nrf
    • test-fw-nrfconnect-nrf-iot_lwm2m
    • test-fw-nrfconnect-nrf-iot_samples
    • test-fw-nrfconnect-nrf-iot_serial_lte_modem
    • test-fw-nrfconnect-nrf-iot_thingy91
    • test-fw-nrfconnect-nrf-iot_zephyr_lwm2m
    • test-fw-nrfconnect-ps-main
    • test-fw-nrfconnect-rpc
    • test-fw-nrfconnect-rs
    • test-fw-nrfconnect-tfm
    • test-fw-nrfconnect-thread-main
    • test-low-level
    • test-sdk-audio
    • test-sdk-dfu
    • test-sdk-find-my
    • test-sdk-mcuboot

Note: This message is automatically posted and updated by the CI

- | :kconfig:option:`CONFIG_PSA_WANT_ALG_RSA_OAEP`
| :kconfig:option:`CONFIG_PSA_WANT_ALG_RSA_PKCS1V15_CRYPT` (does not support RSA key pair generation)
.. _crypto_supported_features_ecc_curve_types:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.. _crypto_supported_features_ecc_curve_types:
.. _ug_crypto_supported_features_ecc_curve_types:

To fix the doc build failure


1. Initialization:

a. The PSA Crypto API is initialized using :c:func:`psa_crypto_init`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
a. The PSA Crypto API is initialized using :c:func:`psa_crypto_init`.
a. The PSA Crypto API is initialized using the :c:func:`psa_crypto_init` function.

I'd suggest saying the ... function, at least for the first instance of a section or list.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is clear from the context: API, *_init.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is, but don't we usually use the phrase "... using the ... function" in most places?

CONFIG_NRF_SECURITY=y
CONFIG_MBEDTLS_PSA_CRYPTO_C=y

# Enable PSA Crypto APIs for the sample
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These KConfigs specify cryptographic features needed by application rather that enable PSA Crypto API.
PSA API is enabled by CONFIG_MBEDTLS_PSA_CRYPTO_C

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, I actually edited this towards what you say here before I read your comment :)

Updated the documentation of crypto samples.
Added sample output, cross-links to recently updated docs,
more details in the overview sections.
Edited sample.yaml for term and style consistency.
Future PRs will edit remaining crypto samples.
NCSDK-33435. Follow-up to nrfconnect#25032 and nrfconnect#25157.

Signed-off-by: Grzegorz Ferenc <[email protected]>
@greg-fer greg-fer force-pushed the doc_crypto_samples_part3 branch from 5962a96 to 9172a0c Compare October 27, 2025 08:46
@NordicBuilder NordicBuilder requested review from a team October 27, 2025 08:47
CONFIG_NRF_SECURITY=y
CONFIG_MBEDTLS_PSA_CRYPTO_C=y

# Enable cryptographic features for compilation
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Enable cryptographic features for compilation
# Enable needed cryptographic features

? at least "for compilation" to me is a bit off, of course you need to enable what you need to enable, and besides things might fail at runtime instead of build time so your compilation might succeed even with missing features

1. Initializes the Platform Security Architecture (PSA) API.
#. Goes through the steps for J-PAKE on server and client sides.
#. Verifies that the derived keys are the same.
* :kconfig:option:`CONFIG_PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY` - Used to enable support for ECC public key types from among the supported cryptographic operations for :ref:`ug_crypto_supported_features_key_types`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From among the supported cryptographic operations? Maybe I'm just dumb but to me it's a bit weird.

Suggested change
* :kconfig:option:`CONFIG_PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY` - Used to enable support for ECC public key types from among the supported cryptographic operations for :ref:`ug_crypto_supported_features_key_types`.
* :kconfig:option:`CONFIG_PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY` - Used to enable support for ECC public key types among the supported cryptographic operations for :ref:`ug_crypto_supported_features_key_types`.
Suggested change
* :kconfig:option:`CONFIG_PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY` - Used to enable support for ECC public key types from among the supported cryptographic operations for :ref:`ug_crypto_supported_features_key_types`.
* :kconfig:option:`CONFIG_PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY` - Used to enable support for ECC public key types in the supported cryptographic operations for :ref:`ug_crypto_supported_features_key_types`.

goto error;
}

LOG_INF("Shared secrets match successfully!");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Match successfully? Just match, no? (Or "successfully matched"?)

PSA_KEY_DERIVATION_OPERATION_INIT;

LOG_INF("Deriving a key using HKDF and SHA256...");
LOG_INF("Deriving a key using the HKDF algorithm and SHA-256 hash algorithm...");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's basically HKDF with SHA-256, repeating algorithm seems wrong

Suggested change
LOG_INF("Deriving a key using the HKDF algorithm and SHA-256 hash algorithm...");
LOG_INF("Deriving a key using HKDF with SHA-256...");

description: HMAC key derivation function example
name: HKDF example
description: |
This sample demonstrates HKDF key derivation using the HKDF algorithm.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This sample demonstrates HKDF key derivation using the HKDF algorithm.
This sample demonstrates key derivation using the HKDF algorithm.

This app provides an example of performing HMAC signing and verification
using the SHA256 hashing algorithm decryption using AES CBC mode
name: HMAC example
This sample demonstrates HMAC signing and verification using the HMAC algorithm using
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

repetition of "using"

CONFIG_MBEDTLS_PSA_CRYPTO_C=y

# Using hardware crypto accelerator
# Enable using hardware crypto accelerator
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Enable using hardware crypto accelerator
# Enable hardware crypto accelerator

description: HMAC key derivation function example
name: PBKDF2 example
description: |
This sample demonstrates PBKDF2 key derivation using the PBKDF2 algorithm with HMAC-SHA-256.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PBKDF2 repetition

CONFIG_PSA_WANT_ALG_CTR=y
CONFIG_PSA_WANT_GENERATE_RANDOM=y

# Enable persistent storage APIs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Enable persistent storage APIs
# Enable persistent storage for PSA Crypto

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog-entry-required Update changelog before merge. Remove label if entry is not needed or already added. doc-required PR must not be merged without tech writer approval.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants