MCPcopy Create free account
hub / github.com/ashkulz/NppFTP / OnLoadCertificates

Method OnLoadCertificates

src/FTPClientWrapperSSL.cpp:553–578  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

551}
552
553int FtpSSLWrapper::OnLoadCertificates(SSL_CTX * ctx) {
554 if (!m_certificates)
555 return UTE_SUCCESS;
556
557 X509_STORE * x509Store = SSL_CTX_get_cert_store(ctx);
558 if (!x509Store)
559 return UTE_SUCCESS;
560
561 unsigned long err = 0;
562 while ((err = ERR_get_error()) != 0) {}
563
564 int size = (int)m_certificates->size();
565 for(int i = 0; i < size; i++) {
566 //int ret = SSL_CTX_use_certificate(ctx, (X509*)m_certificates->at(i));
567 int ret = X509_STORE_add_cert(x509Store, (X509*)m_certificates->at(i));
568 if (ret == 0) {
569 err = ERR_get_error();
570 OutErr("[FTPS] X509_STORE_add_cert failed (%d): %s.", err, ERR_reason_error_string(err));
571 OutErr("[FTPS] Removing certificate from trusted list.", ret);
572 size--;
573 m_certificates->erase(m_certificates->begin()+i);
574 i--; //assuming i is signed
575 }
576 }
577 return UTE_SUCCESS;
578}
579
580int FtpSSLWrapper::OnSSLCertificate(const SSL * ssl, const X509* certificate, int verifyResult) {
581 if (certificate == NULL) {

Callers

nothing calls this directly

Calls 1

sizeMethod · 0.80

Tested by

no test coverage detected