mirror of
https://github.com/QuasarApp/Heart.git
synced 2025-05-19 21:09:42 +00:00
fix signer
This commit is contained in:
parent
13249254b9
commit
f79256bfb7
@ -21,7 +21,7 @@ namespace QH {
|
|||||||
* @see iCrypto class.
|
* @see iCrypto class.
|
||||||
*/
|
*/
|
||||||
template<class CryptoImplementation>
|
template<class CryptoImplementation>
|
||||||
class Signer: public CryptoImplementation
|
class Signer: protected CryptoImplementation
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Signer() {};
|
Signer() {};
|
||||||
@ -43,8 +43,8 @@ public:
|
|||||||
* @brief signMessage This is main method for signing of this object.
|
* @brief signMessage This is main method for signing of this object.
|
||||||
* @return true if the object signed sucessful
|
* @return true if the object signed sucessful
|
||||||
*/
|
*/
|
||||||
bool signMessage() const override {
|
bool signMessage() const {
|
||||||
auto sign = CryptoImplementation::signMessage(getMessage(), getPrivateKey());
|
auto sign = signMessage(getMessage(), getPrivateKey());
|
||||||
|
|
||||||
if (sign.size()) {
|
if (sign.size()) {
|
||||||
setSignature(sign);
|
setSignature(sign);
|
||||||
@ -55,16 +55,27 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief checkSign This method check signatyre of this object.
|
* @brief checkMessageSign This method check signatyre of this object.
|
||||||
* @return true if the objec signed
|
* @return true if the objec signed
|
||||||
*/
|
*/
|
||||||
bool checkSign() const override {
|
bool checkSign() const {
|
||||||
return CryptoImplementation::checkSign(getMessage(), signature(), getPublicKey());
|
return checkSign(getMessage(), signature(), getPublicKey());
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
QByteArray signMessage(const QByteArray &inputData,
|
||||||
|
const QByteArray &key) const override {
|
||||||
|
return CryptoImplementation::setSignature(inputData, key);
|
||||||
|
};
|
||||||
|
|
||||||
|
bool checkSign(const QByteArray &inputData,
|
||||||
|
const QByteArray &signature,
|
||||||
|
const QByteArray &key) const override {
|
||||||
|
return CryptoImplementation::checkSign(inputData, signature, key);
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief getPrivateKey This method should be return private key for the public key that saved in this object.
|
* @brief getPrivateKey This method should be return private key for the public key that saved in this object.
|
||||||
* @return private key for the public key that saved in this object.
|
* @return private key for the public key that saved in this object.
|
||||||
@ -81,7 +92,7 @@ protected:
|
|||||||
* @brief getMessage This method should be return message that you want to sign.
|
* @brief getMessage This method should be return message that you want to sign.
|
||||||
* @return message that you want to sign.
|
* @return message that you want to sign.
|
||||||
*/
|
*/
|
||||||
virtual const QByteArray& getMessage() const = 0;
|
virtual const QByteArray getMessage() const = 0;
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user