mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Use different algorithm in cms tests
Same as with pkcs7, switch these tests to use an algorithm that OpenSSL 3 supports out of the box. Once again, we should consider changing the default or making it required.
This commit is contained in:
parent
563b3e3472
commit
ec4d926a80
3 changed files with 6 additions and 3 deletions
|
@ -15,8 +15,9 @@ $single_cert = "file://" . __DIR__ . "/cert.crt";
|
|||
$headers = array("test@test", "testing openssl_cms_encrypt()");
|
||||
$wrong = "wrong";
|
||||
$empty = "";
|
||||
$cipher = OPENSSL_CIPHER_AES_128_CBC;
|
||||
|
||||
openssl_cms_encrypt($infile, $encrypted, $single_cert, $headers);
|
||||
openssl_cms_encrypt($infile, $encrypted, $single_cert, $headers, cipher_algo: $cipher);
|
||||
|
||||
var_dump(openssl_cms_decrypt($encrypted, $outfile, $single_cert, $privkey));
|
||||
print("\nDecrypted text:\n");
|
||||
|
|
|
@ -13,8 +13,9 @@ $decryptfile = $tname . ".out";
|
|||
$single_cert = "file://" . __DIR__ . "/cert.crt";
|
||||
$privkey = "file://" . __DIR__ . "/private_rsa_1024.key";
|
||||
$headers = array("test@test", "testing openssl_cms_encrypt()");
|
||||
$cipher = OPENSSL_CIPHER_AES_128_CBC;
|
||||
|
||||
var_dump(openssl_cms_encrypt($infile, $cryptfile, $single_cert, $headers, OPENSSL_CMS_BINARY, OPENSSL_ENCODING_DER));
|
||||
var_dump(openssl_cms_encrypt($infile, $cryptfile, $single_cert, $headers, OPENSSL_CMS_BINARY, OPENSSL_ENCODING_DER, $cipher));
|
||||
if (openssl_cms_decrypt($cryptfile, $decryptfile, $single_cert, $privkey, OPENSSL_ENCODING_DER) == false) {
|
||||
print "DER decrypt error\n";
|
||||
print "recipient:\n";
|
||||
|
|
|
@ -13,8 +13,9 @@ $decryptfile = $tname . ".pemout";
|
|||
$single_cert = "file://" . __DIR__ . "/cert.crt";
|
||||
$privkey = "file://" . __DIR__ . "/private_rsa_1024.key";
|
||||
$headers = array("test@test", "testing openssl_cms_encrypt()");
|
||||
$cipher = OPENSSL_CIPHER_AES_128_CBC;
|
||||
|
||||
var_dump(openssl_cms_encrypt($infile, $cryptfile, $single_cert, $headers, OPENSSL_CMS_BINARY, OPENSSL_ENCODING_PEM));
|
||||
var_dump(openssl_cms_encrypt($infile, $cryptfile, $single_cert, $headers, OPENSSL_CMS_BINARY, OPENSSL_ENCODING_PEM, $cipher));
|
||||
if (openssl_cms_decrypt($cryptfile, $decryptfile, $single_cert, $privkey, OPENSSL_ENCODING_PEM) == false) {
|
||||
print "PEM decrypt error\n";
|
||||
print "recipient:\n";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue