mirror of
https://github.com/QuasarApp/easyssl.git
synced 2025-04-26 21:14:32 +00:00
fix ecdsa
This commit is contained in:
parent
b0d1dd5a94
commit
5d279991f4
@ -103,15 +103,7 @@ QByteArray ECDSASSL::signMessage(const QByteArray &inputData,
|
||||
return {};
|
||||
}
|
||||
|
||||
size_t signatureLength = 0;
|
||||
// Determine the length of the signature
|
||||
if (EVP_DigestSignFinal(mdctx, nullptr, &signatureLength) != 1) {
|
||||
EasySSLUtils::printlastOpenSSlError();
|
||||
|
||||
EVP_MD_CTX_free(mdctx);
|
||||
return {};
|
||||
}
|
||||
|
||||
size_t signatureLength = EVP_PKEY_size(ecPrivateKey);
|
||||
signature.resize(signatureLength);
|
||||
|
||||
// Perform the final signing operation and obtain the signature
|
||||
@ -122,6 +114,8 @@ QByteArray ECDSASSL::signMessage(const QByteArray &inputData,
|
||||
return {};
|
||||
}
|
||||
|
||||
signature.resize(signatureLength);
|
||||
|
||||
EVP_MD_CTX_free(mdctx);
|
||||
return signature;
|
||||
}
|
||||
|
@ -80,14 +80,7 @@ QByteArray RSASSL::signMessage(const QByteArray &inputData, const QByteArray &ke
|
||||
return {};
|
||||
}
|
||||
|
||||
size_t signatureLength = 0;
|
||||
// Determine the length of the signature
|
||||
if (EVP_DigestSignFinal(mdctx, nullptr, &signatureLength) != 1) {
|
||||
EasySSLUtils::printlastOpenSSlError();
|
||||
EVP_MD_CTX_free(mdctx);
|
||||
return {};
|
||||
}
|
||||
|
||||
size_t signatureLength = EVP_PKEY_size(rsaPrivateKey);
|
||||
signature.resize(signatureLength);
|
||||
|
||||
// Perform the final signing operation and obtain the signature
|
||||
@ -97,6 +90,8 @@ QByteArray RSASSL::signMessage(const QByteArray &inputData, const QByteArray &ke
|
||||
return {};
|
||||
}
|
||||
|
||||
signature.resize(signatureLength);
|
||||
|
||||
EVP_MD_CTX_free(mdctx);
|
||||
return signature;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user