File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -160,6 +160,18 @@ public function testExceptionThrownWhenPayloadIsInvalid()
160
160
$ e ->decrypt ($ payload );
161
161
}
162
162
163
+ public function testDecryptionExceptionIsThrownWhenUnexpectedTagIsAdded ()
164
+ {
165
+ $ this ->expectException (DecryptException::class);
166
+ $ this ->expectExceptionMessage ('Unable to use tag because the cipher algorithm does not support AEAD. ' );
167
+
168
+ $ e = new Encrypter (str_repeat ('a ' , 16 ));
169
+ $ payload = $ e ->encrypt ('foo ' );
170
+ $ decodedPayload = json_decode (base64_decode ($ payload ));
171
+ $ decodedPayload ->tag = 'set-manually ' ;
172
+ $ e ->decrypt (base64_encode (json_encode ($ decodedPayload )));
173
+ }
174
+
163
175
public function testExceptionThrownWithDifferentKey ()
164
176
{
165
177
$ this ->expectException (DecryptException::class);
You can’t perform that action at this time.
0 commit comments