mirror of
https://github.com/QuasarApp/Qt-Secret.git
synced 2025-05-18 18:09:34 +00:00
commit
dd6d8af7a3
@ -292,8 +292,8 @@ QByteArray decodeArray(const QByteArray &rawData, const QByteArray &privKey) {
|
|||||||
QRSAEncryption::QRSAEncryption() {
|
QRSAEncryption::QRSAEncryption() {
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int QRSAEncryption::getBytesSize(QRSAEncryption::Rsa rsa) {
|
unsigned int QRSAEncryption::getKeyBytesSize(QRSAEncryption::Rsa rsa) {
|
||||||
return rsa / 8;
|
return rsa / 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- static methods ---
|
// --- static methods ---
|
||||||
@ -423,3 +423,7 @@ bool QRSAEncryption::testKeyPair(const QByteArray &pubKey, const QByteArray &pri
|
|||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool QRSAEncryption::isValidRsaKey(const QByteArray &key) {
|
||||||
|
return key.size() && key.size() % RSA_64 == 0;
|
||||||
|
}
|
||||||
|
@ -34,7 +34,7 @@ public:
|
|||||||
|
|
||||||
QRSAEncryption();
|
QRSAEncryption();
|
||||||
|
|
||||||
unsigned int getBytesSize(QRSAEncryption::Rsa rsa);
|
|
||||||
|
|
||||||
// static methods
|
// static methods
|
||||||
static bool generatePairKeyS(QByteArray &pubKey, QByteArray &privKey,
|
static bool generatePairKeyS(QByteArray &pubKey, QByteArray &privKey,
|
||||||
@ -43,6 +43,8 @@ public:
|
|||||||
static QByteArray decodeS(const QByteArray &rawData, const QByteArray &privKey);
|
static QByteArray decodeS(const QByteArray &rawData, const QByteArray &privKey);
|
||||||
static QByteArray signMessageS(QByteArray rawData, const QByteArray &privKey);
|
static QByteArray signMessageS(QByteArray rawData, const QByteArray &privKey);
|
||||||
static bool checkSignMessageS(const QByteArray &rawData, const QByteArray &pubKey);
|
static bool checkSignMessageS(const QByteArray &rawData, const QByteArray &pubKey);
|
||||||
|
static bool isValidRsaKey(const QByteArray& key);
|
||||||
|
static unsigned int getKeyBytesSize(QRSAEncryption::Rsa rsa);
|
||||||
|
|
||||||
// non-static methods
|
// non-static methods
|
||||||
bool generatePairKey(QByteArray &pubKey, QByteArray &privKey,
|
bool generatePairKey(QByteArray &pubKey, QByteArray &privKey,
|
||||||
@ -52,6 +54,7 @@ public:
|
|||||||
QByteArray signMessage(QByteArray rawData, const QByteArray &privKey);
|
QByteArray signMessage(QByteArray rawData, const QByteArray &privKey);
|
||||||
bool checkSignMessage(const QByteArray &rawData, const QByteArray &pubKey);
|
bool checkSignMessage(const QByteArray &rawData, const QByteArray &pubKey);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool testKeyPair(const QByteArray &pubKey, const QByteArray &privKey);
|
bool testKeyPair(const QByteArray &pubKey, const QByteArray &privKey);
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user