Expand DottedOidToCode.py's output options

RESOLVED FIXED in mozilla34

Status

()

--
minor
RESOLVED FIXED
4 years ago
4 years ago

People

(Reporter: briansmith, Assigned: briansmith)

Tracking

Trunk
mozilla34
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

Created attachment 8480734 [details] [diff] [review]
dotted-oid-improvement.patch

This patch expands DottedOidToCode.py by giving it two optional and mutually-exclusive options, "--tlv" and "--alg". Without either option, DottedOidToCode.py continues to output just the encoded OID value, without the tag and length. With "--tlv", the tag and length are prepended to the output. With "--alg", the output of "--tlv" is wrapped in a SEQUENCE so that it becomes a valid AlgorithmIdentifier.

This expanded functionality is used in an upcoming patch; when I file that bug, I will add the bug dependency.
Attachment #8480734 - Flags: review?(dkeeler)
Comment on attachment 8480734 [details] [diff] [review]
dotted-oid-improvement.patch

Review of attachment 8480734 [details] [diff] [review]:
-----------------------------------------------------------------

Looks good.

::: security/pkix/tools/DottedOIDToCode.py
@@ +49,5 @@
>          value /= 0x80
>  
>      return result
> +
> +def dottedOIDToEncodedArray(dottedOID):

nit: docstring for this function?

@@ +155,4 @@
>  
>  if __name__ == "__main__":
> +    parser = argparse.ArgumentParser(
> +                 description="Generate code snippets for handle OIDs in C++",

nit: "to handle" (or "for handling")

@@ +178,5 @@
> +
> +    print(toCode(sys.argv[0], args.name, args.dottedOID, mode))
> +
> +    # print("
> +    #       , file=sys.stderr)

nit: remove these lines
Attachment #8480734 - Flags: review?(dkeeler) → review+
Thanks for the review! I made the changes you suggested:

https://hg.mozilla.org/integration/mozilla-inbound/rev/2a11f29863a1
Target Milestone: --- → mozilla34
https://hg.mozilla.org/mozilla-central/rev/2a11f29863a1
Status: ASSIGNED → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.