Cleanup
This commit is contained in:
parent
ff9775e1c9
commit
78d4ba2106
2 changed files with 9 additions and 11 deletions
|
@ -213,9 +213,8 @@ void LanLinkProvider::connected()
|
|||
// if ssl supported
|
||||
if (receivedPackage->get<int>("protocolVersion") >= NetworkPackage::ProtocolVersion) {
|
||||
// since I support ssl and remote device support ssl
|
||||
qCDebug(KDECONNECT_CORE) << "Setting up ssl server";
|
||||
|
||||
socket->setPeerVerifyName(receivedPackage->get<QString>("deviceId"));
|
||||
socket->setPeerVerifyName(deviceId);
|
||||
|
||||
QString certString = KdeConnectConfig::instance()->getDeviceProperty(deviceId, "certificate", QString());
|
||||
if (!certString.isEmpty()) {
|
||||
|
@ -229,7 +228,7 @@ void LanLinkProvider::connected()
|
|||
socket->setPeerVerifyMode(QSslSocket::QueryPeer);
|
||||
connect(socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(sslErrorsLogButIgnore(QList<QSslError>)));
|
||||
}
|
||||
qCDebug(KDECONNECT_CORE) << "Starting server ssl";
|
||||
qCDebug(KDECONNECT_CORE) << "Starting server ssl (I'm the client TCP socket)";
|
||||
connect(socket, SIGNAL(encrypted()), this, SLOT(encrypted()));
|
||||
|
||||
socket->startServerEncryption();
|
||||
|
@ -360,7 +359,6 @@ void LanLinkProvider::dataReceived()
|
|||
|
||||
if (NetworkPackage::ProtocolVersion <= np->get<int>("protocolVersion")) {
|
||||
// since I support ssl and remote device support ssl
|
||||
qCDebug(KDECONNECT_CORE) << "Setting up ssl client";
|
||||
|
||||
bool isDeviceTrusted = KdeConnectConfig::instance()->trustedDevices().contains(deviceId);
|
||||
|
||||
|
@ -378,7 +376,7 @@ void LanLinkProvider::dataReceived()
|
|||
socket->setPeerVerifyMode(QSslSocket::QueryPeer);
|
||||
connect(socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(sslErrorsLogButIgnore(QList<QSslError>)));
|
||||
}
|
||||
qCDebug(KDECONNECT_CORE) << "Starting client ssl";
|
||||
qCDebug(KDECONNECT_CORE) << "Starting client ssl (but I'm the server TCP socket)";
|
||||
connect(socket, SIGNAL(encrypted()), this, SLOT(encrypted()));
|
||||
|
||||
socket->startClientEncryption();
|
||||
|
|
|
@ -118,21 +118,21 @@ KdeConnectConfig::KdeConnectConfig()
|
|||
|
||||
} else {
|
||||
|
||||
// FIXME: We only use QCA here to generate the cert and key, would be nice to get rid of it completely.
|
||||
// The same thing we are doing with QCA could be done invoking openssl (altought it's potentially less portable):
|
||||
// openssl req -new -x509 -sha256 -newkey rsa:2048 -nodes -keyout privateKey.pem -days 3650 -out certificate.pem -subj "/O=KDE/OU=KDE Connect/CN=_e6e29ad4_2b31_4b6d_8f7a_9872dbaa9095_"
|
||||
|
||||
QCA::CertificateOptions certificateOptions = QCA::CertificateOptions();
|
||||
// FIXME : Set serial number for certificate. Time millis or any constant number?
|
||||
QCA::BigInteger bigInteger(10);
|
||||
QDateTime startTime = QDateTime::currentDateTime().addYears(-1);
|
||||
QDateTime endTime = startTime.addYears(10);
|
||||
QCA::CertificateInfo certificateInfo;
|
||||
certificateInfo.insert(QCA::CommonName,deviceId());
|
||||
certificateInfo.insert(QCA::Organization,"KDE");
|
||||
certificateInfo.insert(QCA::OrganizationalUnit,"Kde connect");
|
||||
certificateOptions.setFormat(QCA::PKCS10);
|
||||
|
||||
certificateOptions.setSerialNumber(bigInteger);
|
||||
certificateOptions.setInfo(certificateInfo);
|
||||
certificateOptions.setValidityPeriod(startTime, endTime);
|
||||
certificateOptions.setFormat(QCA::PKCS10);
|
||||
certificateOptions.setSerialNumber(QCA::BigInteger(10));
|
||||
certificateOptions.setValidityPeriod(startTime, endTime);
|
||||
|
||||
d->certificate = QSslCertificate(QCA::Certificate(certificateOptions, d->privateKey).toPEM().toLatin1());
|
||||
|
||||
|
|
Loading…
Reference in a new issue