1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
/**
* Copyright (c) 2021-2026 Governikus GmbH & Co. KG, Germany
*/
#include <QCoreApplication>
#include <QSslCipher>
#include <QSslSocket>
#include <openssl/crypto.h>
#include <algorithm>
#ifdef OPENSSL_NO_CMS
#error Cryptographic Message Syntax (CMS) is required. Do you use old LibreSSL?
#endif
#ifdef OPENSSL_NO_EC
#error Elliptic Curve is required.
#endif
#ifdef OPENSSL_NO_TLS1_2
#error TLS 1.2 is required.
#endif
#ifdef OPENSSL_NO_PSK
#error RSA-PSK is required.
#endif
int main(int argc, char** argv)
{
QCoreApplication app(argc, argv);
Q_UNUSED(app)
// It is required that Qt and AusweisApp uses the library and the same version.
// Also this binary will crash if your libraries aren't binary compatible. For example
// this occurs if you link Qt against OpenSSL and the AusweisApp against LibreSSL.
if (QSslSocket::sslLibraryVersionString() != QLatin1String(OpenSSL_version(OPENSSL_VERSION)))
{
return 1;
}
// The AusweisApp requires at least one of an RSA-PSK cipher. LibreSSL and OpenSSL <= 1.0.2 does not support that!
const QStringList ciphers({"RSA-PSK-AES256-GCM-SHA384", "RSA-PSK-AES256-CBC-SHA384", "RSA-PSK-AES128-GCM-SHA256", "RSA-PSK-AES128-CBC-SHA256", "RSA-PSK-AES256-CBC-SHA"});
return std::any_of(ciphers.constBegin(), ciphers.constEnd(), [](const QString& pCipherName)
{
return !QSslCipher(pCipherName).isNull();
}) ? 0 : 2;
}
|