@@ 73-93 (lines=21) @@ | ||
70 | $this->assertEquals($dnskey, $fromText); |
|
71 | } |
|
72 | ||
73 | public function testWire(): void |
|
74 | { |
|
75 | $wireFormat = pack('nCC', 256, 3, 5).base64_decode(self::$publicKey); |
|
76 | ||
77 | $dnskey = new DNSKEY(); |
|
78 | $dnskey->setFlags(256); |
|
79 | $dnskey->setAlgorithm(Algorithms::RSASHA1); |
|
80 | $dnskey->setPublicKey(base64_decode("AQPSKmynfzW4kyBv015MUG2DeIQ3Cbl+BBZH4b/\r\n0PY1kxkmvHjcZc8nokfzj31GajIQKY+5CptLr3buXA10hWqTkF7H6RfoRqXQe ogmMHfpftf6zMv1LyBUgia7za6ZEzOJBOztyvhjL742iU\n/TpPSEDhm2SNKLijfUppn1UaNvv4w==")); |
|
81 | ||
82 | $this->assertEquals($wireFormat, $dnskey->toWire()); |
|
83 | ||
84 | $rdLength = strlen($wireFormat); |
|
85 | $wireFormat = 'abcde'.$wireFormat.'fghijk'; |
|
86 | $offset = 5; |
|
87 | ||
88 | $fromWire = new DNSKEY(); |
|
89 | $fromWire->fromWire($wireFormat, $offset, $rdLength); |
|
90 | ||
91 | $this->assertEquals($dnskey, $fromWire); |
|
92 | $this->assertEquals(5 + $rdLength, $offset); |
|
93 | } |
|
94 | } |
|
95 |
@@ 67-87 (lines=21) @@ | ||
64 | $this->assertEquals($key, $fromText); |
|
65 | } |
|
66 | ||
67 | public function testWire(): void |
|
68 | { |
|
69 | $wireFormat = pack('nCC', 256, 3, 5).base64_decode(self::$publicKey); |
|
70 | ||
71 | $key = new KEY(); |
|
72 | $key->setFlags(256); |
|
73 | $key->setProtocol(3); |
|
74 | $key->setAlgorithm(Algorithms::RSASHA1); |
|
75 | $key->setPublicKey(base64_decode("AQPSKmynfzW4kyBv015MUG2DeIQ3Cbl+BBZH4b/\r\n0PY1kxkmvHjcZc8nokfzj31GajIQKY+5CptLr3buXA10hWqTkF7H6RfoRqXQe ogmMHfpftf6zMv1LyBUgia7za6ZEzOJBOztyvhjL742iU\n/TpPSEDhm2SNKLijfUppn1UaNvv4w==")); |
|
76 | ||
77 | $this->assertEquals($wireFormat, $key->toWire()); |
|
78 | ||
79 | $rdLength = strlen($wireFormat); |
|
80 | $wireFormat = 'abcde'.$wireFormat.'fghijk'; |
|
81 | $offset = 5; |
|
82 | ||
83 | $fromWire = new KEY(); |
|
84 | $fromWire->fromWire($wireFormat, $offset, $rdLength); |
|
85 | $this->assertEquals($key, $fromWire); |
|
86 | $this->assertEquals(5 + $rdLength, $offset); |
|
87 | } |
|
88 | } |
|
89 |