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