[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 Review URL: https://codereview.chromium.org/195543002 git-svn-id: svn://svn.chromium.org/blink/trunk@169633 bbb929c8-8fbe-4397-9dbb-9b2b20218538
Showing
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Please register or sign in to comment