Implement crypto.subtle.sign/verify with HMAC (#34223)

* Allow importing HMAC keys

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Implement crypto.subtle.sign with HMAC

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Implement crypto.subtle.verify with HMAC

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Update WPT expectations

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
This commit is contained in:
Simon Wülker 2024-11-11 20:32:51 +01:00 committed by GitHub
parent deddcf2c7a
commit 8d3d7b7403
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 461 additions and 531 deletions

View file

@ -23,103 +23,6 @@
[generate wrong key step: HMAC with SHA-512 verifying with wrong algorithm name]
expected: FAIL
[importVectorKeys step: HMAC with SHA-1 verification]
expected: FAIL
[importVectorKeys step: HMAC with SHA-256 verification]
expected: FAIL
[importVectorKeys step: HMAC with SHA-384 verification]
expected: FAIL
[importVectorKeys step: HMAC with SHA-512 verification]
expected: FAIL
[importVectorKeys step: HMAC with SHA-1 verification with altered signature after call]
expected: FAIL
[importVectorKeys step: HMAC with SHA-256 verification with altered signature after call]
expected: FAIL
[importVectorKeys step: HMAC with SHA-384 verification with altered signature after call]
expected: FAIL
[importVectorKeys step: HMAC with SHA-512 verification with altered signature after call]
expected: FAIL
[importVectorKeys step: HMAC with SHA-1 with altered plaintext]
expected: FAIL
[importVectorKeys step: HMAC with SHA-256 with altered plaintext]
expected: FAIL
[importVectorKeys step: HMAC with SHA-384 with altered plaintext]
expected: FAIL
[importVectorKeys step: HMAC with SHA-512 with altered plaintext]
expected: FAIL
[importVectorKeys step: HMAC with SHA-1 no verify usage]
expected: FAIL
[importVectorKeys step: HMAC with SHA-256 no verify usage]
expected: FAIL
[importVectorKeys step: HMAC with SHA-384 no verify usage]
expected: FAIL
[importVectorKeys step: HMAC with SHA-512 no verify usage]
expected: FAIL
[importVectorKeys step: HMAC with SHA-1 round trip]
expected: FAIL
[importVectorKeys step: HMAC with SHA-256 round trip]
expected: FAIL
[importVectorKeys step: HMAC with SHA-384 round trip]
expected: FAIL
[importVectorKeys step: HMAC with SHA-512 round trip]
expected: FAIL
[importVectorKeys step: HMAC with SHA-1 verification failure due to wrong plaintext]
expected: FAIL
[importVectorKeys step: HMAC with SHA-256 verification failure due to wrong plaintext]
expected: FAIL
[importVectorKeys step: HMAC with SHA-384 verification failure due to wrong plaintext]
expected: FAIL
[importVectorKeys step: HMAC with SHA-512 verification failure due to wrong plaintext]
expected: FAIL
[importVectorKeys step: HMAC with SHA-1 verification failure due to wrong signature]
expected: FAIL
[importVectorKeys step: HMAC with SHA-256 verification failure due to wrong signature]
expected: FAIL
[importVectorKeys step: HMAC with SHA-384 verification failure due to wrong signature]
expected: FAIL
[importVectorKeys step: HMAC with SHA-512 verification failure due to wrong signature]
expected: FAIL
[importVectorKeys step: HMAC with SHA-1 verification failure due to short signature]
expected: FAIL
[importVectorKeys step: HMAC with SHA-256 verification failure due to short signature]
expected: FAIL
[importVectorKeys step: HMAC with SHA-384 verification failure due to short signature]
expected: FAIL
[importVectorKeys step: HMAC with SHA-512 verification failure due to short signature]
expected: FAIL
[hmac.https.any.worker.html]
[generate wrong key step: HMAC with SHA-1 signing with wrong algorithm name]
expected: FAIL
@ -143,100 +46,4 @@
expected: FAIL
[generate wrong key step: HMAC with SHA-512 verifying with wrong algorithm name]
expected: FAIL
[importVectorKeys step: HMAC with SHA-1 verification]
expected: FAIL
[importVectorKeys step: HMAC with SHA-256 verification]
expected: FAIL
[importVectorKeys step: HMAC with SHA-384 verification]
expected: FAIL
[importVectorKeys step: HMAC with SHA-512 verification]
expected: FAIL
[importVectorKeys step: HMAC with SHA-1 verification with altered signature after call]
expected: FAIL
[importVectorKeys step: HMAC with SHA-256 verification with altered signature after call]
expected: FAIL
[importVectorKeys step: HMAC with SHA-384 verification with altered signature after call]
expected: FAIL
[importVectorKeys step: HMAC with SHA-512 verification with altered signature after call]
expected: FAIL
[importVectorKeys step: HMAC with SHA-1 with altered plaintext]
expected: FAIL
[importVectorKeys step: HMAC with SHA-256 with altered plaintext]
expected: FAIL
[importVectorKeys step: HMAC with SHA-384 with altered plaintext]
expected: FAIL
[importVectorKeys step: HMAC with SHA-512 with altered plaintext]
expected: FAIL
[importVectorKeys step: HMAC with SHA-1 no verify usage]
expected: FAIL
[importVectorKeys step: HMAC with SHA-256 no verify usage]
expected: FAIL
[importVectorKeys step: HMAC with SHA-384 no verify usage]
expected: FAIL
[importVectorKeys step: HMAC with SHA-512 no verify usage]
expected: FAIL
[importVectorKeys step: HMAC with SHA-1 round trip]
expected: FAIL
[importVectorKeys step: HMAC with SHA-256 round trip]
expected: FAIL
[importVectorKeys step: HMAC with SHA-384 round trip]
expected: FAIL
[importVectorKeys step: HMAC with SHA-512 round trip]
expected: FAIL
[importVectorKeys step: HMAC with SHA-1 verification failure due to wrong plaintext]
expected: FAIL
[importVectorKeys step: HMAC with SHA-256 verification failure due to wrong plaintext]
expected: FAIL
[importVectorKeys step: HMAC with SHA-384 verification failure due to wrong plaintext]
expected: FAIL
[importVectorKeys step: HMAC with SHA-512 verification failure due to wrong plaintext]
expected: FAIL
[importVectorKeys step: HMAC with SHA-1 verification failure due to wrong signature]
expected: FAIL
[importVectorKeys step: HMAC with SHA-256 verification failure due to wrong signature]
expected: FAIL
[importVectorKeys step: HMAC with SHA-384 verification failure due to wrong signature]
expected: FAIL
[importVectorKeys step: HMAC with SHA-512 verification failure due to wrong signature]
expected: FAIL
[importVectorKeys step: HMAC with SHA-1 verification failure due to short signature]
expected: FAIL
[importVectorKeys step: HMAC with SHA-256 verification failure due to short signature]
expected: FAIL
[importVectorKeys step: HMAC with SHA-384 verification failure due to short signature]
expected: FAIL
[importVectorKeys step: HMAC with SHA-512 verification failure due to short signature]
expected: FAIL
expected: FAIL