paseto-standard / test-vectors

Test vectors for PASETO, PASERK, etc.
Other
6 stars 4 forks source link

Test vectors for key wrapping might be wrong. #9

Closed dajiaji closed 2 years ago

dajiaji commented 2 years ago

Because of the bug that I mentioned in https://github.com/paragonie/paserk-php/pull/3, I think key wrapping test vectors are wrong.

For example, the PASERK data in "k2.local-wrap.pie.json" would look like the following as an example:

       "name": "k2.local-wrap.pie-1",
       "unwrapped": "0000000000000000000000000000000000000000000000000000000000000000",
       "wrapping-key":"707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f",
-      "paserk": "k2.local-wrap.pie.KSwNnZjKHll5ON5FXI9-rJ_4WVTA9mBvEDeiZ_ThU0vVrPCM7d2hLOqoPF09hCqAbX460a8En1qjInyQ9Rxr4Jvb3ish_Z90RY8lYRCX9q9ehcY3-M87HEXpb9el4YrG"
+      "paserk": "k2.local-wrap.pie.vvUtoAJZQiG67EqLHLM-h7rJqS79K8Tg0lUNSxprDtRMT-gJEKZGf_teH3MOCdJWGf0D_G_MU-jg_jgG26-vxhMPuEmrQKu7LN2jzv1hPDgMF_Wd2Pp1rOxf1ITbeZMy"
     },
     {
       "name": "k2.local-wrap.pie-2",
       "unwrapped": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
       "wrapping-key": "707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f",
-      "paserk": "k2.local-wrap.pie.Sjnrhha_9ZO77xOIrkL6wioU4cHiIxqS2dLYj6L2dnxPSSBeTN5yUjLbNyku35ct550gQeaIdDaBTrNBwEohbrM_FIG6zit_D4ba25xU5jjUtNg6xN7wD0bRT2ucHF8W"
+      "paserk": "k2.local-wrap.pie.eMkOihjSKr01gxPqj1oFpYDQ66YSmkIFaFxXwjGWh0wOojzEOSxTvoZc84S7ocpyz1lzaRVLHGRO_gnG_TlgPGlPCv2Ua3GpIqsVkxn60Gi5tap46vp0Rw6hA76SXVdq"
     }

I could send a PR to fix them, but you probably have your own style of creating test data, so please fix them.

paragonie-security commented 2 years ago

All of these tests are automatically tested here: https://github.com/paragonie/paserk-php/tree/master/tests/KAT

The JSON files are replicated here: https://github.com/paragonie/paserk-php/tree/master/tests/test-vectors

paragonie-security commented 2 years ago

https://github.com/paragonie/paserk-php/commit/c2194adbd2faa9a9f26c2fc833f40964e3085beb And. indeed, it breaks.

dajiaji commented 2 years ago

Sorry. I guess I should have asked you to fix this.

Should I fix it? Or should I leave it to you?

paragonie-security commented 2 years ago

https://github.com/paseto-standard/test-vectors/commit/ef0774f877cff26fc51fe43dfc6fdab91295326e fixed