Adapter API¶
These classes provide the interface between a Ssl::Session
and an appropriate adapter.
- Returned int error codes are 0 for success, or < 0 for error.
- The error codes themselves are implementation-specific.
- Use getErrorString() to obtain the message.
- SSL Alerts are also reported via error codes. Use getAlert
-
class
Factory
¶ Implemented by SSL adapter.
-
class
Context
¶ Implemented by SSL adapter to create and manage SSL connections.
Public Functions
-
virtual
~Context
()¶
-
virtual bool
init
() = 0¶ Initializer method that must be called after object creation and before the creation of server or client connections.
- Return Value
bool
: true on success
-
virtual Connection *
createClient
(tcp_pcb *tcp) = 0¶ Creates client SSL connection. Your SSL client use this call to create a client connection to remote server.
- Return Value
Connection*
:
-
virtual Connection *
createServer
(tcp_pcb *tcp) = 0¶ Creates server SSL connection. Your SSL servers use this call to allow remote clients to connect to them and use SSL.
- Return Value
Connection*
:
-
virtual
-
class
Connection
: public Printable¶ Implemented by SSL adapter to handle a connection.
Returned
int
error codes are 0 for success, or < 0 for error.The error codes themselves are implementation-specific. Use
getErrorString()
to obtain the message. SSL Alerts are also reported via error codes and can be obtained using a call togetAlert()
.Public Functions
-
virtual
~Connection
()¶
-
virtual bool
isHandshakeDone
() const = 0¶ Checks if the handshake has finished.
- Return Value
bool
: true on success
-
virtual int
read
(InputBuffer &input, uint8_t *&output) = 0¶ Reads encrypted information and decrypts it.
- Parameters
input
: Source encrypted dataoutput
: Pointer to decrypted plaintext buffer
- Return Value
0
: : handshake is still in progress > 0 : there is decrypted data < 0 : error
-
virtual int
write
(const uint8_t *data, size_t length) = 0¶ Converts and sends plaintext data.
- Parameters
data
:length
:
- Return Value
int
: length of the data that was actually written < 0 on error
-
virtual CipherSuite
getCipherSuite
() const = 0¶ Gets the cipher suite that was used.
- Return Value
CipherSuite
: IDs as defined by SSL/TLS standard
-
virtual SessionId
getSessionId
() const = 0¶ Gets the current session id object. Should be called after handshake.
- Return Value
-
virtual const Certificate *
getCertificate
() const = 0¶ Gets the certificate object. That object MUST be owned by the Connection implementation and should not be freed outside of it.
- Return Value
Certificate*
: Returns NULL if there is no certificate available
-
virtual void
freeCertificate
() = 0¶
-
size_t
printTo
(Print &p) const¶ For debugging.
-
int
writeTcpData
(uint8_t *data, size_t length)¶
-
virtual Alert
getAlert
(int error) const = 0¶ Get alert code from error.
- Parameters
error
:
- Return Value
Alert
: Alert::INVALID if not an alert
-
virtual