xref: /aosp_15_r20/external/cronet/net/socket/ssl_socket.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2012 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef NET_SOCKET_SSL_SOCKET_H_
6 #define NET_SOCKET_SSL_SOCKET_H_
7 
8 #include <string_view>
9 
10 #include "net/base/net_export.h"
11 #include "net/socket/stream_socket.h"
12 
13 namespace net {
14 
15 // SSLSocket interface defines method that are common between client
16 // and server SSL sockets.
17 class NET_EXPORT SSLSocket : public StreamSocket {
18 public:
19  ~SSLSocket() override = default;
20 
21  // Exports data derived from the SSL master-secret (see RFC 5705).
22  // If |has_context| is false, uses the no-context construction from the
23  // RFC and |context| is ignored.  The call will fail with an error if
24  // the socket is not connected or the SSL implementation does not
25  // support the operation.
26  virtual int ExportKeyingMaterial(std::string_view label,
27                                   bool has_context,
28                                   std::string_view context,
29                                   unsigned char* out,
30                                   unsigned int outlen) = 0;
31 };
32 
33 }  // namespace net
34 
35 #endif  // NET_SOCKET_SSL_SOCKET_H_
36