]> Cypherpunks.ru repositories - pyderasn.git/commitdiff
Optionally disallow BER in utility
authorSergey Matveev <stargrave@stargrave.org>
Sun, 20 May 2018 12:18:24 +0000 (15:18 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Sun, 20 May 2018 12:18:24 +0000 (15:18 +0300)
pyderasn.py

index ac74adca037466893af82825115ca0c7bd13269e..ffc788ca6cca7a8529cfa1a3ca93abc57d414675 100755 (executable)
@@ -5037,6 +5037,11 @@ def main():  # pragma: no cover
         "--defines-by-path",
         help="Python path to decoder's defines_by_path",
     )
+    parser.add_argument(
+        "--nobered",
+        action='store_true',
+        help="Disallow BER encoding",
+    )
     parser.add_argument(
         "DERFile",
         type=argparse.FileType("rb"),
@@ -5053,7 +5058,7 @@ def main():  # pragma: no cover
         pprinter = partial(pprint, big_blobs=True)
     else:
         schema, pprinter = generic_decoder()
-    ctx = {"bered": True}
+    ctx = {"bered": not args.nobered}
     if args.defines_by_path is not None:
         ctx["defines_by_path"] = obj_by_path(args.defines_by_path)
     obj, tail = schema().decode(der, ctx=ctx)