Exemplo n.º 1
0
 def from_json(cls, attr_list):
     """ Return KeyInfo from JSON dict """
     key_info = cls()
     for k, v in iteritems(attr_list):
         if k in KeyInfo.json_attribute_names:
             setattr(key_info, KeyInfo.json_attribute_names[k], v)
         else:
             setattr(key_info, k, v)
     if key_info.public_key is not None:
         key_info.public_key = encoder.decode_cert(key_info.public_key)
     return key_info
Exemplo n.º 2
0
Arquivo: key.py Projeto: tiran/pki
 def from_json(cls, attr_list):
     """ Return KeyInfo from JSON dict """
     key_info = cls()
     for k, v in iteritems(attr_list):
         if k in KeyInfo.json_attribute_names:
             setattr(key_info, KeyInfo.json_attribute_names[k], v)
         else:
             setattr(key_info, k, v)
     if key_info.public_key is not None:
         key_info.public_key = encoder.decode_cert(key_info.public_key)
     return key_info
Exemplo n.º 3
0
    def get_transport_cert(self):
        """
        Return transport certificate.

        :return: pki.cert.CertData -- transport certificate data
        """
        url = self.cert_url + '/transport'
        response = self.connection.get(url, self.headers)
        cert_data = CertData.from_json(response.json())

        pem = cert_data.encoded
        b64 = pem[len(pki.CERT_HEADER):len(pem) - len(pki.CERT_FOOTER)]
        cert_data.binary = decode_cert(b64)

        return cert_data
Exemplo n.º 4
0
    def get_transport_cert(self):
        """
        Return transport certificate.

        :return: pki.cert.CertData -- transport certificate data
        """
        url = self.cert_url + '/transport'
        response = self.connection.get(url, self.headers)
        cert_data = CertData.from_json(response.json())

        pem = cert_data.encoded
        b64 = pem[len(pki.CERT_HEADER):len(pem) - len(pki.CERT_FOOTER)]
        cert_data.binary = decode_cert(b64)

        return cert_data