mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-22 08:22:04 +03:00
Move BearSSLHelpers into BearSSL namespace (#5315)
BearSSLX509List, BearSSLSession, BearSSLPublicKey, and BearSSLPrivateKey were all in the global namespace and not in the BearSSL:: one, due to an oversight when they were originally created. Move them to the proper namespace with the following mapping: BearSSLX509List => BearSSL::X509List BearSSLSession => BearSSL::Session BearSSLPublicKey => BearSSL::PublicKey BearSSLPrivateKey => BearSSL::PrivateKey
This commit is contained in:
committed by
GitHub
parent
a42c3c399b
commit
233d3e3b5e
@ -31,15 +31,17 @@ namespace brssl {
|
||||
class private_key;
|
||||
};
|
||||
|
||||
namespace BearSSL {
|
||||
|
||||
// Holds either a single public RSA or EC key for use when BearSSL wants a pubkey.
|
||||
// Copies all associated data so no need to keep input PEM/DER keys.
|
||||
// All inputs can be either in RAM or PROGMEM.
|
||||
class BearSSLPublicKey {
|
||||
class PublicKey {
|
||||
public:
|
||||
BearSSLPublicKey();
|
||||
BearSSLPublicKey(const char *pemKey);
|
||||
BearSSLPublicKey(const uint8_t *derKey, size_t derLen);
|
||||
~BearSSLPublicKey();
|
||||
PublicKey();
|
||||
PublicKey(const char *pemKey);
|
||||
PublicKey(const uint8_t *derKey, size_t derLen);
|
||||
~PublicKey();
|
||||
|
||||
bool parse(const char *pemKey);
|
||||
bool parse(const uint8_t *derKey, size_t derLen);
|
||||
@ -51,7 +53,7 @@ class BearSSLPublicKey {
|
||||
const br_ec_public_key *getEC() const;
|
||||
|
||||
// Disable the copy constructor, we're pointer based
|
||||
BearSSLPublicKey(const BearSSLPublicKey& that) = delete;
|
||||
PublicKey(const PublicKey& that) = delete;
|
||||
|
||||
private:
|
||||
brssl::public_key *_key;
|
||||
@ -60,12 +62,12 @@ class BearSSLPublicKey {
|
||||
// Holds either a single private RSA or EC key for use when BearSSL wants a secretkey.
|
||||
// Copies all associated data so no need to keep input PEM/DER keys.
|
||||
// All inputs can be either in RAM or PROGMEM.
|
||||
class BearSSLPrivateKey {
|
||||
class PrivateKey {
|
||||
public:
|
||||
BearSSLPrivateKey();
|
||||
BearSSLPrivateKey(const char *pemKey);
|
||||
BearSSLPrivateKey(const uint8_t *derKey, size_t derLen);
|
||||
~BearSSLPrivateKey();
|
||||
PrivateKey();
|
||||
PrivateKey(const char *pemKey);
|
||||
PrivateKey(const uint8_t *derKey, size_t derLen);
|
||||
~PrivateKey();
|
||||
|
||||
bool parse(const char *pemKey);
|
||||
bool parse(const uint8_t *derKey, size_t derLen);
|
||||
@ -77,7 +79,7 @@ class BearSSLPrivateKey {
|
||||
const br_ec_private_key *getEC() const;
|
||||
|
||||
// Disable the copy constructor, we're pointer based
|
||||
BearSSLPrivateKey(const BearSSLPrivateKey& that) = delete;
|
||||
PrivateKey(const PrivateKey& that) = delete;
|
||||
|
||||
private:
|
||||
brssl::private_key *_key;
|
||||
@ -89,12 +91,12 @@ class BearSSLPrivateKey {
|
||||
// for a more memory efficient way).
|
||||
// Copies all associated data so no need to keep input PEM/DER certs.
|
||||
// All inputs can be either in RAM or PROGMEM.
|
||||
class BearSSLX509List {
|
||||
class X509List {
|
||||
public:
|
||||
BearSSLX509List();
|
||||
BearSSLX509List(const char *pemCert);
|
||||
BearSSLX509List(const uint8_t *derCert, size_t derLen);
|
||||
~BearSSLX509List();
|
||||
X509List();
|
||||
X509List(const char *pemCert);
|
||||
X509List(const uint8_t *derCert, size_t derLen);
|
||||
~X509List();
|
||||
|
||||
bool append(const char *pemCert);
|
||||
bool append(const uint8_t *derCert, size_t derLen);
|
||||
@ -111,7 +113,7 @@ class BearSSLX509List {
|
||||
}
|
||||
|
||||
// Disable the copy constructor, we're pointer based
|
||||
BearSSLX509List(const BearSSLX509List& that) = delete;
|
||||
X509List(const X509List& that) = delete;
|
||||
|
||||
private:
|
||||
size_t _count;
|
||||
@ -121,19 +123,19 @@ class BearSSLX509List {
|
||||
|
||||
// Opaque object which wraps the BearSSL SSL session to make repeated connections
|
||||
// significantly faster. Completely optional.
|
||||
namespace BearSSL {
|
||||
class WiFiClientSecure;
|
||||
};
|
||||
class WiFiClientSecure;
|
||||
|
||||
class BearSSLSession {
|
||||
friend class BearSSL::WiFiClientSecure;
|
||||
class Session {
|
||||
friend class WiFiClientSecure;
|
||||
|
||||
public:
|
||||
BearSSLSession() { memset(&_session, 0, sizeof(_session)); }
|
||||
Session() { memset(&_session, 0, sizeof(_session)); }
|
||||
private:
|
||||
br_ssl_session_parameters *getSession() { return &_session; }
|
||||
// The actual BearSSL ession information
|
||||
br_ssl_session_parameters _session;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user