diff --git a/docs/_s_s_l_client_8h.html b/docs/_s_s_l_client_8h.html index 133e125..97708dd 100644 --- a/docs/_s_s_l_client_8h.html +++ b/docs/_s_s_l_client_8h.html @@ -95,7 +95,6 @@ $(document).ready(function(){initNavTree('_s_s_l_client_8h.html','');});
#include "Client.h"
#include "SSLSession.h"
#include "SSLClientParameters.h"
#include "SSLObj.h"
#include <vector>
Go to the source code of this file.
diff --git a/docs/_s_s_l_client_8h_source.html b/docs/_s_s_l_client_8h_source.html index 4982c56..743f269 100644 --- a/docs/_s_s_l_client_8h_source.html +++ b/docs/_s_s_l_client_8h_source.html @@ -90,42 +90,41 @@ $(document).ready(function(){initNavTree('_s_s_l_client_8h_source.html','');});
+ SSLClient
+ v1.5.0
+
+ |
+
#include "SSLClientParameters.h"
+Classes | |
struct | ssl_pem_decode_state |
#include "bearssl.h"
#include <vector>
Go to the source code of this file.
Classes | |
struct | SSLClientParameters |
This struct stores data required for SSLClient to use mutual authentication. More... | |
class | SSLClientParameters |
This class stores data required for SSLClient to use mutual authentication. More... | |
Cssl_pem_decode_state | |
CSSLClient | The main SSLClient class. Check out README.md for more info |
CSSLClientParameters | This struct stores data required for SSLClient to use mutual authentication |
CSSLClientParameters | This class stores data required for SSLClient to use mutual authentication |
CSSLSession | This class stores values which allow SSLClient to save and resume SSL sessions |
+ SSLClient
+ v1.5.0
+
+ |
+
This is the complete list of members for SSLClientParameters, including all inherited members.
+fromDER(const char *cert_der, const size_t cert_len, const char *key_der, const size_t key_len) | SSLClientParameters | static |
fromPEM(const char *cert_pem, const size_t cert_len, const char *key_pem, const size_t key_len) | SSLClientParameters | static |
getCertChain() const | SSLClientParameters | inline |
getCertType() const | SSLClientParameters | inline |
getECKey() const | SSLClientParameters | inline |
getRSAKey() const | SSLClientParameters | inline |
SSLClientParameters(const char *cert, const size_t cert_len, const char *key, const size_t key_len, bool is_der) | SSLClientParameters | protected |
+ SSLClient
+ v1.5.0
+
+ |
+
This class stores data required for SSLClient to use mutual authentication. + More...
+ +#include <SSLClientParameters.h>
+Public Member Functions | |
const br_x509_certificate * | getCertChain () const |
int | getCertType () const |
const br_ec_private_key * | getECKey () const |
const br_rsa_private_key * | getRSAKey () const |
+Static Public Member Functions | |
static SSLClientParameters | fromPEM (const char *cert_pem, const size_t cert_len, const char *key_pem, const size_t key_len) |
Create mutual authentication parameters from a PEM certificate and private key. More... | |
static SSLClientParameters | fromDER (const char *cert_der, const size_t cert_len, const char *key_der, const size_t key_len) |
Create mutual authentication parameters from a DER certificate and private key. More... | |
+Protected Member Functions | |
SSLClientParameters (const char *cert, const size_t cert_len, const char *key, const size_t key_len, bool is_der) | |
This class stores data required for SSLClient to use mutual authentication.
+ +This file contains a simple utility class to store parameters about an SSL Session for reuse later.TLS mutual authentication is a process in which both the server and client perform cryptographic operations to verify the authenticity of eachother, for more information check out this article: https://medium.com/sitewards/the-magic-of-tls-x509-and-mutual-authentication-explained-b2162dec4401 . If this struct is provided to SSLClient::SSLClient via SSLClient::setMutualAuthParams, SSLClient will automatically send a client certificate if one is requested by the server. This will happen for all SSLClient connections, and may cause issues for websites that do not need mutual authentication—as a result, please only turn on mutual authentication if you are sure it is neccesary.
+SSLClientParameters supports both ECC and RSA client certificates. I recommend using ECC certificates if possible, as SSLClientParameters will make a copy of both the certificate and the private key in memory, and ECC keys tend to be smaller than RSA ones.
+
+
|
+ +protected | +
+
|
+ +static | +
Create mutual authentication parameters from a DER certificate and private key.
+Use this function to create a mutual tls context from a DER client certificate and DER private key. This function will copy the certificate and private key, extract the needed information from the private key, and store both that information and the copied cert into a SSLClientParameters object. Given the key parsed correctly, you can then use SSLClient::setMutualAuthParams at the begining of your sketch to enable mTLS with SSLClient. This function supports both ECC and RSA certificate/private keys (use EC keys wherever possible, as they are signifigantly smaller and faster), however SSLClient only supports the p256, p384, and p512 curves for ECC.
+Because SSLClientParameters creates a copy of both the certificate and key, you do not need to ensure that the data pointed to by cert_der or key_der is accessible after this function (i.e. you can free them afterwards).
+Please note that if the private key is incorrect, this function will not report an error, and instead SSLClient will fall back to regular TLS when making a connection.
+cert_der | A DER encoded certificate, can be ECC or RSA. |
cert_len | The number of bytes in cert_der. |
key_der | A DER encoded private key, can be ECC or RSA. |
key_len | The number of bytes in key_ders |
+
|
+ +static | +
Create mutual authentication parameters from a PEM certificate and private key.
+Use this function to create a mutual tls context from a PEM client certificate and PEM private key. This function will convert the PEM certificates into DER format (creating a copy in the process), extract the needed information from the private key, and store that information into a SSLClientParameters object. Given the certifiate and key parsed correctly, you can then use SSLClient::setMutualAuthParams at the begining of your sketch to enable mTLS with SSLClient. This function supports both ECC and RSA certificate/private keys (use EC keys wherever possible, as they are signifigantly smaller and faster), however SSLClient only supports the p256, p384, and p512 curves for ECC.
+Because SSLClientParameters creates a copy of both the certificate and key, you do not need to ensure that the data pointed to by cert_pem or key_pem is accessible after this function (i.e. you can free them afterwards).
+Please note that if the certificate or private key are incorrect, this function will not report an error, and instead SSLClient will fall back to regular TLS when making a connection.
+cert_pem | A PEM formatted certificate, including the "BEGIN" and "END" header/footers. Can be ECC or RSA. cert_pem supports both LF and CRLF for endlines, but all other constraints on a valid PEM file apply. |
cert_len | The number of bytes in cert_pem. |
key_pem | A PEM formatted private key, including the "BEGIN" and "END" header/footers. Can be ECC or RSA. key_pem supports both LF and CRLF for endlines, but all other constraints \ on a valid PEM file apply. |
key_len | The number of bytes in key_pem |
+
|
+ +inline | +
mTLS information used by SSLClient during authentication
+ +
+
|
+ +inline | +
mTLS information used by SSLClient during authentication
+ +
+
|
+ +inline | +
mTLS information used by SSLClient during authentication
+ +
+
|
+ +inline | +
mTLS information used by SSLClient during authentication
+ +
| SSLClient | SSLSession | |
SSLClientParameters | |||
SSLClientParameters | |||
ssl_pem_decode_state | |||
SSLClient.cpp | |
SSLClient.h | |
SSLClientParameters.h | |
SSLObj.cpp | |
SSLObj.h | |
SSLSession.h | |
time_macros.h | |
SSLClientParameters.cpp | |
SSLClientParameters.h | |
SSLSession.h | |
time_macros.h |
SSLClient requires at least 110kb flash and 7kb RAM, and will not compile otherwise. This means that most Arduino boards are not supported. Check your board's specifications before attempting to use this library.
-You can also view this README in doxygen.
+You can also view this README in doxygen.
SSLClient is a simple library to add TLS 1.2 functionality to any network library implementing the Arduino Client interface, including the Arduino EthernetClient and WiFiClient classes (though it is better to prefer WiFClient.connectSSL if implemented). In other words, SSLClient implements encrypted communication through SSL on devices that do not otherwise support it.
SSLClient has been tested on the SAMD21, ESP32, TIVA C, and STM32 (in progress). SSClient does not currently support the ESP8266 (see this issue).
brssl
command line utility, included in the BearSSL source. You will need to compile this file yourself.For other kinds of SSL connections, you will need to find the root certificate being used by your host. You can check out this StackExchange post for numerous methods of acquiring this certificate from a server. If these methods are not sufficient, you may need to request this certificate from your network administrator. Once you have the certificate, convert it to PEM format if needed (I use this website), and use the pycert_bearssl.py convet --no-search
command to convert the certificate into a trust anchor header.
For other kinds of SSL connections, you will need to find the root certificate being used by your host. You can check out this StackExchange post for numerous methods of acquiring this certificate from a server. If these methods are not sufficient, you may need to request this certificate from your network administrator. Once you have the certificate, convert it to PEM format if needed (I use this website), and use the pycert_bearssl.py convert --no-search
command to convert the certificate into a trust anchor header.
Once you've generated a trust anchor array, add it to your Arduino sketch using the Sketch->Add File
button in the Arduino IDE, and link it to your SSLClient like so:
Where yourtrustanchorfile.h
contains a generated trust anchor array names TAs
, with length TAs_NUM
. BearSSL will now automatically use these trust anchors when SSLClient::connect
is called.
This is the complete list of members for ssl_pem_decode_state, including all inherited members.
index | ssl_pem_decode_state | |
vect | ssl_pem_decode_state | |
vect | ssl_pem_decode_state |
Public Attributes | |
std::vector< unsigned char > * | vect |
std::vector< char > * | vect |
size_t | index = 0 |
std::vector<unsigned char>* ssl_pem_decode_state::vect | +std::vector<char>* ssl_pem_decode_state::vect |