Skip to content

Add RSA-PSS certificate support for PKCS7 EnvelopedData KTRI#9854

Open
sameehj wants to merge 1 commit intowolfSSL:masterfrom
sameehj:rsa-pss-fix
Open

Add RSA-PSS certificate support for PKCS7 EnvelopedData KTRI#9854
sameehj wants to merge 1 commit intowolfSSL:masterfrom
sameehj:rsa-pss-fix

Conversation

@sameehj
Copy link
Contributor

@sameehj sameehj commented Mar 3, 2026

RSA-PSS signed certificates contain a valid RSA public key that can be used for key transport, but wc_PKCS7_AddRecipient_KTRI and the EnvelopedData/AuthEnvelopedData encode paths rejected them because they only checked for RSAk. Allow RSAPSSk to fall through to the RSAk key transport path, and always use RSAk as the KeyEncryptionAlgorithmIdentifier since the operation is RSA encryption, not RSA-PSS signing.

Description

  • Accepts RSAPSSk alongside RSAk in wc_PKCS7_AddRecipient_KTRI
  • Uses RSAk for the KeyEncryptionAlgorithmIdentifier (the operation is
    RSA encryption, not PSS signing)
  • Adds RSAPSSk fallthrough in the EncodeEnvelopedData and
    EncodeAuthEnvelopedData caller switches

No decode-side changes needed since the encoded KeyEncryptionAlgorithmIdentifier
is RSAk.

Testing

  • Built wolfSSL with --enable-pkcs7 and WC_RSA_PSS
  • Ran envelopedData-ktri example with certs/rsapss/client-rsapss.der
    • Before fix: wc_PKCS7_AddRecipient_KTRI() failed, ret = -133
    • After fix: Successfully encoded and decoded EnvelopedData bundle
  • Added test_wc_PKCS7_EnvelopedData_KTRI_RSA_PSS unit test that
    encodes and decodes an EnvelopedData bundle using an RSA-PSS
    certificate for KTRI key transport

Checklist

  • added tests
  • [NA] updated/added doxygen
  • [NA] updated appropriate READMEs
  • [NA] Updated manual and documentation

RSA-PSS signed certificates contain a valid RSA public key that can be
used for key transport, but wc_PKCS7_AddRecipient_KTRI and the
EnvelopedData/AuthEnvelopedData encode paths rejected them because they
only checked for RSAk. Allow RSAPSSk to fall through to the RSAk key
transport path, and always use RSAk as the KeyEncryptionAlgorithmIdentifier
since the operation is RSA encryption, not RSA-PSS signing.

Signed-off-by: Sameeh Jubran <sameeh@wolfssl.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants