-
Couldn't load subscription status.
- Fork 1.4k
doc: crypto: updates to crypto samples, part 3 #25240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -7,9 +7,8 @@ Crypto: EC J-PAKE | |||||
| :local: | ||||||
| :depth: 2 | ||||||
|
|
||||||
| The EC J-PAKE sample demonstrates how to do password-authenticated key exchange using | ||||||
| the elliptic curve (EC) version of the password-authenticated key exchange by | ||||||
| juggling (J-PAKE) protocol. | ||||||
| The EC J-PAKE sample demonstrates how to use the :ref:`PSA Crypto API <ug_psa_certified_api_overview_crypto>` to perform password-authenticated key exchange using the EC J-PAKE algorithm. | ||||||
| The sample uses the elliptic curve (EC) version of the password-authenticated key exchange by juggling (J-PAKE) protocol with a shared password. | ||||||
|
|
||||||
| Requirements | ||||||
| ************ | ||||||
|
|
@@ -21,11 +20,35 @@ The sample supports the following development kits: | |||||
| Overview | ||||||
| ******** | ||||||
|
|
||||||
| The sample performs the following operations: | ||||||
| The sample :ref:`enables PSA Crypto API <psa_crypto_support_enable>` and configures the following Kconfig options for the cryptographic 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`. | ||||||
| * :kconfig:option:`CONFIG_PSA_WANT_ALG_JPAKE` - Used to enable support for the J-PAKE key agreement algorithm from among the supported cryptographic operations for :ref:`ug_crypto_supported_features_pake_algorithms`. | ||||||
| * :kconfig:option:`CONFIG_PSA_WANT_ALG_SHA_256` - Used to enable support for the SHA-256 hash algorithm from among the supported cryptographic operations for :ref:`ug_crypto_supported_features_hash_algorithms`. | ||||||
|
|
||||||
| .. include:: /samples/crypto/aes_cbc/README.rst | ||||||
| :start-after: crypto_sample_overview_driver_selection_start | ||||||
| :end-before: crypto_sample_overview_driver_selection_end | ||||||
|
|
||||||
| Once built and run, the sample performs the following operations: | ||||||
|
|
||||||
| 1. Initialization: | ||||||
|
|
||||||
| a. The PSA Crypto API is initialized using :c:func:`psa_crypto_init`. | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
I'd suggest saying the ... function, at least for the first instance of a section or list. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is clear from the context: API, *_init. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? |
||||||
| #. A password key is imported using :c:func:`psa_import_key` with the ``PSA_KEY_TYPE_PASSWORD`` type. | ||||||
| The key is configured with usage flags for key derivation. | ||||||
|
|
||||||
| #. EC J-PAKE key exchange: | ||||||
|
|
||||||
| a. PAKE operations are set up for both client and server using :c:func:`psa_pake_setup`. | ||||||
| #. Key exchange rounds are performed using :c:func:`psa_pake_output` and :c:func:`psa_pake_input`. | ||||||
| This includes key sharing, zero-knowledge public values, and zero-knowledge proofs. | ||||||
| #. Shared secrets are derived using :c:func:`psa_pake_get_shared_key` and key derivation functions. | ||||||
| #. The derived secrets are compared to verify that both parties obtained the same shared secret. | ||||||
|
|
||||||
| #. Cleanup: | ||||||
|
|
||||||
| a. The password key is removed from the PSA crypto keystore using :c:func:`psa_destroy_key`. | ||||||
|
|
||||||
| Building and running | ||||||
| ******************** | ||||||
|
|
@@ -37,8 +60,30 @@ Building and running | |||||
| Testing | ||||||
| ======= | ||||||
|
|
||||||
| After programming the sample to your development kit, complete the following steps to test it: | ||||||
| .. include:: /samples/crypto/aes_cbc/README.rst | ||||||
| :start-after: crypto_sample_testing_start | ||||||
| :end-before: crypto_sample_testing_end | ||||||
|
|
||||||
| .. code-block:: text | ||||||
|
|
||||||
| 1. |connect_terminal| | ||||||
| #. Compile and program the application. | ||||||
| #. Observe the logs from the application using a terminal emulator. | ||||||
| *** Booting nRF Connect SDK v3.1.0-6c6e5b32496e *** | ||||||
| *** Using Zephyr OS v4.1.99-1612683d4010 *** | ||||||
| [00:00:00.251,159] <inf> ecjpake: Starting EC J-PAKE example... | ||||||
| [00:00:00.251,190] <inf> ecjpake: Importing password key... | ||||||
| [00:00:00.251,342] <inf> ecjpake: Password key imported successfully! | ||||||
| [00:00:00.251,373] <inf> ecjpake: Performing EC J-PAKE key exchange rounds... | ||||||
| [00:00:00.251,708] <inf> ecjpake: EC J-PAKE key exchange completed successfully! | ||||||
| [00:00:00.251,739] <inf> ecjpake: Deriving shared secrets... | ||||||
| [00:00:00.251,770] <inf> ecjpake: Shared secrets derived successfully! | ||||||
| [00:00:00.251,800] <inf> ecjpake: ---- server_secret (len: 32): ---- | ||||||
| [00:00:00.251,831] <inf> ecjpake: Content: | ||||||
| c3 1e 5b 35 97 25 ee a3 ef ba 66 c3 f9 81 37 2a |..[5.%.. ..f...7* | ||||||
| 76 9d a9 cb 1c 49 4f 6d ef b8 a2 aa 11 2c fc bd |v....IOm .....,.. | ||||||
| [00:00:00.251,861] <inf> ecjpake: ---- server_secret end ---- | ||||||
| [00:00:00.251,892] <inf> ecjpake: ---- client_secret (len: 32): ---- | ||||||
| [00:00:00.251,922] <inf> ecjpake: Content: | ||||||
| c3 1e 5b 35 97 25 ee a3 ef ba 66 c3 f9 81 37 2a |..[5.%.. ..f...7* | ||||||
| 76 9d a9 cb 1c 49 4f 6d ef b8 a2 aa 11 2c fc bd |v....IOm .....,.. | ||||||
| [00:00:00.251,953] <inf> ecjpake: ---- client_secret end ---- | ||||||
| [00:00:00.251,984] <inf> ecjpake: Shared secrets match! | ||||||
| [00:00:00.252,014] <inf> ecjpake: Example finished successfully! | ||||||
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's correct to use "from among" here.