-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement PKCS7_verify, update PKCS7_sign (#1993)
This PR implements `PKCS7_verify` for verifying signedData-type PKCS7 messages. It also adds another mode of operation to `PKCS7_sign` for compatibility with Ruby. Flags for these functions are documented in header comments. We also remove most support for signedAndEnveloped-type PKCS7 messges, as they're not required by Ruby's tests beyond a few getters/setters. OpenSSL supports this type in [`PKCS7_decrypt`][1] but not [`PKCS7_verify`][2], [`PKCS7_sign`][3], nor [`PKCS7_encrypt`][4], so it's unclear what (if any) role signedAndEnveloped types have with respect to these functions. If we wish to revisit support for this type in the future, I have a branch [here][5] implementing encrypt/decrypt/sign/verify support and [a test][6]. Lastly, we externalize some of the previously internal PKCS7 ASN.1/struct definitions as ruby's source accesses some of their members directly. [1]: https://github.com/openssl/openssl/blob/f7c4d4519cd5daad5335b39ba7a3c864c65bf6ee/crypto/pkcs7/pk7_smime.c#L490 [2]: https://github.com/openssl/openssl/blob/f7c4d4519cd5daad5335b39ba7a3c864c65bf6ee/crypto/pkcs7/pk7_smime.c#L236 [3]: https://github.com/openssl/openssl/blob/f7c4d4519cd5daad5335b39ba7a3c864c65bf6ee/crypto/pkcs7/pk7_smime.c#L36 [4]: https://github.com/openssl/openssl/blob/f7c4d4519cd5daad5335b39ba7a3c864c65bf6ee/crypto/pkcs7/pk7_smime.c#L442 [5]: https://github.com/WillChilds-Klein/aws-lc/tree/pkcs7-signed-and-enveloped/ [6]: https://github.com/WillChilds-Klein/aws-lc/blob/pkcs7-signed-and-enveloped/crypto/pkcs7/pkcs7_test.cc#L1953-L1984
- Loading branch information
1 parent
d681431
commit 96de127
Showing
13 changed files
with
1,307 additions
and
665 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,35 @@ | ||
PKCS7,100,BAD_PKCS7_VERSION | ||
PKCS7,113,CERTIFICATE_VERIFY_ERROR | ||
PKCS7,134,CERT_MUST_BE_RSA | ||
PKCS7,123,CIPHER_HAS_NO_OBJECT_IDENTIFIER | ||
PKCS7,106,CIPHER_NOT_INITIALIZED | ||
PKCS7,111,CONTENT_AND_DATA_PRESENT | ||
PKCS7,121,DECRYPT_ERROR | ||
PKCS7,129,DIGEST_FAILURE | ||
PKCS7,119,ERROR_ADDING_RECIPIENT | ||
PKCS7,118,ERROR_SETTING_CIPHER | ||
PKCS7,104,INVALID_NULL_POINTER | ||
PKCS7,126,INVALID_SIGNED_DATA_TYPE | ||
PKCS7,101,NOT_PKCS7_SIGNED_DATA | ||
PKCS7,102,NO_CERTIFICATES_INCLUDED | ||
PKCS7,105,NO_CONTENT | ||
PKCS7,103,NO_CRLS_INCLUDED | ||
PKCS7,133,NO_DEFAULT_DIGEST | ||
PKCS7,128,NO_RECIPIENT_MATCHES_CERTIFICATE | ||
PKCS7,112,NO_SIGNATURES_ON_DATA | ||
PKCS7,116,NO_SIGNERS | ||
PKCS7,132,PKCS7_ADD_SIGNATURE_ERROR | ||
PKCS7,131,PKCS7_ADD_SIGNER_ERROR | ||
PKCS7,122,PKCS7_DATASIGN | ||
PKCS7,120,PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE | ||
PKCS7,115,SIGNATURE_FAILURE | ||
PKCS7,117,SIGNER_CERTIFICATE_NOT_FOUND | ||
PKCS7,124,SIGNING_NOT_SUPPORTED_FOR_THIS_KEY_TYPE | ||
PKCS7,114,SMIME_TEXT_ERROR | ||
PKCS7,109,UNABLE_TO_FIND_MEM_BIO | ||
PKCS7,108,UNABLE_TO_FIND_MESSAGE_DIGEST | ||
PKCS7,125,UNKNOWN_DIGEST_TYPE | ||
PKCS7,127,UNSUPPORTED_CIPHER_TYPE | ||
PKCS7,107,UNSUPPORTED_CONTENT_TYPE | ||
PKCS7,110,WRONG_CONTENT_TYPE | ||
PKCS7,130,WRONG_PKCS7_TYPE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.