Add edge certificate for pinning check

This commit is contained in:
Jack Andersen 2018-02-12 21:36:48 -10:00
parent 2c56c16cf2
commit e766c19e0f
1 changed files with 11 additions and 1 deletions

View File

@ -17,10 +17,20 @@ static const char AxioDLPublicKeyPEM[] =
static const QSslKey AxioDLPublicKey =
QSslKey({AxioDLPublicKeyPEM}, QSsl::Rsa, QSsl::Pem, QSsl::PublicKey);
static const char AxioDLEdgePublicKeyPEM[] =
"-----BEGIN PUBLIC KEY-----\n"
"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE4a8ZLg3LRU0FiK6m8g2pT3qVBTMA\n"
"K2Uu5VGl7iamdGpUjynQ4uYWMx+WXf2Qkh7UZZgYvA6UeWHEs3M6ME8T6g==\n"
"-----END PUBLIC KEY-----\n";
static const QSslKey AxioDLEdgePublicKey =
QSslKey({AxioDLEdgePublicKeyPEM}, QSsl::Ec, QSsl::Pem, QSsl::PublicKey);
void DownloadManager::_validateCert(QNetworkReply* reply)
{
QSslCertificate peerCert = reply->sslConfiguration().peerCertificate();
if (peerCert.publicKey() != AxioDLPublicKey)
QSslKey peerKey = peerCert.publicKey();
if (peerKey != AxioDLPublicKey && peerKey != AxioDLEdgePublicKey)
{
auto cn = peerCert.subjectInfo(QSslCertificate::CommonName);
if (!cn.empty())