New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

distinguishedname

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

distinguishedname

I parse and create RFC2253 compliant distinguished names (DNs)

  • 1.0.2
  • PyPI
  • Socket score

Maintainers
1

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

>>> 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 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.

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc