Package org.conscrypt

Class CertPinManager


  • public class CertPinManager
    extends Object
    This class provides a simple interface for cert pinning.
    • Constructor Detail

      • CertPinManager

        public CertPinManager​(TrustedCertificateStore store)
                       throws org.conscrypt.PinManagerException
        Throws:
        org.conscrypt.PinManagerException
      • CertPinManager

        public CertPinManager​(String path,
                              TrustedCertificateStore store)
                       throws org.conscrypt.PinManagerException
        Test only
        Throws:
        org.conscrypt.PinManagerException
    • Method Detail

      • isChainValid

        public boolean isChainValid​(String hostname,
                                    List<X509Certificate> chain)
                             throws org.conscrypt.PinManagerException
        Given a hostname and a chain this verifies that the certificate chain includes certificates from the pinned list iff the hostname is on the list of sites that should be pinned.

        If chain doesn't include those certificates and enforcing mode is enabled, then this method returns false and the certificate chain validation should fail.

        Throws:
        org.conscrypt.PinManagerException