Removed more references to publicKey

This commit is contained in:
Albert Vaca 2015-12-17 08:22:18 -08:00
parent 918bb82ffa
commit f5404ea11b
5 changed files with 0 additions and 58 deletions

View file

@ -40,8 +40,6 @@ void LanPairingHandler::createPairPackage(NetworkPackage& np)
{
np.set("link", deviceLink()->name());
np.set("pair", true);
np.set("publicKey", KdeConnectConfig::instance()->publicKey().toPEM());
np.set("certificate", KdeConnectConfig::instance()->certificate().toPem());
}
void LanPairingHandler::packageReceived(const NetworkPackage& np)

View file

@ -64,7 +64,6 @@ bool LoopbackPairingHandler::acceptPairing()
createPairPackage(np);
setPairStatus(PairStatus::Paired);
bool success = deviceLink()->sendPackage(np);
KdeConnectConfig::instance()->setDeviceProperty(m_deviceId, "publicKey", QString::fromLatin1(KdeConnectConfig::instance()->certificate().toPem()));
KdeConnectConfig::instance()->setDeviceProperty(m_deviceId, "certificate", QString::fromLatin1(KdeConnectConfig::instance()->certificate().toPem()));
return success;
}

View file

@ -60,7 +60,6 @@ void DeviceTest::testPairedDevice()
{
KdeConnectConfig* kcc = KdeConnectConfig::instance();
kcc->addTrustedDevice(deviceId, deviceName, deviceType);
kcc->setDeviceProperty(deviceId, QString("publicKey"), kcc->publicKey().toPEM()); // Using same public key from kcc, instead of creating new one
kcc->setDeviceProperty(deviceId, QString("certificate"), QString::fromLatin1(kcc->certificate().toPem())); // Using same certificate from kcc, instead of generating one
Device device(this, deviceId);

View file

@ -342,7 +342,6 @@ void LanLinkProviderTest::addTrustedDevice()
KdeConnectConfig *kcc = KdeConnectConfig::instance();
kcc->addTrustedDevice(deviceId, name, QString("phone"));
kcc->setDeviceProperty(deviceId, QString("certificate"), QString::fromLatin1(certificate.toPem()));
kcc->setDeviceProperty(deviceId, QString("publicKey"), privateKey.toPublicKey().toPEM());
}
void LanLinkProviderTest::removeTrustedDevice()

View file

@ -89,59 +89,6 @@ void NetworkPackageTests::networkPackageIdentityTest()
QCOMPARE( np.type() , PACKAGE_TYPE_IDENTITY );
}
/*
void NetworkPackageTests::networkPackageEncryptionTest()
{
QCA::Initializer init;
if(!QCA::isSupported("rsa")) {
QFAIL("RSA isn't supported by your QCA. ");
return;
}
NetworkPackage original("com.test");
original.set("hello","hola");
NetworkPackage copy("");
NetworkPackage::unserialize(original.serialize(), &copy);
NetworkPackage decrypted("");
QCA::PrivateKey privateKey = QCA::KeyGenerator().createRSA(2048);
QVERIFY(!privateKey.isNull());
QCA::PublicKey publicKey = privateKey.toPublicKey();
//Encrypt and decrypt np
QCOMPARE( original.type(), QString("com.test") );
original.encrypt(publicKey);
QCOMPARE( original.type(), PACKAGE_TYPE_ENCRYPTED );
original.decrypt(privateKey, &decrypted);
QCOMPARE( original.type(), PACKAGE_TYPE_ENCRYPTED );
QCOMPARE( decrypted.type(), QString("com.test") );
//np should be equal top np2
QCOMPARE( decrypted.id(), copy.id() );
QCOMPARE( decrypted.type(), copy.type() );
QCOMPARE( decrypted.body(), copy.body() );
//Test for long package encryption that need multi-chunk encryption
QByteArray json = "{\"body\":{\"nowPlaying\":\"A really long song name - A really long artist name\",\"player\":\"A really long player name\",\"the_meaning_of_life_the_universe_and_everything\":\"42\"},\"id\":\"A really long package id\",\"payloadSize\":0,\"payloadTransferInfo\":{},\"type\":\"kdeconnect.a_really_really_long_package_type\"}\n";
qDebug() << "EME_PKCS1_OAEP maximumEncryptSize" << publicKey.maximumEncryptSize(QCA::EME_PKCS1_OAEP);
qDebug() << "EME_PKCS1v15 maximumEncryptSize" << publicKey.maximumEncryptSize(QCA::EME_PKCS1v15);
QCOMPARE( json.size() > publicKey.maximumEncryptSize(NetworkPackage::EncryptionAlgorithm), true );
NetworkPackage::unserialize(json, &original);
original.encrypt(publicKey);
original.decrypt(privateKey, &decrypted);
QByteArray decryptedJson = decrypted.serialize();
QCOMPARE(QString(decryptedJson), QString(json));
}
*/
void NetworkPackageTests::cleanupTestCase()
{