File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -101,4 +101,29 @@ public function testWhenGetNonceExtensionSuccess(): void
101101
102102 $ this ->assertEquals ("nonce " , $ request ->getNonceExtension ());
103103 }
104+
105+ public function testBinaryNonce (): void
106+ {
107+ // Create a nonce with a mixture of potentially problematic bytes,
108+ // null bytes, control characters and high-byte values (above 0x7F),
109+ // which are common sources of string decoding problems.
110+ $ nonce = "\0\1\2\3\4\5\6\7\x08\x09\x10\0"
111+ . "\x0A\x0D\x1B"
112+ . "\xE2\x82\xAC"
113+ . "\xFF" ;
114+ $ request = new OcspRequest ();
115+ $ request ->addNonceExtension ($ nonce );
116+
117+ $ this ->assertEquals ($ nonce , $ request ->getNonceExtension ());
118+ }
119+
120+ public function testOidNonce (): void
121+ {
122+ // Create a nonce that contains DER-encoded OID for SHA-256: 2.16.840.1.101.3.4.2.1.
123+ $ nonce = "\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x01" ;
124+ $ request = new OcspRequest ();
125+ $ request ->addNonceExtension ($ nonce );
126+
127+ $ this ->assertEquals ($ nonce , $ request ->getNonceExtension ());
128+ }
104129}
You can’t perform that action at this time.
0 commit comments