X-Git-Url: http://www.git.cypherpunks.ru/?p=pyderasn.git;a=blobdiff_plain;f=pyderasn.py;h=6d1e7eb736235ec29d37853a0b418525a2e16599;hp=717c06cce42d63a15ed38356f71eb92cce217076;hb=3485617cd8e158154eae89c0ef2258e7528e2b3b;hpb=63f01edc8b8f09f07fcc331f92242bbca1db40b7 diff --git a/pyderasn.py b/pyderasn.py index 717c06c..6d1e7eb 100755 --- a/pyderasn.py +++ b/pyderasn.py @@ -261,6 +261,8 @@ defined, ``value`` contains corresponding decoded value. For example above, ``content_info["content"].defined == (id_signedData, signed_data)``. +.. _defines_by_path_kwarg: + defines_by_path kwarg _____________________ @@ -4334,6 +4336,10 @@ def main(): # pragma: no cover "--schema", help="Python path to schema definition to use", ) + parser.add_argument( + "--defines-by-path", + help="Python path to decoder's defines_by_path", + ) parser.add_argument( "DERFile", type=argparse.FileType("rb"), @@ -4349,7 +4355,13 @@ def main(): # pragma: no cover pprinter = partial(pprint, big_blobs=True) else: schema, pprinter = generic_decoder() - obj, tail = schema().decode(der) + obj, tail = schema().decode( + der, + defines_by_path=( + None if args.defines_by_path is None + else obj_by_path(args.defines_by_path) + ), + ) print(pprinter(obj, oids=oids)) if tail != b"": print("\nTrailing data: %s" % hexenc(tail))