Skip to content

net: sockets: tls: support PSA-resident private keys#111841

Open
PavelVPV wants to merge 1 commit into
zephyrproject-rtos:mainfrom
PavelVPV:tls_credentials_add_support_for_psa_generated_key
Open

net: sockets: tls: support PSA-resident private keys#111841
PavelVPV wants to merge 1 commit into
zephyrproject-rtos:mainfrom
PavelVPV:tls_credentials_add_support_for_psa_generated_key

Conversation

@PavelVPV

Copy link
Copy Markdown
Contributor

Add a TLS_CREDENTIAL_PRIVATE_KEY_PSA credential type so a private key already resident in PSA can be referenced by its psa_key_id_t instead of being supplied as exported key material.

When this credential type is used, the TLS socket builds an opaque Mbed TLS PK context with mbedtls_pk_wrap_psa() rather than parsing raw key bytes. As a result the private key never leaves PSA: handshake signatures are performed through psa_sign_hash(). This enables flows where the key is generated on-device (non-exportable, stored in ITS) and used for TLS client authentication without ever exporting it.

The credential buffer holds a psa_key_id_t; the public certificate is still registered as TLS_CREDENTIAL_PUBLIC_CERTIFICATE and paired with the opaque key by sec tag, unchanged.

@PavelVPV PavelVPV force-pushed the tls_credentials_add_support_for_psa_generated_key branch from 8bfaafb to 1e44da3 Compare June 23, 2026 10:23
@PavelVPV PavelVPV marked this pull request as ready for review June 23, 2026 10:58
@zephyrbot zephyrbot requested review from jukkar, pdgendt and rlubos June 23, 2026 11:00

@pdgendt pdgendt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please change the Co-Authored-By to Assisted-By as mentioned in the contribution guidelines.

@PavelVPV PavelVPV force-pushed the tls_credentials_add_support_for_psa_generated_key branch from 1e44da3 to 19d43ba Compare June 23, 2026 11:47
@PavelVPV

Copy link
Copy Markdown
Contributor Author

Please change the Co-Authored-By to Assisted-By as mentioned in the contribution guidelines.

Done!

@PavelVPV PavelVPV requested a review from pdgendt June 23, 2026 11:51

@pdgendt pdgendt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nit: It's Assisted-by (lowercase b), my bad 😅

Add a TLS_CREDENTIAL_PRIVATE_KEY_PSA credential type so a private key
already resident in PSA can be referenced by its psa_key_id_t instead
of being supplied as exported key material.

When this credential type is used, the TLS socket builds an opaque
Mbed TLS PK context with mbedtls_pk_wrap_psa() rather than parsing raw
key bytes. As a result the private key never leaves PSA: handshake
signatures are performed through psa_sign_hash(). This enables flows
where the key is generated on-device (non-exportable, stored in ITS)
and used for TLS client authentication without ever exporting it.

The credential buffer holds a psa_key_id_t; the public certificate is
still registered as TLS_CREDENTIAL_PUBLIC_CERTIFICATE and paired with
the opaque key by sec tag, unchanged.

Assisted-by: Claude:claude-opus-4.8
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
@PavelVPV PavelVPV force-pushed the tls_credentials_add_support_for_psa_generated_key branch from 19d43ba to 586aa4d Compare June 23, 2026 12:31
@sonarqubecloud

Copy link
Copy Markdown

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants