Typecasting question
| From: | jas | Date: | Fri, 03 Feb 2012 16:11:42 +0000 |
| Subject: | Typecasting question | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-316460@lists.php.net to get a copy of this message | ||
I am familiar with typecasting. Booleans, ints, strings, etc.
However while using an extension, more specifically the OpenSSL extension I have come across a problem I am not entirely familiar with.
I have an array that looks like...
array('config' => 'config/openssl.cnf',
'encrypt_key' => true,
'private_key_type' => 'OPENSSL_KEYTYPE_RSA',
'digest_algorithm' => 'sha256',
'private_key_bits' => 512,
'x509_extensions' => 'usr_cert',
'encrypt_key_cipher' => 'OPENSSL_CIPHER_3DES');
And according to the current OpenSSL documentation regarding the configuration constants (http://www.php.net/manual/en/openssl.ciphers.php) the array needs to have the 'private_key_type' and 'encrypt_key_cipher' elements as an INT value vs the string they are currently. Like so.
array('private_key_type' => OPENSSL_KEYTYPE_RSA,
'encrypt_key_cipher' => OPENSSL_CIPHER_3DES);I have tried to perform typecasting these two elements as an int but because they are specific to the extension I am not certain how I should go about doing this. According to the source for php (the openssl.c) file is an internal attribute that I cannot find an integer value for to set it manually vs. using the pre-defined constant values mentioned in the docs.