Repository navigation
Use crypto.subtle for AES on Browser WASM - #71501
Merged
Merged
Conversation
Implement the browser "native" portion for AES on Browser WASM. There are two issues to solve .NET's Aes API on crypto.subtle: 1. The .NET API supports streaming while crypto.subtle only supports "one shot" APIs. 2. The .NET API supports multiple padding modes while crypto.subtle only supports PKCS7. To solve these issues, we use the following approach: 1. We only invoke crypto.subtle with complete AES "blocks" of data. This allows us to make assumptions about the padding behavior. 2. To implement streaming, remember the last block of the previous cipher text to use as the IV for the next stream of data. 3. When encrypting, since we have a complete block of data and crypto.subtle uses PKCS7 padding, strip off the last block of cipher text which will always be a full block of padding. 4. When decrypting do the inverse of encrypting - append an encrypted block of padding to the cipher text so crypto.subtle will return the full message as plain text. Other changes: - Make a few refactoring / simplifications where necessary. - SubtleCrypto doesn't support 192 bit AES keys, so no longer support AES-192 on Browser. Contributes to dotnet#40074
|
Tagging subscribers to this area: @dotnet/area-system-security, @vcsjones Issue DetailsImplement the browser "native" portion for AES on Browser WASM. There are two issues to solve .NET's Aes API on crypto.subtle:
To solve these issues, we use the following approach:
Other changes:
Contributes to #40074
|
|
Tagging subscribers to 'arch-wasm': @lewing Issue DetailsImplement the browser "native" portion for AES on Browser WASM. There are two issues to solve .NET's Aes API on crypto.subtle:
To solve these issues, we use the following approach:
Other changes:
Contributes to #40074
|
vcsjones
reviewed
Jun 30, 2022
vcsjones
reviewed
Jun 30, 2022
vcsjones
reviewed
Jun 30, 2022
bartonjs
reviewed
Jul 5, 2022
bartonjs
approved these changes
Jul 5, 2022
Member
Author
|
Failure is #69832 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implement the browser "native" portion for AES on Browser WASM.
There are two issues to solve .NET's Aes API on crypto.subtle:
To solve these issues, we use the following approach:
Other changes:
Contributes to #40074