DN(3pm)

πŸ“¦
version 0.29 Β· 3 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– X500::DN β€” DN(3pm) πŸ’–

okay bestie, so this is the manual page for X500::DN, a Perl module that handles X.500 DNs (Distinguished Names) β€” it parses them and formats them, and it's giving extremely niche but extremely useful πŸ’…


✨ NAME ✨

X500::DN β€” handle X.500 DNs (Distinguished Names), parse and format them. no cap, that's the whole job description 🫢


πŸŽ€ SYNOPSIS πŸŽ€

use X500::DN;

my $dn = X500::DN->ParseRFC2253 ('cn=John Doe, o=Acme\\, Inc., c=US') or die;
print $dn->getRFC2253String(), "\n";

$dn = new X500::DN (new X500::RDN ('c'=>'US'), new X500::RDN ('cn'=>'John Doe'));
my $rdn0 = $dn->getRDN (0);
my $c = $rdn0->getAttributeValue ('c');

look at her go 😭 she's parsing AND formatting AND being iconic about it


πŸ¦‹ NOTE πŸ¦‹

bestie this part is so important, listen up πŸ‘‘

The RFC 2253 syntax is explicitely backwards in relation to the ASN.1 SEQUENCE.

So the RFC 2253 string "cn=John Doe, c=US" has the same meaning as the X.500 string "c=US, cn=John Doe". And the X500::DN objects keep the RDNs in X.500 order!

fr fr, it's reversed. it's giving "walked in backwards on purpose". don't let it catch you off guard πŸ™ˆ

🌸 DESCRIPTION 🌸

This module handles X.500 DNs (Distinguished Names). Currently, it parses DN strings formatted according to RFC 2253 syntax into an internal format and produces RFC 2253 formatted string from it.

lowkey a glow-up pipeline: string in, object out, string out again ✨

πŸ’… Methods πŸ’…

  • $object = new X500::DN (rdn, rdn, ...); β€” Creates a DN object from zero or more arguments of type X500::RDN. zero args? valid. she's flexible like that πŸŽ€
  • $object = X500::DN->ParseRFC2253 ('cn=John Doe, o=Acme\\, Inc., c=US'); β€” Creates a DN object from an RFC 2253 formatted DN string notation.
  • $object->getRFC2253String(); β€” Returns the DN as a string formatted according to RFC 2253 syntax.
  • $object->getOpenSSLString(); β€” Returns the DN as a string formatted suitable for openssl req -subj and openssl ca -subj. yes, that openssl 🧚
  • $object->getX500String(); β€” Returns the DN as a string formatted according to X.500 syntax.
NOTE: This is a hack, there is no definition for a X.500 string syntax! she said it herself, don't come for her πŸ’€
  • $object->hasMultivaluedRDNs(); β€” Returns whether the DN contains multi-valued RDNs. yes/no, simple, we love a yes/no queen 🌈
  • $object->getRDN (num); β€” Returns the DN's RDN at position num as an X500::RDN object. num starts with 0, which will return the first RDN in ASN.1 SEQUENCE order. zero-indexed besties, we start at 0 here ⭐
  • $object->getRDNs(); β€” Returns the DN's RDNs, a list of objects of type X500::RDN, in ASN.1 SEQUENCE order.

πŸ“ EXPORT πŸ“

None. nothing jumps out at you, no surprise imports, no chaos. she's self-contained, periodt πŸ’…


πŸ’€ BUGS πŸ’€

  • Due to Parse::RecDescent's greedyness, white space after attribute values gets into the parsed value. It might be possible to work around this.
ngl she's a little greedy 😭 it's giving "took the whitespace too, sorry bestie". it might be possible to work around this, but that's a future era πŸ‘‘

πŸ‘‘ AUTHOR πŸ‘‘

Robert Joop <yaph-070708@timesink.de>

the main character who wrote her 🫢


Copyright 2002 Robert Joop. All Rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


πŸ’œ SEE ALSO πŸ’œ

  • X500::RDN β€” her bestie, the other half of the duo πŸŽ€
  • perl β€” the whole reason we're here, obviously 🌸

⭐ HISTORY ⭐

  • Early 2002: First idea, discussed on comp.lang.perl.moderated
  • April 2002: First public release, 0.15

okay that's the whole page bestie, every flag, every method, every vibe, fully intact, no notes πŸ’– iykyk

signing off: this was perl v5.36.0, dated 2022-12-12, and the manual page you just read is DN(3pm) πŸ¦‹βœ¨

πŸ“¦ where this page comes from