&reftitle.constants; &extension.constants;

## Purpose checking flags

`X509_PURPOSE_SSL_CLIENT` (`integer`)

`X509_PURPOSE_SSL_SERVER` (`integer`)

`X509_PURPOSE_NS_SSL_SERVER` (`integer`)

`X509_PURPOSE_SMIME_SIGN` (`integer`)

`X509_PURPOSE_SMIME_ENCRYPT` (`integer`)

`X509_PURPOSE_CRL_SIGN` (`integer`)

`X509_PURPOSE_ANY` (`integer`)

## Padding flags for asymmetric encryption

`OPENSSL_PKCS1_PADDING` (`integer`)

`OPENSSL_SSLV23_PADDING` (`integer`)

`OPENSSL_NO_PADDING` (`integer`)

`OPENSSL_PKCS1_OAEP_PADDING` (`integer`)

## Key types

`OPENSSL_KEYTYPE_RSA` (`integer`)

`OPENSSL_KEYTYPE_DSA` (`integer`)

`OPENSSL_KEYTYPE_DH` (`integer`)

`OPENSSL_KEYTYPE_EC` (`integer`)

- This constant is only available when PHP is compiled with OpenSSL 0.9.8+.

This constant was added in 5.2.0.

`OPENSSL_KEYTYPE_EC`

## PKCS7 Flags/Constants

The S/MIME functions make use of flags which are specified using a bitfield which can include one or more of the following values:

## PKCS7 CONSTANTS

Constant | Description
`PKCS7_TEXT` | Adds text/plain content type headers to encrypted/signed message. If decrypting or verifying, it strips those headers from the output - if the decrypted or verified message is not of MIME type text/plain then an error will occur.
`PKCS7_BINARY` | Normally the input message is converted to "canonical" format which is effectively using `CR` and `LF` as end of line: as required by the S/MIME specification. When this option is present, no translation occurs. This is useful when handling binary data which may not be in MIME format.
`PKCS7_NOINTERN` | When verifying a message, certificates (if any) included in the message are normally searched for the signing certificate. With this option only the certificates specified in the `extracerts` parameter of `openssl_pkcs7_verify` are used. The supplied certificates can still be used as untrusted CAs however.
`PKCS7_NOVERIFY` | Do not verify the signers certificate of a signed message.
`PKCS7_NOCHAIN` | Do not chain verification of signers certificates: that is don't use the certificates in the signed message as untrusted CAs.
`PKCS7_NOCERTS` | When signing a message the signer's certificate is normally included - with this option it is excluded. This will reduce the size of the signed message but the verifier must have a copy of the signers certificate available locally (passed using the `extracerts` to `openssl_pkcs7_verify` for example).
`PKCS7_NOATTR` | Normally when a message is signed, a set of attributes are included which include the signing time and the supported symmetric algorithms. With this option they are not included.
`PKCS7_DETACHED` | When signing a message, use cleartext signing with the MIME type `"multipart/signed"`. This is the default if you do not specify any `flags` to `openssl_pkcs7_sign`. If you turn this option off, the message will be signed using opaque signing, which is more resistant to translation by mail relays but cannot be read by mail agents that do not support S/MIME.
`PKCS7_NOSIGS` | Don't try and verify the signatures on a message

These constants were added in 4.0.6.

## Signature Algorithms

`OPENSSL_ALGO_DSS1` (`integer`)

`OPENSSL_ALGO_SHA1` (`integer`)

- Used as default algorithm by `openssl_sign` and `openssl_verify`.

`OPENSSL_ALGO_SHA224` (`integer`)

`OPENSSL_ALGO_SHA256` (`integer`)

`OPENSSL_ALGO_SHA384` (`integer`)

`OPENSSL_ALGO_SHA512` (`integer`)

`OPENSSL_ALGO_RMD160` (`integer`)

`OPENSSL_ALGO_MD5` (`integer`)

`OPENSSL_ALGO_MD4` (`integer`)

`OPENSSL_ALGO_MD2` (`integer`)

- As of PHP 5.2.13 and PHP 5.3.2, this constant is only available if PHP is compiled with MD2 support. This requires passing in the -DHAVE_OPENSSL_MD2_H CFLAG when compiling PHP, and enable-md2 when compiling OpenSSL 1.0.0+.

These constants were added in 5.0.0.

`OPENSSL_ALGO_MD2`, `OPENSSL_ALGO_MD4`, `OPENSSL_ALGO_MD5`, `OPENSSL_ALGO_SHA1`, `OPENSSL_ALGO_DSS1`

These constants were added in 5.4.8.

`OPENSSL_ALGO_RMD160`, `OPENSSL_ALGO_SHA224`, `OPENSSL_ALGO_SHA256`, `OPENSSL_ALGO_SHA384`, `OPENSSL_ALGO_SHA512`

## Ciphers

`OPENSSL_CIPHER_RC2_40` (`integer`)

`OPENSSL_CIPHER_RC2_128` (`integer`)

`OPENSSL_CIPHER_RC2_64` (`integer`)

`OPENSSL_CIPHER_DES` (`integer`)

`OPENSSL_CIPHER_3DES` (`integer`)

These constants were added in 4.3.0.

`OPENSSL_CIPHER_AES_128_CBC` (`integer`)

`OPENSSL_CIPHER_AES_192_CBC` (`integer`)

`OPENSSL_CIPHER_AES_256_CBC` (`integer`)

These constants were added in 5.4.0.

## Version constants

`OPENSSL_VERSION_TEXT` (`string`)

`OPENSSL_VERSION_NUMBER` (`integer`)

These constants were added in 5.2.0.

## Server Name Indication constants

`OPENSSL_TLSEXT_SERVER_NAME` (`string`)

- Whether SNI support is available or not.

This constant were added in 5.3.2 and requires PHP to be built with OpenSSL 0.9.8j or greater.