Skip to content

Partial implementation for SubtleCrypto#1103

Merged
rbri merged 6 commits intoHtmlUnit:masterfrom
duonglaiquang:duong_crypto
Mar 16, 2026
Merged

Partial implementation for SubtleCrypto#1103
rbri merged 6 commits intoHtmlUnit:masterfrom
duonglaiquang:duong_crypto

Conversation

@duonglaiquang
Copy link
Contributor

This PR does the following

Partially implements SubtleCrypto operations following W3C Web Cryptography API.

What's implemented

Operation Supported algorithms
digest() SHA-1, SHA-256, SHA-384, SHA-512
generateKey() RSASSA-PKCS1-v1_5, RSA-PSS, RSA-OAEP, ECDSA, ECDH, AES-CBC, AES-CTR, AES-GCM, AES-KW, HMAC
importKey("raw") HMAC, AES-CBC, AES-CTR, AES-GCM, AES-KW
exportKey("raw") HMAC, AES-CBC, AES-CTR, AES-GCM, AES-KW
sign() HMAC, RSASSA-PKCS1-v1_5, RSA-PSS, ECDSA
verify() HMAC, RSASSA-PKCS1-v1_5, RSA-PSS, ECDSA
encrypt() AES-CBC, AES-GCM, AES-CTR, RSA-OAEP
decrypt() AES-CBC, AES-GCM, AES-CTR, RSA-OAEP

Not yet implemented

  • importKey for formats pkcs8, spki, jwk
  • exportKey for formats pkcs8, spki, jwk
  • exportKey("raw") for ECDSA, ECDH
  • wrapKey, unwrapKey
  • deriveKey, deriveBits

@sonarqubecloud
Copy link

"Data provided to an operation does not meet requirements");
}
final SecretKey secretKey = getInternalKey(key, SecretKey.class);
final Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");

Check failure

Code scanning / CodeQL

Use of a broken or risky cryptographic algorithm High

Cryptographic algorithm
AES/CBC/PKCS5Padding
is insecure. CBC mode with PKCS#5 or PKCS#7 padding is vulnerable to padding oracle attacks. Consider using GCM instead.
@rbri
Copy link
Member

rbri commented Mar 16, 2026

Wow 😮

@rbri rbri merged commit 6400fb9 into HtmlUnit:master Mar 16, 2026
5 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants