Skip to content

Conversation

@jrfnl
Copy link
Member

@jrfnl jrfnl commented Jul 19, 2020

PHP 8.0: NewFunctions: account for new OpenSSL CMS functions

  • Added openssl_cms_encrypt() encrypts the message in the file with the
    certificates and outputs the result to the supplied file.
  • Added openssl_cms_decrypt() that decrypts the S/MIME message in the file
    and outputs the results to the supplied file.
  • Added openssl_cms_read() that exports the CMS file to an array of PEM
    certificates.
  • Added openssl_cms_sign() that signs the MIME message in the file with
    a cert and key and output the result to the supplied file.
  • Added openssl_cms_verify() that verifies that the data block is intact,
    the signer is who they say they are, and returns the certs of the signers.

Refs:

Includes unit tests.

PHP 8.0: NewConstants: account for new OpenSSL CMS constants

Added Cryptographic Message Syntax (CMS) (RFC 5652) support composed of
functions for encryption, decryption, signing, verifying and reading. The
API is similar to the API for PKCS #7 functions with an addition of new
encoding constants: OPENSSL_ENCODING_DER, OPENSSL_ENCODING_SMIME and
OPENSSL_ENCODING_PEM.

And from the RFC:

The following analogs to PKCS#7 are also added:
OPENSSL_CMS_DETACHED
OPENSSL_CMS_TEXT
OPENSSL_CMS_NOINTERN
OPENSSL_CMS_NOVERIFY
OPENSSL_CMS_NOCERTS
OPENSSL_CMS_NOATTR
OPENSSL_CMS_BINARY
OPENSSL_CMS_NOSIGS

Refs:

Includes unit tests.

Related to #809

jrfnl added 2 commits July 20, 2020 00:17
> - Added openssl_cms_encrypt() encrypts the message in the file with the
>    certificates and outputs the result to the supplied file.
> - Added openssl_cms_decrypt() that decrypts the S/MIME message in the file
>    and outputs the results to the supplied file.
> - Added openssl_cms_read() that exports the CMS file to an array of PEM
>    certificates.
> - Added openssl_cms_sign() that signs the MIME message in the file with
>    a cert and key and output the result to the supplied file.
> - Added openssl_cms_verify() that verifies that the data block is intact,
>   the signer is who they say they are, and returns the certs of the signers.

Refs:
* https://wiki.php.net/rfc/add-cms-support
* https://github.com/php/php-src/blob/c0172aa2bdb9ea223c8491bdb300995b93a857a0/UPGRADING#L727-L736
* php/php-src#5251
* php/php-src@8583b8a

Includes unit tests.
> Added Cryptographic Message Syntax (CMS) (RFC 5652) support composed of
> functions for encryption, decryption, signing, verifying and reading. The
> API is similar to the API for PKCS #7 functions with an addition of new
> encoding constants: OPENSSL_ENCODING_DER, OPENSSL_ENCODING_SMIME and
> OPENSSL_ENCODING_PEM.

And from the RFC:
>  The following analogs to PKCS#7 are also added:
>  OPENSSL_CMS_DETACHED
>  OPENSSL_CMS_TEXT
>  OPENSSL_CMS_NOINTERN
>  OPENSSL_CMS_NOVERIFY
>  OPENSSL_CMS_NOCERTS
>  OPENSSL_CMS_NOATTR
>  OPENSSL_CMS_BINARY
>  OPENSSL_CMS_NOSIGS

Refs:
* https://wiki.php.net/rfc/add-cms-support
* https://github.com/php/php-src/blob/c0172aa2bdb9ea223c8491bdb300995b93a857a0/UPGRADING#L603-L608
* php/php-src#5251
* php/php-src@8583b8a

Includes unit test.
@jrfnl jrfnl added Type: enhancement PR: quick merge PR only contains relatively simple changes PR: ready for review labels Jul 19, 2020
@jrfnl jrfnl added this to the 10.0.0 milestone Jul 19, 2020
@jrfnl jrfnl requested a review from wimg July 19, 2020 23:11
@wimg wimg merged commit 1fdb16f into develop Aug 5, 2020
@wimg wimg deleted the php8.0/openssl-support-cms-api branch August 5, 2020 21:21
@jrfnl jrfnl removed PR: quick merge PR only contains relatively simple changes PR: ready for review labels Aug 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants