mirror of
https://github.com/vshymanskyy/TinyGSM.git
synced 2026-05-15 04:06:10 +00:00
Certificate function input change
Signed-off-by: Sara Damiano <sdamiano@stroudcenter.org>
This commit is contained in:
@@ -142,16 +142,16 @@ class TinyGsmA7672X : public TinyGsmModem<TinyGsmA7672X>,
|
||||
: GsmClientA7672X(modem, mux) {}
|
||||
|
||||
public:
|
||||
bool addCertificate(const String& certificateName, const String& cert,
|
||||
bool addCertificate(const char* certificateName, const char* cert,
|
||||
const uint16_t len) {
|
||||
return at->addCertificate(certificateName, cert, len);
|
||||
}
|
||||
|
||||
bool setCertificate(const String& certificateName) {
|
||||
bool setCertificate(const char* certificateName) {
|
||||
return at->setCertificate(certificateName, mux);
|
||||
}
|
||||
|
||||
bool deleteCertificate(const String& certificateName) {
|
||||
bool deleteCertificate(const char* certificateName) {
|
||||
return at->deleteCertificate(certificateName);
|
||||
}
|
||||
|
||||
@@ -313,16 +313,16 @@ class TinyGsmA7672X : public TinyGsmModem<TinyGsmA7672X>,
|
||||
// havetype like ".pem" or ".der".
|
||||
// The certificate like - const char ca_cert[] PROGMEM = R"EOF(-----BEGIN...
|
||||
// len of certificate like - sizeof(ca_cert)
|
||||
bool addCertificate(const String& certificateName, const String& cert,
|
||||
bool addCertificate(const char* certificateName, const char* cert,
|
||||
const uint16_t len) {
|
||||
sendAT(GF("+CCERTDOWN="), certificateName, GF(","), len);
|
||||
if (waitResponse(GF(">")) != 1) { return 0; }
|
||||
stream.write(cert.c_str(), len);
|
||||
if (waitResponse(GF(">")) != 1) { return false; }
|
||||
stream.write(cert, len);
|
||||
stream.flush();
|
||||
return waitResponse() == 1;
|
||||
}
|
||||
|
||||
bool deleteCertificate(const String& certificateName) { // todo test
|
||||
bool deleteCertificate(const char* certificateName) { // todo test
|
||||
sendAT(GF("+CCERTDELE="), certificateName);
|
||||
return waitResponse() == 1;
|
||||
}
|
||||
|
||||
@@ -27,8 +27,20 @@ class TinyGsmSSL {
|
||||
bool addCertificate(const char* filename) {
|
||||
return thisModem().addCertificateImpl(filename);
|
||||
}
|
||||
bool deleteCertificate() {
|
||||
return thisModem().deleteCertificateImpl();
|
||||
bool addCertificate(const String& filename) {
|
||||
return addCertificate(filename.c_str());
|
||||
}
|
||||
bool addCertificate(const char* certificateName, const char* cert,
|
||||
const uint16_t len) {
|
||||
return thisModem().addCertificateImpl(certificateName, cert, len);
|
||||
}
|
||||
bool addCertificate(const String& certificateName, const String& cert,
|
||||
const uint16_t len) {
|
||||
return addCertificate(certificateName.c_str(), cert.c_str(), len);
|
||||
}
|
||||
|
||||
bool deleteCertificate(const char* filename) {
|
||||
return thisModem().deleteCertificateImpl(filename);
|
||||
}
|
||||
|
||||
bool setCertificate(const String& certificateName, const uint8_t mux = 0) {
|
||||
@@ -60,7 +72,10 @@ class TinyGsmSSL {
|
||||
*/
|
||||
protected:
|
||||
bool addCertificateImpl(const char* filename) TINY_GSM_ATTR_NOT_IMPLEMENTED;
|
||||
bool deleteCertificateImpl() TINY_GSM_ATTR_NOT_IMPLEMENTED;
|
||||
bool addCertificateImpl(const char* certificateName, const char* cert,
|
||||
const uint16_t len) TINY_GSM_ATTR_NOT_IMPLEMENTED;
|
||||
bool
|
||||
deleteCertificateImpl(const char* filename) TINY_GSM_ATTR_NOT_IMPLEMENTED;
|
||||
|
||||
String certificates[muxCount];
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user