PyKCS11/__init__.py
def to_dict(self):
        """
        convert the fields of the object into a dictionnary
        """
        # all the attibutes defined by PKCS#11
        all_attributes = PyKCS11.CKA.keys()

        # only use the integer values and not the strings like 'CKM_RSA_PKCS'
        all_attributes = [attr for attr in all_attributes if
                          isinstance(attr, int)]

        # all the attributes of the object
        attributes = self.session.getAttributeValue(self, all_attributes)

        dico = dict()
        for key, attr in zip(all_attributes, attributes):
            if attr is None:
                continue
            if key == CKA_CLASS:
                dico[PyKCS11.CKA[key]] = PyKCS11.CKO[attr]
            elif key == CKA_CERTIFICATE_TYPE:
                dico[PyKCS11.CKA[key]] = PyKCS11.CKC[attr]
            elif key == CKA_KEY_TYPE:
                dico[PyKCS11.CKA[key]] = PyKCS11.CKK[attr]
            else:
                dico[PyKCS11.CKA[key]] = attr
        return dico
def to_dict(self):
        """
        convert the fields of the object into a dictionnary
        """
        # all the attibutes defined by PKCS#11
        all_attributes = PyKCS11.CKA.keys()

        # only use the integer values and not the strings like 'CKM_RSA_PKCS'
        all_attributes = [attr for attr in all_attributes if
                          isinstance(attr, int)]

        # all the attributes of the object
        attributes = self.session.getAttributeValue(self, all_attributes)

        dico = dict()
        for key, attr in zip(all_attributes, attributes):
            if attr is None:
                continue
            if key == CKA_CLASS:
                dico[PyKCS11.CKA[key]] = PyKCS11.CKO[attr]
            elif key == CKA_CERTIFICATE_TYPE:
                dico[PyKCS11.CKA[key]] = PyKCS11.CKC[attr]
            elif key == CKA_KEY_TYPE:
                dico[PyKCS11.CKA[key]] = PyKCS11.CKK[attr]
            else:
                dico[PyKCS11.CKA[key]] = attr
        return dico
def to_dict ( self ) : # all the attibutes defined by PKCS#11 all_attributes = PyKCS11 . CKA . keys ( ) # only use the integer values and not the strings like 'CKM_RSA_PKCS' all_attributes = [ attr for attr in all_attributes if isinstance ( attr , int ) ] # all the attributes of the object attributes = self . session . getAttributeValue ( self , all_attributes ) dico = dict ( ) for key , attr in zip ( all_attributes , attributes ) : if attr is None : continue if key == CKA_CLASS : dico [ PyKCS11 . CKA [ key ] ] = PyKCS11 . CKO [ attr ] elif key == CKA_CERTIFICATE_TYPE : dico [ PyKCS11 . CKA [ key ] ] = PyKCS11 . CKC [ attr ] elif key == CKA_KEY_TYPE : dico [ PyKCS11 . CKA [ key ] ] = PyKCS11 . CKK [ attr ] else : dico [ PyKCS11 . CKA [ key ] ] = attr return dico
convert the fields of the object into a dictionnary
convert the fields of the object into a dictionnary