diff --git a/packager/tools/pssh/pssh-box.py b/packager/tools/pssh/pssh-box.py index 9fb9bf4338..4e8fe12705 100755 --- a/packager/tools/pssh/pssh-box.py +++ b/packager/tools/pssh/pssh-box.py @@ -266,11 +266,15 @@ def _parse_boxes(data): def _create_argument_parser(): """Creates an argument parser.""" + def hex_16_bytes(string): if not string or len(string) != 32: raise argparse.ArgumentTypeError( 'Must be a 32-character hex string, %d given' % len(string)) - return base64.b16decode(string) + return base64.b16decode(string.upper()) + + def hex_bytes(string): + return base64.b16decode(string.upper()) parser = argparse.ArgumentParser( formatter_class=argparse.RawDescriptionHelpFormatter, @@ -317,7 +321,7 @@ generate a v0 PSSH box for compatibility reasons.""") inputs.add_argument('--from-hex', metavar='', dest='input', - type=base64.b16decode, + type=hex_bytes, help='Parse the given hexadecimal encoded PSSH box') system_ids = parser.add_mutually_exclusive_group() @@ -349,7 +353,7 @@ generate a v0 PSSH box for compatibility reasons.""") help='Sets the extra data') extra.add_argument('--content-id', metavar='', - type=base64.b16decode, + type=hex_bytes, help='Sets the content ID of the Widevine PSSH data') extra.add_argument('--provider', metavar='',