auth_util.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // Copyright (c) 2012 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef REMOTING_PROTOCOL_AUTH_UTIL_H_
  5. #define REMOTING_PROTOCOL_AUTH_UTIL_H_
  6. #include <stddef.h>
  7. #include <string>
  8. #include "base/strings/string_piece.h"
  9. namespace net {
  10. class SSLSocket;
  11. } // namespace net
  12. namespace remoting {
  13. namespace protocol {
  14. // Labels for use when exporting the SSL shared secret.
  15. extern const char kClientAuthSslExporterLabel[];
  16. extern const char kHostAuthSslExporterLabel[];
  17. // Fake hostname used for SSL connections.
  18. extern const char kSslFakeHostName[];
  19. // Size of the HMAC-SHA-256 hash used as shared secret in SPAKE2.
  20. const size_t kSharedSecretHashLength = 32;
  21. // Size of the HMAC-SHA-256 digest used for channel authentication.
  22. const size_t kAuthDigestLength = 32;
  23. // Returns HMAC-SHA-256 hash for |shared_secret| with the specified |tag|.
  24. std::string GetSharedSecretHash(const std::string& tag,
  25. const std::string& shared_secret);
  26. // Returns authentication bytes that must be used for the given
  27. // |socket|. Empty string is returned in case of failure.
  28. std::string GetAuthBytes(net::SSLSocket* socket,
  29. const base::StringPiece& label,
  30. const base::StringPiece& shared_secret);
  31. } // namespace protocol
  32. } // namespace remoting
  33. #endif // REMOTING_PROTOCOL_AUTH_UTIL_H_