1/*
2 *  Copyright 2012 The WebRTC Project Authors. All rights reserved.
3 *
4 *  Use of this source code is governed by a BSD-style license
5 *  that can be found in the LICENSE file in the root of the source
6 *  tree. An additional intellectual property rights grant can be found
7 *  in the file PATENTS.  All contributing project authors may
8 *  be found in the AUTHORS file in the root of the source tree.
9 */
10
11#ifndef WEBRTC_BASE_SSLFINGERPRINT_H_
12#define WEBRTC_BASE_SSLFINGERPRINT_H_
13
14#include <string>
15
16#include "webrtc/base/buffer.h"
17#include "webrtc/base/sslidentity.h"
18
19namespace rtc {
20
21class SSLCertificate;
22
23struct SSLFingerprint {
24  static SSLFingerprint* Create(const std::string& algorithm,
25                                const rtc::SSLIdentity* identity);
26
27  static SSLFingerprint* Create(const std::string& algorithm,
28                                const rtc::SSLCertificate* cert);
29
30  static SSLFingerprint* CreateFromRfc4572(const std::string& algorithm,
31                                           const std::string& fingerprint);
32
33  SSLFingerprint(const std::string& algorithm, const uint8* digest_in,
34                 size_t digest_len);
35
36  SSLFingerprint(const SSLFingerprint& from);
37
38  bool operator==(const SSLFingerprint& other) const;
39
40  std::string GetRfc4572Fingerprint() const;
41
42  std::string ToString();
43
44  std::string algorithm;
45  rtc::Buffer digest;
46};
47
48}  // namespace rtc
49
50#endif  // WEBRTC_BASE_SSLFINGERPRINT_H_
51