mirror of
https://github.com/axiomatic-systems/Bento4.git
synced 2026-01-19 00:05:12 +08:00
Added support for interfacing with key servers using the SKM API (mp4-dash) Fixed invalid 16-bit truncation when encrypting large frames with MPEG CENC Fixed minor warnings
22 lines
547 B
Python
22 lines
547 B
Python
import skm
|
|
import random
|
|
|
|
key = '00112233445566778899AABBCCDDEEFF'
|
|
kek = '000102030405060708090A0B0C0D0E0F'
|
|
wk = skm.WrapKey(key, kek)
|
|
|
|
wk_ref = '1FA68B0A8112B447AEF34BD8FB5A7B829D3E862371D2CFE5'.decode('hex')
|
|
if wk != wk_ref:
|
|
raise 'Boum!'
|
|
|
|
uk = skm.UnwrapKey(wk, kek)
|
|
if uk != key.decode('hex'):
|
|
raise 'Boum!'
|
|
|
|
for i in range(1000):
|
|
key = ''.join(chr(random.randint(0,255)) for _ in range(16))
|
|
kek = ''.join(chr(random.randint(0,255)) for _ in range(16))
|
|
wk = skm.WrapKey(key, kek)
|
|
uk = skm.UnwrapKey(wk, kek)
|
|
if uk != key:
|
|
raise 'Bam!' |