Concise description about "options" parameter!
http://phpcoderweb.com/manual/function-openssl-encrypt_5698.html
> OPENSSL_ZERO_PADDING has a direct impact on the OpenSSL context. EVP_CIPHER_CTX_set_padding() enables or disables padding (enabled by default). So, OPENSSL_ZERO_PADDING disables padding for the context, which means that you will have to manually apply your own padding out to the block size. Without using OPENSSL_ZERO_PADDING, you will automatically get PKCS#7 padding.
> OPENSSL_RAW_DATA does not affect the OpenSSL context but has an impact on the format of the data returned to the caller. When OPENSSL_RAW_DATA is specified, the returned data is returned as-is. When it is not specified, Base64 encoded data is returned to the caller.
Where
- OPENSSL_RAW_DATA=1
- OPENSSL_ZERO_PADDING=2
Hence
options = 0
-> PKCS#7 padding, Base64 Encode
options = 1
-> PKCS#7 padding, No Base64 Encode (RAW DATA)
options = 2
-> No padding, Base64 Encode
options = 3 ( 1 OR 2 )
-> No padding, No Base64 Encode (RAW DATA)