Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
35 lines (29 sloc) 1007 Bytes
# -*- coding: utf-8 -*-
# Copyright ©2011 Andrew D. Yates
"""Self-descriptive PEM decoder for 'univ.Sequence'.
from pyasn1.type import univ
class SequenceParser(univ.Sequence):
"""Base type for self-reporting PEM binary format templates.
x509_pem and rsa_pem use this like a "Key Parser" base class.
componentType: `namedtype.NamedTypes` instance; defined per child class
componentType = None
def dict(self):
"""Return simple dictionary of labeled key elements as simple types.
{str, value} where `value` is simple type like `long`
dict = {}
for i in range(len(self._componentValues)):
if self._componentValues[i] is not None:
componentType = self.getComponentType()
if componentType is not None:
name = componentType.getNameByPosition(i)
value = self._componentValues[i]._value
dict[name] = value
return dict