Exemplo n.º 1
0
    def from_pem_file(cls, pem_file, strict_der=True):
        """Read a single PEM-encoded certificate from a file.

        Args:
            pem_file: the certificate file.
            strict_der: if False, tolerate some non-fatal DER errors.

        Returns:
            a Certificate object
        Raises:
            ct.crypto.pem.PemError, ct.crypto.error.ASN1Error: the file does not
            contain a valid PEM certificate
            IOError: the file could not be read,
        """
        der_cert, _ = pem.from_pem_file(pem_file, cls.PEM_MARKERS)
        return cls.from_der(der_cert, strict_der=strict_der)
Exemplo n.º 2
0
    def from_pem_file(cls, pem_file, strict_der=True):
        """Read a single PEM-encoded certificate from a file.

        Args:
            pem_file: the certificate file.
            strict_der: if False, tolerate some non-fatal DER errors.

        Returns:
            a Certificate object
        Raises:
            ct.crypto.pem.PemError, ct.crypto.error.ASN1Error: the file does not
            contain a valid PEM certificate
            IOError: the file could not be read,
        """
        der_cert, _ = pem.from_pem_file(pem_file, cls.PEM_MARKERS)
        return cls.from_der(der_cert, strict_der=strict_der)
Exemplo n.º 3
0
 def test_from_pem_file(self):
     name = self.create_temp_file(self.PEM_BLOB)
     self.assertEqual((self.BLOB, self.MARKER),
                      pem.from_pem_file(name, (self.MARKER,)))
Exemplo n.º 4
0
 def test_from_pem_file(self):
     name = self.create_temp_file(self.PEM_BLOB)
     self.assertEqual((self.BLOB, self.MARKER),
                      pem.from_pem_file(name, (self.MARKER, )))