| 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_TOKEN_BINDING_H_ | 5 #ifndef NET_SSL_TOKEN_BINDING_H_ |
| 6 #define NET_SSL_TOKEN_BINDING_H_ | 6 #define NET_SSL_TOKEN_BINDING_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/strings/string_piece.h" | 11 #include "base/strings/string_piece.h" |
| 12 #include "crypto/ec_private_key.h" | 12 #include "crypto/ec_private_key.h" |
| 13 #include "net/base/net_errors.h" | 13 #include "net/base/net_errors.h" |
| 14 #include "net/base/net_export.h" | 14 #include "net/base/net_export.h" |
| 15 | 15 |
| 16 namespace net { | 16 namespace net { |
| 17 | 17 |
| 18 enum class TokenBindingType { | 18 enum class TokenBindingType { |
| 19 PROVIDED = 0, | 19 PROVIDED = 0, |
| 20 REFERRED = 1, | 20 REFERRED = 1, |
| 21 }; | 21 }; |
| 22 | 22 |
| 23 // Returns whether Token Binding is supported on this platform. If this function | |
| 24 // returns false, Token Binding must not be negotiated. | |
| 25 bool IsTokenBindingSupported(); | |
| 26 | |
| 27 // Takes an exported keying material value |ekm| from the TLS layer and a token | 23 // Takes an exported keying material value |ekm| from the TLS layer and a token |
| 28 // binding key |key| and signs the EKM, putting the signature in |*out|. Returns | 24 // binding key |key| and signs the EKM, putting the signature in |*out|. Returns |
| 29 // true on success or false if there's an error in the signing operations. | 25 // true on success or false if there's an error in the signing operations. |
| 30 bool SignTokenBindingEkm(base::StringPiece ekm, | 26 bool SignTokenBindingEkm(base::StringPiece ekm, |
| 31 crypto::ECPrivateKey* key, | 27 crypto::ECPrivateKey* key, |
| 32 std::vector<uint8_t>* out); | 28 std::vector<uint8_t>* out); |
| 33 | 29 |
| 34 // Given a vector of serialized TokenBinding structs (as defined in | 30 // Given a vector of serialized TokenBinding structs (as defined in |
| 35 // draft-ietf-tokbind-protocol-04), this function combines them to form the | 31 // draft-ietf-tokbind-protocol-04), this function combines them to form the |
| 36 // serialized TokenBindingMessage struct in |*out|. This function returns a net | 32 // serialized TokenBindingMessage struct in |*out|. This function returns a net |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 // |ec_point| as the public key. Returns true if the signature verifies and | 104 // |ec_point| as the public key. Returns true if the signature verifies and |
| 109 // false if it doesn't or some other error occurs in verification. This function | 105 // false if it doesn't or some other error occurs in verification. This function |
| 110 // is only provided for testing. | 106 // is only provided for testing. |
| 111 NET_EXPORT_PRIVATE bool VerifyEKMSignature(base::StringPiece ec_point, | 107 NET_EXPORT_PRIVATE bool VerifyEKMSignature(base::StringPiece ec_point, |
| 112 base::StringPiece signature, | 108 base::StringPiece signature, |
| 113 base::StringPiece ekm); | 109 base::StringPiece ekm); |
| 114 | 110 |
| 115 } // namespace net | 111 } // namespace net |
| 116 | 112 |
| 117 #endif // NET_SSL_TOKEN_BINDING_H_ | 113 #endif // NET_SSL_TOKEN_BINDING_H_ |
| OLD | NEW |