Closed Bug 1059926 Opened 9 years ago Closed 9 years ago

Expand DottedOidToCode.py's output options

Categories

(Core :: Security: PSM, defect)

defect
Not set
minor

Tracking

()

RESOLVED FIXED
mozilla34

People

(Reporter: briansmith, Assigned: briansmith)

References

Details

Attachments

(1 file)

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
Closed: 9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.