1 | <?php |
||
28 | |||
29 | $wrapped = A128KW::wrap($kek, $data); |
||
30 | static::assertSame(hex2bin('F4740052E82A225174CE86FBD7B805E7'), $wrapped); |
||
31 | $unwrapped = A128KW::unwrap($kek, $wrapped); |
||
32 | static::assertSame($data, $unwrapped); |
||
33 | } |
||
34 | |||
35 | /** |
||
36 | * @test |
||
37 | */ |
||
38 | public function wrap64BitsKeyDataWith192BitKEK(): void |
||
39 | { |
||
40 | $kek = hex2bin('000102030405060708090A0B0C0D0E0F1011121314151617'); |
||
41 | $data = hex2bin('0011223344556677'); |
||
42 | |||
43 | $wrapped = A192KW::wrap($kek, $data); |
||
44 | static::assertSame(hex2bin('DFE8FD5D1A3786A7351D385096CCFB29'), $wrapped); |
||
45 | $unwrapped = A192KW::unwrap($kek, $wrapped); |
||
46 | static::assertSame($data, $unwrapped); |
||
47 | } |
||
48 | |||
49 | /** |
||
50 | * @test |
||
51 | */ |
||
52 | public function wrap64BitsKeyDataWith256BitKEK(): void |
||
53 | { |
||
54 | $kek = hex2bin('000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F'); |
||
55 | $data = hex2bin('0011223344556677'); |
||
56 | |||
57 | $wrapped = A256KW::wrap($kek, $data); |
||
58 | static::assertSame(hex2bin('794314D454E3FDE1F661BD9F31FBFA31'), $wrapped); |
||
59 | $unwrapped = A256KW::unwrap($kek, $wrapped); |
||
60 | static::assertSame($data, $unwrapped); |
||
61 | } |
||
62 | } |
||
63 |