Description[webcrypto] Implement structured clone of keys (blink-side).
The format looks like this:
subtag:byte // The type of key
keySpecificProperties // Block of key specific algorithm info
usages:uint32 // Bitfield of usages + extractability
keyDataLength:uint32 // Block of data controlled by embedder
keyData:byte[keyDataLength]
subtag influences how keySpecificProperties is interpreted:
[If subtag=AesKeyTag]
keyLengthBytes:uint32 // 16, 24, or 32
algorithmId:uint32
[If subtag=HmacKeyTag]
keyLengthBytes:uint32
hashId:uint32
[If subtag=RsaKeyTag]
algorithmId:uint32
type:uint32 // One of {PublicKeyType, PrivateKeyType}
modulusLengthBits:uint32
publicExponentLength:uint32
publicExponent:byte[publicExponentLength]
[If subtag=RsaHashedKeyTag]
<Same as for RsaKeyTag>
hashId:uint32
Note that uint32 is encoded as a variable length number. In practice it ends up being a single byte for most of the uses above.
In this design, blink is responsible for serializing all of the key's attributes except for the actual key data which is left to the embedder.
The included tests rely on the chromium side of structured clone landing:
https://codereview.chromium.org/196513002/
The tests cover serialization of hmac, aes and rsa public keys. I haven't added tests for serialization of rsa private keys yet, since that part is not done on the chromium side.
BUG=245025
Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=169633
Patch Set 1 : #
Total comments: 5
Patch Set 2 : Update comments #Patch Set 3 : fix another comment #
Total comments: 30
Patch Set 4 : Fixes for jsbell #
Total comments: 3
Patch Set 5 : Fix broken test, and remove WebCryptoKeyUsage shift #Patch Set 6 : Rebase #Patch Set 7 : Rebase #Patch Set 8 : Remove SHA224 and add HMAC key length #Patch Set 9 : remove trailing space #Patch Set 10 : Update serialized-script-value.html for version bump #Messages
Total messages: 42 (0 generated)
|