@@ 26-37 (lines=12) @@ | ||
23 | { |
|
24 | private static $digest = '2BB183AF5F22588179A53B0A98631FAD1A292118'; |
|
25 | ||
26 | public function testOutput(): void |
|
27 | { |
|
28 | $expectation = '60485 5 1 '.self::$digest; |
|
29 | ||
30 | $ds = new DS(); |
|
31 | $ds->setKeyTag(60485); |
|
32 | $ds->setAlgorithm(Algorithms::RSASHA1); |
|
33 | $ds->setDigestType(DS::DIGEST_SHA1); |
|
34 | $ds->setDigest(hex2bin(self::$digest)); |
|
35 | ||
36 | $this->assertEquals($expectation, $ds->toText()); |
|
37 | } |
|
38 | ||
39 | public function testFactory(): void |
|
40 | { |
|
@@ 50-61 (lines=12) @@ | ||
47 | $this->assertEquals(DS::DIGEST_SHA1, $ds->getDigestType()); |
|
48 | } |
|
49 | ||
50 | public function testFromText(): void |
|
51 | { |
|
52 | $expectation = new DS(); |
|
53 | $expectation->setKeyTag(60485); |
|
54 | $expectation->setAlgorithm(Algorithms::RSASHA1); |
|
55 | $expectation->setDigestType(DS::DIGEST_SHA1); |
|
56 | $expectation->setDigest(hex2bin(self::$digest)); |
|
57 | ||
58 | $fromText = new DS(); |
|
59 | $fromText->fromText('60485 5 1 '.self::$digest); |
|
60 | $this->assertEquals($expectation, $fromText); |
|
61 | } |
|
62 | ||
63 | public function testWire(): void |
|
64 | { |
@@ 28-39 (lines=12) @@ | ||
25 | */ |
|
26 | private static $publicKey = 'AQPSKmynfzW4kyBv015MUG2DeIQ3Cbl+BBZH4b/0PY1kxkmvHjcZc8nokfzj31GajIQKY+5CptLr3buXA10hWqTkF7H6RfoRqXQeogmMHfpftf6zMv1LyBUgia7za6ZEzOJBOztyvhjL742iU/TpPSEDhm2SNKLijfUppn1UaNvv4w=='; |
|
27 | ||
28 | public function testOutput(): void |
|
29 | { |
|
30 | $expectation = '256 3 5 '.self::$publicKey; |
|
31 | ||
32 | $key = new KEY(); |
|
33 | $key->setFlags(256); |
|
34 | $key->setProtocol(3); |
|
35 | $key->setAlgorithm(Algorithms::RSASHA1); |
|
36 | $key->setPublicKey(base64_decode(self::$publicKey)); |
|
37 | ||
38 | $this->assertEquals($expectation, $key->toText()); |
|
39 | } |
|
40 | ||
41 | public function testFactory(): void |
|
42 | { |
@@ 25-36 (lines=12) @@ | ||
22 | { |
|
23 | private static $digest = '2BB183AF5F22588179A53B0A98631FAD1A292118'; |
|
24 | ||
25 | public function testOutput(): void |
|
26 | { |
|
27 | $expectation = '60485 5 1 '.self::$digest; |
|
28 | ||
29 | $ta = new TA(); |
|
30 | $ta->setKeyTag(60485); |
|
31 | $ta->setAlgorithm(Algorithms::RSASHA1); |
|
32 | $ta->setDigestType(TA::DIGEST_SHA1); |
|
33 | $ta->setDigest(hex2bin(self::$digest)); |
|
34 | ||
35 | $this->assertEquals($expectation, $ta->toText()); |
|
36 | } |
|
37 | ||
38 | public function testFactory(): void |
|
39 | { |
|
@@ 49-60 (lines=12) @@ | ||
46 | $this->assertEquals(TA::DIGEST_SHA1, $ta->getDigestType()); |
|
47 | } |
|
48 | ||
49 | public function testFromText(): void |
|
50 | { |
|
51 | $expectation = new TA(); |
|
52 | $expectation->setKeyTag(60485); |
|
53 | $expectation->setAlgorithm(Algorithms::RSASHA1); |
|
54 | $expectation->setDigestType(TA::DIGEST_SHA1); |
|
55 | $expectation->setDigest(hex2bin(self::$digest)); |
|
56 | ||
57 | $fromText = new TA(); |
|
58 | $fromText->fromText('60485 5 1 '.self::$digest); |
|
59 | $this->assertEquals($expectation, $fromText); |
|
60 | } |
|
61 | ||
62 | public function testWire(): void |
|
63 | { |