wbond / asn1crypto

Python ASN.1 library with a focus on performance and a pythonic API
MIT License
335 stars 140 forks source link

x509.name.build without sorting #212

Open baynes opened 3 years ago

baynes commented 3 years ago

It would be useful for asn1crypto.x509.Name.build()` to have an option to turn off the sorting the relative names into its preferred order and keep the input order. Some specifications require their own specific order.

wbond commented 3 years ago

You don't have to use build if you don't want that behavior.

If you've got an idea of an enhancement, also feel free to propose via a PR.

adiroiban commented 1 year ago

@wbond thanks for this nice library. Brilliant work!

@baynes do you know which specifications require a specific order?

I still think that this feature is useful to work around some legacy/buggy libraries or external API.

I found this issue with the IBM Data Power Gateway.

I went with a simple patch. If name_dict is already an OrderedDict, don't sort it.

I am not sure if this is the best general solution.

I am not a fan of flag arguments, but maybe Name.build(name_dict, sort=False) can also do the job.

Cheers