| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef NET_SSL_SSL_PRIVATE_KEY_H_ | 5 #ifndef NET_SSL_SSL_PRIVATE_KEY_H_ |
| 6 #define NET_SSL_SSL_PRIVATE_KEY_H_ | 6 #define NET_SSL_SSL_PRIVATE_KEY_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/callback_forward.h" | 13 #include "base/callback_forward.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 16 #include "base/strings/string_piece.h" | 16 #include "base/strings/string_piece.h" |
| 17 #include "net/base/net_errors.h" | 17 #include "net/base/net_errors.h" |
| 18 | 18 |
| 19 namespace net { | 19 namespace net { |
| 20 | 20 |
| 21 // An interface for a private key for use with SSL client authentication. | 21 // An interface for a private key for use with SSL client authentication. |
| 22 class SSLPrivateKey : public base::RefCountedThreadSafe<SSLPrivateKey> { | 22 class SSLPrivateKey : public base::RefCountedThreadSafe<SSLPrivateKey> { |
| 23 public: | 23 public: |
| 24 using SignCallback = base::Callback<void(Error, const std::vector<uint8_t>&)>; | 24 using SignCallback = base::Callback<void(Error, const std::vector<uint8_t>&)>; |
| 25 | 25 |
| 26 enum class Type { | 26 enum class Type { |
| 27 RSA, | 27 RSA, |
| 28 ECDSA, | 28 ECDSA_P256, |
| 29 ECDSA_P384, |
| 30 ECDSA_P521, |
| 29 }; | 31 }; |
| 30 | 32 |
| 33 // Returns true if |type| is an ECDSA key type. |
| 34 static bool IsECDSAType(Type type) { |
| 35 return type == Type::ECDSA_P256 || type == Type::ECDSA_P384 || |
| 36 type == Type::ECDSA_P521; |
| 37 } |
| 38 |
| 31 enum class Hash { | 39 enum class Hash { |
| 32 MD5_SHA1, | 40 MD5_SHA1, |
| 33 SHA1, | 41 SHA1, |
| 34 SHA256, | 42 SHA256, |
| 35 SHA384, | 43 SHA384, |
| 36 SHA512, | 44 SHA512, |
| 37 }; | 45 }; |
| 38 | 46 |
| 39 SSLPrivateKey() {} | 47 SSLPrivateKey() {} |
| 40 | 48 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 66 virtual ~SSLPrivateKey() {} | 74 virtual ~SSLPrivateKey() {} |
| 67 | 75 |
| 68 private: | 76 private: |
| 69 friend class base::RefCountedThreadSafe<SSLPrivateKey>; | 77 friend class base::RefCountedThreadSafe<SSLPrivateKey>; |
| 70 DISALLOW_COPY_AND_ASSIGN(SSLPrivateKey); | 78 DISALLOW_COPY_AND_ASSIGN(SSLPrivateKey); |
| 71 }; | 79 }; |
| 72 | 80 |
| 73 } // namespace net | 81 } // namespace net |
| 74 | 82 |
| 75 #endif // NET_SSL_SSL_PRIVATE_KEY_H_ | 83 #endif // NET_SSL_SSL_PRIVATE_KEY_H_ |
| OLD | NEW |