1 | <?php |
||
21 | * |
||
22 | * @see https://www.ietf.org/rfc/rfc3394.txt#4 |
||
23 | */ |
||
24 | final class ExceptionTest extends TestCase |
||
25 | { |
||
26 | /** |
||
27 | * @expectedException InvalidArgumentException |
||
28 | * @expectedExceptionMessage Bad KEK size |
||
29 | */ |
||
30 | public function testAESKWBadKEKSize() |
||
37 | |||
38 | /** |
||
39 | * @expectedException InvalidArgumentException |
||
40 | * @expectedExceptionMessage Bad KEK size |
||
41 | */ |
||
42 | public function testA128KWBadKEKSize() |
||
49 | |||
50 | /** |
||
51 | * @expectedException InvalidArgumentException |
||
52 | * @expectedExceptionMessage Bad KEK size |
||
53 | */ |
||
54 | public function testA192KWBadKEKSize() |
||
61 | |||
62 | /** |
||
63 | * @expectedException InvalidArgumentException |
||
64 | * @expectedExceptionMessage Bad KEK size |
||
65 | */ |
||
66 | public function testA256KWBadKEKSize() |
||
73 | |||
74 | /** |
||
75 | * @expectedException InvalidArgumentException |
||
76 | * @expectedExceptionMessage Integrity check failed |
||
77 | */ |
||
78 | public function testIntegrityCheckFailed() |
||
85 | |||
86 | /** |
||
87 | * @expectedException InvalidArgumentException |
||
88 | * @expectedExceptionMessage Bad key size |
||
89 | */ |
||
90 | public function testA128KWBadKeySize() |
||
97 | |||
98 | /** |
||
99 | * @expectedException InvalidArgumentException |
||
100 | * @expectedExceptionMessage Bad key size |
||
101 | */ |
||
102 | public function testA128KWEmptyKey() |
||
109 | |||
110 | /** |
||
111 | * @expectedException InvalidArgumentException |
||
112 | * @expectedExceptionMessage Integrity check failed |
||
113 | */ |
||
114 | public function testA128KWIntegrityNotVerified() |
||
121 | |||
122 | /** |
||
123 | * @expectedException InvalidArgumentException |
||
124 | * @expectedExceptionMessage Bad data |
||
125 | */ |
||
126 | public function testWrap64BitsKeyDataWith128BitKEK() |
||
133 | |||
134 | /** |
||
135 | * @expectedException InvalidArgumentException |
||
136 | * @expectedExceptionMessage Integrity check failed |
||
137 | */ |
||
138 | public function testBadData() |
||
139 | { |
||
140 | $kek = hex2bin('000102030405060708090A0B0C0D0E0F'); |
||
141 | $data = hex2bin('F4740052E82A225174CE86FBD7B805E6'); |
||
142 | |||
143 | A128KW::unwrap($kek, $data); |
||
146 |