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

Class X509Stack

source code


Wrapper for M2Crypto X509_Stack

Instance Methods [hide private]
 
__init__(self, m2X509Stack=None)
Initialise from an M2Crypto stack object
source code
int
__len__(self)
Returns: length of stack
source code
ndg.security.common.X509.X509Cert
__getitem__(self, idx)
Index stack as an array
source code
listiterator
__iter__(self)
Returns: stack iterator
source code
int
push(self, x509Cert)
Push an X509 certificate onto the stack.
source code
ndg.security.common.X509.X509Cert
pop(self)
Pop a certificate from the stack.
source code
string
asDER(self)
Return the stack as a DER encoded string
source code
 
verifyCertChain(self, x509Cert2Verify=None, caX509Stack=None, rejectSelfSignedCert=True)
Treat stack as a list of certificates in a chain of trust.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, m2X509Stack=None)
(Constructor)

source code 

Initialise from an M2Crypto stack object

Parameters:
  • m2X509Stack (M2Crypto.X509.X509_Stack) - M2Crypto X.509 stack object
Overrides: object.__init__

__len__(self)
(Length operator)

source code 
Returns: int
length of stack

__getitem__(self, idx)
(Indexing operator)

source code 

Index stack as an array

Parameters:
  • idx (int) - stack index
Returns: ndg.security.common.X509.X509Cert
X.509 cert object

__iter__(self)

source code 
Returns: listiterator
stack iterator

push(self, x509Cert)

source code 

Push an X509 certificate onto the stack.

Parameters:
  • x509Cert (M2Crypto.X509.X509, ndg.security.common.X509.X509Cert or basestring) - X509 object.
Returns: int
The number of X509 objects currently on the stack.

pop(self)

source code 

Pop a certificate from the stack.

Returns: ndg.security.common.X509.X509Cert
X509 object that was popped, or None if there is nothing to pop.

asDER(self)

source code 

Return the stack as a DER encoded string

Returns: string
DER string

verifyCertChain(self, x509Cert2Verify=None, caX509Stack=None, rejectSelfSignedCert=True)

source code 

Treat stack as a list of certificates in a chain of trust. Validate the signatures through to a single root issuer.

Parameters:
  • x509Cert2Verify (X509Cert) - X.509 certificate to be verified default is last in the stack
  • caX509Stack (X509Stack) - X.509 stack containing CA certificates that are trusted.
  • rejectSelfSignedCert (bool) - Set to True (default) to raise an SelfSignedCert exception if a certificate in self's stack is self-signed.