[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)
commitd8f07b190a019f8ff2dffeac37072850d0f5c0b5
tree2b56f5d90284b834f517b49572b773cea9658159
parent389ebbf82690fc06949df81e81cfcbc525724148
[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: https://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