1<?php 2$php_openssl_cipher_tests = array( 3 'aes-256-ccm' => array( 4 array( 5 'key' => '1bde3251d41a8b5ea013c195ae128b21' . 6 '8b3e0306376357077ef1c1c78548b92e', 7 'iv' => '5b8e40746f6b98e00f1d13ff41', 8 'aad' => 'c17a32514eb6103f3249e076d4c871dc' . 9 '97e04b286699e54491dc18f6d734d4c0', 10 'tag' => '2024931d73bca480c24a24ece6b6c2bf', 11 'pt' => '53bd72a97089e312422bf72e242377b3' . 12 'c6ee3e2075389b999c4ef7f28bd2b80a', 13 'ct' => '9a5fcccdb4cf04e7293d2775cc76a488' . 14 'f042382d949b43b7d6bb2b9864786726', 15 ), 16 ), 17 'aes-128-gcm' => array( 18 array( 19 'key' => '00000000000000000000000000000000', 20 'iv' => '000000000000000000000000', 21 'tag' => '58e2fccefa7e3061367f1d57a4e7455a', 22 'pt' => '', 23 'ct' => '', 24 ), 25 array( 26 'key' => '00000000000000000000000000000000', 27 'iv' => '000000000000000000000000', 28 'tag' => 'ab6e47d42cec13bdf53a67b21257bddf', 29 'pt' => '00000000000000000000000000000000', 30 'ct' => '0388dace60b6a392f328c2b971b2fe78', 31 ), 32 array( 33 'key' => 'feffe9928665731c6d6a8f9467308308', 34 'iv' => 'cafebabefacedbaddecaf888', 35 'tag' => '4d5c2af327cd64a62cf35abd2ba6fab4', 36 'pt' => 'd9313225f88406e5a55909c5aff5269a' . 37 '86a7a9531534f7da2e4c303d8a318a72' . 38 '1c3c0c95956809532fcf0e2449a6b525' . 39 'b16aedf5aa0de657ba637b391aafd255', 40 'ct' => '42831ec2217774244b7221b784d0d49c' . 41 'e3aa212f2c02a4e035c17e2329aca12e' . 42 '21d514b25466931c7d8f6a5aac84aa05' . 43 '1ba30b396a0aac973d58e091473f5985', 44 ), 45 array( 46 'key' => 'feffe9928665731c6d6a8f9467308308', 47 'iv' => 'cafebabefacedbaddecaf888', 48 'aad' => 'feedfacedeadbeeffeedfacedeadbeefabaddad2', 49 'tag' => '5bc94fbc3221a5db94fae95ae7121a47', 50 'pt' => 'd9313225f88406e5a55909c5aff5269a' . 51 '86a7a9531534f7da2e4c303d8a318a72' . 52 '1c3c0c95956809532fcf0e2449a6b525' . 53 'b16aedf5aa0de657ba637b39', 54 'ct' => '42831ec2217774244b7221b784d0d49c' . 55 'e3aa212f2c02a4e035c17e2329aca12e' . 56 '21d514b25466931c7d8f6a5aac84aa05' . 57 '1ba30b396a0aac973d58e091', 58 ), 59 array( 60 'key' => 'feffe9928665731c6d6a8f9467308308', 61 'iv' => 'cafebabefacedbad', 62 'aad' => 'feedfacedeadbeeffeedfacedeadbeefabaddad2', 63 'tag' => '3612d2e79e3b0785561be14aaca2fccb', 64 'pt' => 'd9313225f88406e5a55909c5aff5269a' . 65 '86a7a9531534f7da2e4c303d8a318a72' . 66 '1c3c0c95956809532fcf0e2449a6b525' . 67 'b16aedf5aa0de657ba637b39', 68 'ct' => '61353b4c2806934a777ff51fa22a4755' . 69 '699b2a714fcdc6f83766e5f97b6c7423' . 70 '73806900e49f24b22b097544d4896b42' . 71 '4989b5e1ebac0f07c23f4598' 72 ), 73 array( 74 'key' => 'feffe9928665731c6d6a8f9467308308', 75 'iv' => '9313225df88406e555909c5aff5269aa' . 76 '6a7a9538534f7da1e4c303d2a318a728' . 77 'c3c0c95156809539fcf0e2429a6b5254' . 78 '16aedbf5a0de6a57a637b39b', 79 'aad' => 'feedfacedeadbeeffeedfacedeadbeefabaddad2', 80 'tag' => '619cc5aefffe0bfa462af43c1699d050', 81 'pt' => 'd9313225f88406e5a55909c5aff5269a' . 82 '86a7a9531534f7da2e4c303d8a318a72' . 83 '1c3c0c95956809532fcf0e2449a6b525' . 84 'b16aedf5aa0de657ba637b39', 85 'ct' => '8ce24998625615b603a033aca13fb894' . 86 'be9112a5c3a211a8ba262a3cca7e2ca7' . 87 '01e4a9a4fba43c90ccdcb281d48c7c6f' . 88 'd62875d2aca417034c34aee5', 89 ), 90 ) 91); 92 93function openssl_get_cipher_tests($method) 94{ 95 global $php_openssl_cipher_tests; 96 97 $tests = array(); 98 99 foreach ($php_openssl_cipher_tests[$method] as $instance) { 100 $test = array(); 101 foreach ($instance as $field_name => $field_value) { 102 $test[$field_name] = pack("H*", $field_value); 103 } 104 if (!isset($test['aad'])) { 105 $test['aad'] = ""; 106 } 107 $tests[] = $test; 108 } 109 110 return $tests; 111} 112