- mutiple SSL cert files can now be added to the MRCI_PUB_KEY env variable via colon seperated ':' path strings to complete the cert chain if such a thing is required. It is no longer necessary to merge to multiple certs into one to complete a cert chain. - added -load_ssl command line option so cert data can be re-loaded in real time without the need to stop-start the host. - added more detailed error messages to the SSL loading process for easier debugging. - major changes to the build system include the use of python scripts instead of the linux shell script file. - linux_build.sh was removed since it is no longer needed. - the new build process now run 2 python scripts: build.py and then install.py. - the resulting installer if built no longer uses makeself. the installation and/or self extracting process is now handled entirely by python and the install.py script. The main reason for this change is to lay the ground work for multi- platform support. It is still linux only for now but adding windows support will be much easier in the future thanks to python's cross- platform support.
63 lines
1.8 KiB
C++
63 lines
1.8 KiB
C++
#ifndef MAKE_CERT_H
|
|
#define MAKE_CERT_H
|
|
|
|
// This file is part of MRCI_Client.
|
|
|
|
// MRCI_Client is free software: you can redistribute it and/or modify
|
|
// it under the terms of the GNU General Public License as published by
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
// (at your option) any later version.
|
|
|
|
// MRCI_Client is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU General Public License for more details.
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
// along with MRCI_Client under the LICENSE.md file. If not, see
|
|
// <http://www.gnu.org/licenses/>.
|
|
|
|
#include <cstdio>
|
|
#include <openssl/ssl.h>
|
|
#include <openssl/x509.h>
|
|
#include <openssl/x509v3.h>
|
|
|
|
#include <QDateTime>
|
|
#include <QCoreApplication>
|
|
#include <QIODevice>
|
|
#include <QFile>
|
|
#include <QSslCertificate>
|
|
#include <QList>
|
|
#include <QNetworkInterface>
|
|
#include <QHostAddress>
|
|
#include <QSslKey>
|
|
|
|
#include "db.h"
|
|
|
|
class Cert : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
EVP_PKEY *pKey;
|
|
X509 *x509;
|
|
BIGNUM *bne;
|
|
RSA *rsa;
|
|
|
|
void cleanup();
|
|
|
|
explicit Cert(QObject *parent = nullptr);
|
|
};
|
|
|
|
FILE *openFileForWrite(const char *path, QTextStream &msg);
|
|
bool genRSAKey(Cert *cert, QTextStream &msg);
|
|
bool genX509(Cert *cert, const QString &outsideAddr, QTextStream &msg);
|
|
bool writePrivateKey(const char *path, Cert *cert, QTextStream &msg);
|
|
bool writeX509(const char *path, Cert *cert, QTextStream &msg);
|
|
bool genDefaultSSLFiles(const QString &outsideAddr, QTextStream &msg);
|
|
void addExt(X509 *cert, int nid, char *value);
|
|
void encodeErr(const char *path, QTextStream &msg);
|
|
|
|
#endif // MAKE_CERT_H
|