blob: 355c6bae6d00dde3e0cd4c8c6b99846cb6177398 [file] [log] [blame]
henrike@webrtc.orgf0488722014-05-13 18:00:26 +00001/*
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
Karl Wiberg94784372015-04-20 14:03:07 +020016#include "webrtc/base/basictypes.h"
henrike@webrtc.orgf0488722014-05-13 18:00:26 +000017#include "webrtc/base/buffer.h"
18#include "webrtc/base/sslidentity.h"
19
20namespace rtc {
21
22class SSLCertificate;
23
24struct SSLFingerprint {
25 static SSLFingerprint* Create(const std::string& algorithm,
26 const rtc::SSLIdentity* identity);
27
28 static SSLFingerprint* Create(const std::string& algorithm,
29 const rtc::SSLCertificate* cert);
30
31 static SSLFingerprint* CreateFromRfc4572(const std::string& algorithm,
32 const std::string& fingerprint);
33
34 SSLFingerprint(const std::string& algorithm, const uint8* digest_in,
35 size_t digest_len);
36
37 SSLFingerprint(const SSLFingerprint& from);
38
39 bool operator==(const SSLFingerprint& other) const;
40
41 std::string GetRfc4572Fingerprint() const;
42
43 std::string ToString();
44
45 std::string algorithm;
46 rtc::Buffer digest;
47};
48
49} // namespace rtc
50
51#endif // WEBRTC_BASE_SSLFINGERPRINT_H_