Package ndg :: Package saml :: Package utils :: Module m2crypto :: Class X500DN
[hide private]

Class X500DN

source code


NDG X500 Distinguished name

Instance Methods [hide private]
new empty dictionary

__init__(self, dn=None, m2CryptoX509Name=None, separator=None)
Create a new X500 Distinguished Name
source code
 
__repr__(self)
Give representation based on underlying dict object
source code
 
__str__(self)
Behaviour for print and string statements - convert DN into serialised format.
source code
 
__eq__(self, x500dn)
Return true if the all the fields of the two DNs are equal
source code
 
__ne__(self, x500dn)
Return true if the all the fields of the two DNs are equal
source code
 
__delitem__(self, key)
Prevent keys from being deleted.
source code
 
__getitem__(self, key)
x[y]
source code
 
__setitem__(self, key, item)
x[i]=y
source code
None
clear(self)
Remove all items from D.
source code
a shallow copy of D
copy(self) source code
list of D's keys
keys(self) source code
list of D's (key, value) pairs, as 2-tuples
items(self) source code
list of D's values
values(self) source code
True if D has a key k, else False
has_key(self, key) source code
True if D has a key k, else False
__contains__(self, key) source code
D[k] if k in D, else d
get(self, *arg)
d defaults to None.
source code
 
serialise(self, separator=None)
Combine fields in Distinguished Name into a single string.
source code
 
serialize(self, separator=None)
Combine fields in Distinguished Name into a single string.
source code
 
deserialise(self, dn, separator=None)
Break up a DN string into it's constituent fields and use to update the object's dictionary
source code
 
deserialize(self, dn, separator=None)
Break up a DN string into it's constituent fields and use to update the object's dictionary
source code
 
parseSeparator(self, dn)
Attempt to parse the separator character from a given input DN string.
source code

Inherited from dict: __cmp__, __ge__, __getattribute__, __gt__, __iter__, __le__, __len__, __lt__, __new__, __sizeof__, fromkeys, iteritems, iterkeys, itervalues, pop, popitem, setdefault, update, viewitems, viewkeys, viewvalues

Inherited from object: __delattr__, __format__, __reduce__, __reduce_ex__, __setattr__, __subclasshook__

Class Methods [hide private]
 
fromString(cls, dn)
Convenience method for parsing DN string into a new instance
source code
 
Parse(cls, dn)
Convenience method to create an X500DN object from a DN string
source code
 
Deserialize(cls, dn)
Convenience method to create an X500DN object from a DN string
source code
 
Deserialise(cls, dn)
Convenience method to create an X500DN object from a DN string
source code
Class Variables [hide private]
  __shortNameLUT = {'commonName': 'CN', 'countryName': 'C', 'dom...
  SLASH_PARSER_RE_STR = '/(countryName|userid|streetAddress|emai...
  SLASH_PARSER_RE = re.compile(r'/(countryName|userid|streetAddr...
  COMMA_PARSER_RE_STR = '[,]?\\s*(countryName|userid|streetAddre...
  COMMA_PARSER_RE = re.compile(r',?\s*(countryName|userid|street...

Inherited from dict: __hash__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, dn=None, m2CryptoX509Name=None, separator=None)
(Constructor)

source code 

Create a new X500 Distinguished Name

Parameters:
  • m2CryptoX509Name (M2Crypto.X509.X509_Name) - initialise using using an M2Crypto.X509.X509_Name
  • dn (basestring) - initialise using a distinguished name string
  • separator (basestring)
Returns:
new empty dictionary

Overrides: object.__init__

__repr__(self)
(Representation operator)

source code 

Give representation based on underlying dict object

Overrides: object.__repr__

__str__(self)
(Informal representation operator)

source code 

Behaviour for print and string statements - convert DN into serialised format.

Overrides: object.__str__

__eq__(self, x500dn)
(Equality operator)

source code 

Return true if the all the fields of the two DNs are equal

Overrides: dict.__eq__

__ne__(self, x500dn)

source code 

Return true if the all the fields of the two DNs are equal

Overrides: dict.__ne__

__delitem__(self, key)
(Index deletion operator)

source code 

Prevent keys from being deleted.

Overrides: dict.__delitem__

__getitem__(self, key)
(Indexing operator)

source code 

x[y]

Overrides: dict.__getitem__
(inherited documentation)

__setitem__(self, key, item)
(Index assignment operator)

source code 

x[i]=y

Overrides: dict.__setitem__
(inherited documentation)

clear(self)

source code 

Remove all items from D.

Returns: None
Overrides: dict.clear
(inherited documentation)

copy(self)

source code 
Returns: a shallow copy of D
Overrides: dict.copy
(inherited documentation)

keys(self)

source code 
Returns: list of D's keys
Overrides: dict.keys
(inherited documentation)

items(self)

source code 
Returns: list of D's (key, value) pairs, as 2-tuples
Overrides: dict.items
(inherited documentation)

values(self)

source code 
Returns: list of D's values
Overrides: dict.values
(inherited documentation)

has_key(self, key)

source code 
Returns: True if D has a key k, else False
Overrides: dict.has_key
(inherited documentation)

__contains__(self, key)
(In operator)

source code 
Returns: True if D has a key k, else False
Overrides: dict.__contains__
(inherited documentation)

get(self, *arg)

source code 

d defaults to None.

Returns: D[k] if k in D, else d
Overrides: dict.get
(inherited documentation)

parseSeparator(self, dn)

source code 

Attempt to parse the separator character from a given input DN string. If not found, return None

DNs don't use standard separators e.g.

/C=UK/O=eScience/OU=CLRC/L=DL/CN=AN Other CN=SUM Oneelse,L=Didcot, O=RAL,OU=SSTD

This function isolates and identifies the character. - In the above, '/' and ',' respectively

Parse(cls, dn)
Class Method

source code 

Convenience method to create an X500DN object from a DN string

Parameters:
  • dn (basestring) - Distinguished Name

Deserialize(cls, dn)
Class Method

source code 

Convenience method to create an X500DN object from a DN string

Parameters:
  • dn (basestring) - Distinguished Name

Deserialise(cls, dn)
Class Method

source code 

Convenience method to create an X500DN object from a DN string

Parameters:
  • dn (basestring) - Distinguished Name

Class Variable Details [hide private]

__shortNameLUT

Value:
{'commonName': 'CN',
 'countryName': 'C',
 'domainComponent': 'DC',
 'emailAddress': 'EMAILADDRESS',
 'localityName': 'L',
 'organisation': 'O',
 'organisationalUnitName': 'OU',
 'stateOrProvinceName': 'ST',
...

SLASH_PARSER_RE_STR

Value:
'/(countryName|userid|streetAddress|emailAddress|domainComponent|local\
ityName|organisationalUnitName|organisation|commonName|stateOrProvince\
Name|C|UID|STREET|EMAILADDRESS|DC|L|OU|O|CN|ST)='

SLASH_PARSER_RE

Value:
re.compile(r'/(countryName|userid|streetAddress|emailAddress|domainCom\
ponent|localityName|organisationalUnitName|organisation|commonName|sta\
teOrProvinceName|C|UID|STREET|EMAILADDRESS|DC|L|OU|O|CN|ST)=')

COMMA_PARSER_RE_STR

Value:
'[,]?\\s*(countryName|userid|streetAddress|emailAddress|domainComponen\
t|localityName|organisationalUnitName|organisation|commonName|stateOrP\
rovinceName|C|UID|STREET|EMAILADDRESS|DC|L|OU|O|CN|ST)='

COMMA_PARSER_RE

Value:
re.compile(r',?\s*(countryName|userid|streetAddress|emailAddress|domai\
nComponent|localityName|organisationalUnitName|organisation|commonName\
|stateOrProvinceName|C|UID|STREET|EMAILADDRESS|DC|L|OU|O|CN|ST)=')