Files
Bento4/Test/Python/aeskeywrap_test.py
bok 9f48dd735f Added basic support for parsing sidx indexes
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
2014-10-03 22:29:01 +00:00

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!'