VERSION | 2 +- doc/news.rst | 2 ++ pyderasn.py | 14 +++++++++++++- diff --git a/VERSION b/VERSION index 732e1ee09480cbf8b1eb6ba6981bb5c556666ddc559d55df9d54e7b2afba5a78..b009f7c30b47d358b014f374c483415ef17de90969cf8a825a96a86d80cdcf5d 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.4 +1.5 diff --git a/doc/news.rst b/doc/news.rst index e20fc23840f3c94e68ebf6ed8aee0772a43a06c077f7caca71ef6444a38bb4a7..0768548abfd3bee20a65ae9fcf4c89cccd2178ebfcc10e1822bd313500a5a951 100644 --- a/doc/news.rst +++ b/doc/news.rst @@ -7,6 +7,8 @@ 1.5 --- * Generic decoder's scheme and pretty printer (:py:func:`pyderasn.generic_decoder`) can be used in libraries. +* Ability to specify :ref:`defines_by_path ` + during command line invocation. .. _release1.4: diff --git a/pyderasn.py b/pyderasn.py index dd318a6551875e9a0ecb1d03acb9fed7c102a2348cb9e2b640d82e9251f290bb..0e1c5a8a6bd5862170a6e933e3b4c74e7a169c456c98a0e11a352ffd377576c2 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 _____________________ @@ -4335,6 +4337,10 @@ "--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"), help="Path to DER file you want to decode", @@ -4349,7 +4355,13 @@ from functools import partial 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))