cert_host_pair.cc 790 B

123456789101112131415161718192021222324252627
  1. // Copyright 2015 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include "ios/web/security/cert_host_pair.h"
  5. #include <utility>
  6. #include "net/cert/x509_certificate.h"
  7. namespace web {
  8. CertHostPair::CertHostPair(scoped_refptr<net::X509Certificate> cert,
  9. std::string host)
  10. : cert_(std::move(cert)),
  11. host_(std::move(host)),
  12. cert_hash_(cert_->CalculateChainFingerprint256()) {}
  13. CertHostPair::CertHostPair(const CertHostPair& other) = default;
  14. CertHostPair::~CertHostPair() {}
  15. bool CertHostPair::operator<(const CertHostPair& other) const {
  16. return std::tie(host_, cert_hash_) < std::tie(other.host_, other.cert_hash_);
  17. }
  18. } // namespace web