Metadata-Version: 2.1
Name: distinguishedname
Version: 1.0.0
Summary: I parse and create RFC2253 compliant distringuished names (DNs)
Author-email: Mark Wright <markscottwright@gmail.com>
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Project-URL: Homepage, https://github.com/markscottwright/distinguishedname
Project-URL: Issues, https://github.com/markscottwright/distinguishedname/issues

# distinguishedname
Parse RFC 2253 Distinguished Names from strings and create strings from DNs (which
are implemented here as lists of RDNs - which are lists of strings in "TAG=VALUE" 
format).

# Examples
```python
>>> string_to_dn(r'CN=   James \"Bond\" +UID= 007, OU = 00 Division\, Special Services, O=MI5,C=UK')
[['CN=James "Bond"', 'UID=007'], ['OU=00 Division, Special Services'], ['O=MI5'], ['C=UK']]

>>> dn_to_string([['CN="Pinkie" Stevens', 'UID=1'], ['O= Name With Spaces ']])
'CN=\\"Pinkie\\" Stevens+UID=1,O=\\20Name With Spaces\\20'
```

# Rationale
I couldn't find any existing libraries for this.  In theory, [python-ldap][1] has a DN class that 
should be able to do this, but I've never been able to `pip install` it successfully.

This is essentially a single file, so you could also just drop this file into your project, ansible
module, CLI script or whatever.


[1]: https://www.python-ldap.org/en/python-ldap-3.4.3/ "python-ldap"


