[EME] InitDataRegistry should use base64url encoding and decoding for keyids
authorzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 31 Jan 2017 11:41:07 +0000 (11:41 +0000)
committerzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 31 Jan 2017 11:41:07 +0000 (11:41 +0000)
commitfade06e968053ec1d664a0e815ed50273c288e55
tree2b56f5d90284b834f517b49572b773cea9658159
parentd1ffcf4a429b61cfbeefd77c4974bbda03a8c024
[EME] InitDataRegistry should use base64url encoding and decoding for keyids
https://bugs.webkit.org/show_bug.cgi?id=167592

Reviewed by Jer Noble.

Source/WebCore:

In InitDataRegistry, WTF::base64URLEncode() and WTF::base64URLDecode() should
be used to encode and decode the 'keyids' initialization data format, as
required by the relevant specification.
https://w3c.github.io/encrypted-media/format-registry/initdata/keyids.html#format

Relevant test case was added to media/encrypted-media/mock-MediaKeySession-generateRequest.html.

* Modules/encryptedmedia/InitDataRegistry.cpp:
(WebCore::extractKeyIDsKeyids):
(WebCore::sanitizeKeyids):

LayoutTests:

* media/encrypted-media/mock-MediaKeySession-generateRequest-expected.txt:
* media/encrypted-media/mock-MediaKeySession-generateRequest.html: Include a test case
that passes an init data JSON to generateRequest() that fails to decode when using the
plain base64 decoding algorithm. The test passes when base64url encoding and decoding
are used in InitDataRegistry.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@211429 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/media/encrypted-media/mock-MediaKeySession-generateRequest-expected.txt
LayoutTests/media/encrypted-media/mock-MediaKeySession-generateRequest.html
Source/WebCore/ChangeLog
Source/WebCore/Modules/encryptedmedia/InitDataRegistry.cpp