henrike@webrtc.org | 47be73b | 2014-05-13 18:00:26 | [diff] [blame] | 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 | |
Karl Wiberg | 927aa77 | 2015-04-20 12:03:07 | [diff] [blame] | 16 | #include "webrtc/base/basictypes.h" |
jbauch | bb6decf | 2016-03-20 13:15:43 | [diff] [blame] | 17 | #include "webrtc/base/copyonwritebuffer.h" |
henrike@webrtc.org | 47be73b | 2014-05-13 18:00:26 | [diff] [blame] | 18 | #include "webrtc/base/sslidentity.h" |
| 19 | |
| 20 | namespace rtc { |
| 21 | |
| 22 | class SSLCertificate; |
| 23 | |
| 24 | struct 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 | |
Peter Boström | 07e22e6 | 2015-10-07 10:23:21 | [diff] [blame] | 34 | SSLFingerprint(const std::string& algorithm, |
| 35 | const uint8_t* digest_in, |
henrike@webrtc.org | 47be73b | 2014-05-13 18:00:26 | [diff] [blame] | 36 | size_t digest_len); |
| 37 | |
| 38 | SSLFingerprint(const SSLFingerprint& from); |
| 39 | |
| 40 | bool operator==(const SSLFingerprint& other) const; |
| 41 | |
| 42 | std::string GetRfc4572Fingerprint() const; |
| 43 | |
mikescarlett | 2ceebfa | 2016-04-30 03:20:54 | [diff] [blame] | 44 | std::string ToString() const; |
henrike@webrtc.org | 47be73b | 2014-05-13 18:00:26 | [diff] [blame] | 45 | |
| 46 | std::string algorithm; |
jbauch | bb6decf | 2016-03-20 13:15:43 | [diff] [blame] | 47 | rtc::CopyOnWriteBuffer digest; |
henrike@webrtc.org | 47be73b | 2014-05-13 18:00:26 | [diff] [blame] | 48 | }; |
| 49 | |
| 50 | } // namespace rtc |
| 51 | |
| 52 | #endif // WEBRTC_BASE_SSLFINGERPRINT_H_ |