GH-1202 rebuild SSL certs on start on OSX - part 2
This commit is contained in:
parent
22c0d5cf46
commit
b7ff8a4c1c
@ -20,7 +20,8 @@
|
|||||||
* \return A list of new QSslCertificates generated from the
|
* \return A list of new QSslCertificates generated from the
|
||||||
* KeyChain DER data.
|
* KeyChain DER data.
|
||||||
*/
|
*/
|
||||||
static QList<QSslCertificate> LoadCertificatesFromKeyChain(const std::string &keyChainPath = std::string())
|
static QList<QSslCertificate>
|
||||||
|
LoadCertificatesFromKeyChain(const std::string &keyChainPath = std::string())
|
||||||
{
|
{
|
||||||
QList<QSslCertificate> qtCerts;
|
QList<QSslCertificate> qtCerts;
|
||||||
|
|
||||||
@ -71,11 +72,11 @@ static QList<QSslCertificate> LoadCertificatesFromKeyChain(const std::string &ke
|
|||||||
|
|
||||||
// create a Qt certificate from the data and add it to the list
|
// create a Qt certificate from the data and add it to the list
|
||||||
QSslCertificate qtCert(byteArray, QSsl::Der);
|
QSslCertificate qtCert(byteArray, QSsl::Der);
|
||||||
std::cout << "COMMON NAME: "
|
qDebug() << "COMMON NAME: "
|
||||||
<< qtCert.issuerInfo(QSslCertificate::CommonName).toStdString().c_str()
|
<< qtCert.issuerInfo(QSslCertificate::CommonName).join('\n')
|
||||||
<< " ORG NAME: "
|
<< " ORG NAME: "
|
||||||
<< qtCert.issuerInfo(QSslCertificate::Organization).toStdString().c_str()
|
<< qtCert.issuerInfo(QSslCertificate::Organization).join('\n')
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
|
|
||||||
qtCerts << qtCert;
|
qtCerts << qtCert;
|
||||||
}
|
}
|
||||||
@ -107,12 +108,12 @@ void RebuildQtCertificates()
|
|||||||
{
|
{
|
||||||
if (!existingCerts.contains(qtCert))
|
if (!existingCerts.contains(qtCert))
|
||||||
{
|
{
|
||||||
std::cout << "cert not known to Qt - adding" << std::endl;
|
qDebug() << "cert not known to Qt - adding";
|
||||||
std::cout << "COMMON NAME: "
|
qDebug() << "COMMON NAME: "
|
||||||
<< qtCert.issuerInfo(QSslCertificate::CommonName).toStdString().c_str()
|
<< qtCert.issuerInfo(QSslCertificate::CommonName).join('\n')
|
||||||
<< " ORG NAME: "
|
<< " ORG NAME: "
|
||||||
<< qtCert.issuerInfo(QSslCertificate::Organization).toStdString().c_str()
|
<< qtCert.issuerInfo(QSslCertificate::Organization).join('\n')
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
|
|
||||||
QSslSocket::addDefaultCaCertificate(qtCert);
|
QSslSocket::addDefaultCaCertificate(qtCert);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user