summaryrefslogtreecommitdiffstats
path: root/net/ssl/ssl_info.cc
blob: d2973d238d6b895f05dacab455b27d9f50b76aba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "net/ssl/ssl_info.h"

#include "base/pickle.h"
#include "net/cert/cert_status_flags.h"
#include "net/cert/signed_certificate_timestamp.h"
#include "net/cert/x509_certificate.h"

namespace net {

SSLInfo::SSLInfo() {
  Reset();
}

SSLInfo::SSLInfo(const SSLInfo& info) {
  *this = info;
}

SSLInfo::~SSLInfo() {
}

SSLInfo& SSLInfo::operator=(const SSLInfo& info) {
  cert = info.cert;
  cert_status = info.cert_status;
  security_bits = info.security_bits;
  connection_status = info.connection_status;
  is_issued_by_known_root = info.is_issued_by_known_root;
  client_cert_sent = info.client_cert_sent;
  channel_id_sent = info.channel_id_sent;
  handshake_type = info.handshake_type;
  public_key_hashes = info.public_key_hashes;
  signed_certificate_timestamps = info.signed_certificate_timestamps;
  pinning_failure_log = info.pinning_failure_log;

  return *this;
}

void SSLInfo::Reset() {
  cert = NULL;
  cert_status = 0;
  security_bits = -1;
  connection_status = 0;
  is_issued_by_known_root = false;
  client_cert_sent = false;
  channel_id_sent = false;
  handshake_type = HANDSHAKE_UNKNOWN;
  public_key_hashes.clear();
  signed_certificate_timestamps.clear();
  pinning_failure_log.clear();
}

void SSLInfo::SetCertError(int error) {
  cert_status |= MapNetErrorToCertStatus(error);
}

}  // namespace net