Example #1
0
    def get_cert_fingerprint(self, fingerprint_length: int,
                             digest_name: int) -> Optional[str]:
        """
        Get the fingerprint of the certificate. The certificate fingerprint
        (as displayed in the Fingerprints section when looking at a certificate
        with say the Firefox browser) is the hexadecimal hash of the entire
        certificate. The fingerprint is not part of the certificate, rather
        it is computed from the certificate and can be used to uniquely identify
        a certificate.

        :param fingerprint_length: Must be :math:`>= 33` for md5, :math:`>= 41`
                                   for sha1, :math:`>= 65` for sha256 and :math:`>= 129`
                                   for sha512.
        :param digest_name: The hash algorithm to use. Must be one of :const:`SHA1`,
                            :const:`SHA256`, :const:`SHA512`,  :const:`MD5`.
        :return: Hex fingerprint in a string, or ``None`` if an error occurred.
        """
        rc, fingerprint_str = pn_ssl_get_cert_fingerprint(
            self._ssl, fingerprint_length, digest_name)
        if rc == PN_OK:
            return fingerprint_str
        return None
Example #2
0
 def get_cert_fingerprint(self, fingerprint_length, digest_name):
     rc, fingerprint_str = pn_ssl_get_cert_fingerprint(self._ssl, fingerprint_length, digest_name)
     if rc == PN_OK:
         return fingerprint_str
     return None
Example #3
0
 def get_cert_fingerprint(self, fingerprint_length, digest_name):
     rc, fingerprint_str = pn_ssl_get_cert_fingerprint(
         self._ssl, fingerprint_length, digest_name)
     if rc == PN_OK:
         return fingerprint_str
     return None