Skip to content

Commit ec4d926

Browse files
committed
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.
1 parent 563b3e3 commit ec4d926

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

ext/openssl/tests/openssl_cms_decrypt_basic.phpt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@ $single_cert = "file://" . __DIR__ . "/cert.crt";
1515
$headers = array("test@test", "testing openssl_cms_encrypt()");
1616
$wrong = "wrong";
1717
$empty = "";
18+
$cipher = OPENSSL_CIPHER_AES_128_CBC;
1819

19-
openssl_cms_encrypt($infile, $encrypted, $single_cert, $headers);
20+
openssl_cms_encrypt($infile, $encrypted, $single_cert, $headers, cipher_algo: $cipher);
2021

2122
var_dump(openssl_cms_decrypt($encrypted, $outfile, $single_cert, $privkey));
2223
print("\nDecrypted text:\n");

ext/openssl/tests/openssl_cms_encrypt_der.phpt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ $decryptfile = $tname . ".out";
1313
$single_cert = "file://" . __DIR__ . "/cert.crt";
1414
$privkey = "file://" . __DIR__ . "/private_rsa_1024.key";
1515
$headers = array("test@test", "testing openssl_cms_encrypt()");
16+
$cipher = OPENSSL_CIPHER_AES_128_CBC;
1617

17-
var_dump(openssl_cms_encrypt($infile, $cryptfile, $single_cert, $headers, OPENSSL_CMS_BINARY, OPENSSL_ENCODING_DER));
18+
var_dump(openssl_cms_encrypt($infile, $cryptfile, $single_cert, $headers, OPENSSL_CMS_BINARY, OPENSSL_ENCODING_DER, $cipher));
1819
if (openssl_cms_decrypt($cryptfile, $decryptfile, $single_cert, $privkey, OPENSSL_ENCODING_DER) == false) {
1920
print "DER decrypt error\n";
2021
print "recipient:\n";

ext/openssl/tests/openssl_cms_encrypt_pem.phpt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ $decryptfile = $tname . ".pemout";
1313
$single_cert = "file://" . __DIR__ . "/cert.crt";
1414
$privkey = "file://" . __DIR__ . "/private_rsa_1024.key";
1515
$headers = array("test@test", "testing openssl_cms_encrypt()");
16+
$cipher = OPENSSL_CIPHER_AES_128_CBC;
1617

17-
var_dump(openssl_cms_encrypt($infile, $cryptfile, $single_cert, $headers, OPENSSL_CMS_BINARY, OPENSSL_ENCODING_PEM));
18+
var_dump(openssl_cms_encrypt($infile, $cryptfile, $single_cert, $headers, OPENSSL_CMS_BINARY, OPENSSL_ENCODING_PEM, $cipher));
1819
if (openssl_cms_decrypt($cryptfile, $decryptfile, $single_cert, $privkey, OPENSSL_ENCODING_PEM) == false) {
1920
print "PEM decrypt error\n";
2021
print "recipient:\n";

0 commit comments

Comments
 (0)