Add support for verifying PKCS7 signed attributes #2264
+243
−24
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issues:
Resolves
CryptoAlg-2946
Description of changes:
I discovered this while trying to fix our PKCS7 implementation to use indefinite encoding. The PKCS7 file that Ruby's PKCS7 tests uses signed attributes, but
PKCS7_verify
bails out whenever it encounters files that have signed attributes. There are still other issues with the Ruby PKCS7 test that we'll have to fix (indefinite length ASN1), but I believe we should fix the missing support for verifying signed attributes first.AWS-LC turns on
PKCS7_NOATTR
by default inPKCS7_sign
, so our existingPKCS7_verify
implementation can do a successful sign/verify round trip against itself. However, OpenSSL does not turn onPKCS7_NOATTR
by default and signed attributes are added automatically to the PKCS7 file if no flags are set. This means that the current state of AWS-LC'sPKCS7_verify
would fail against files generated by the default of OpenSSL'sPKCS7_sign
. This PR adds support for verifying PKCS7 signed attributes to fix the misalignment.Call-outs:
N/A
Testing:
PKCS7_sign
does not support signed attributes, so we can only test against generated files by OpenSSL.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license.