<div dir="ltr"><div dir="ltr">Looks like there is some problem in higher-level <font face="monospace, monospace">EVP_</font> functions.<div><br></div><div>I completely rewrote the example using lower-level <font face="monospace, monospace">ECDSA_do_sign</font> and it started to work always.</div><div><br></div><div>Here is the code:</div><font size="1" face="monospace, monospace">   EVP_MD_CTX *Ctx = EVP_MD_CTX_create();<br>   EVP_DigestInit(Ctx, EVP_sha256());<br>   EVP_DigestUpdate(Ctx, dt.data(), dt.size());<br>   QByteArray Digest;<br>   Digest.resize(EVP_MAX_MD_SIZE);<br>   unsigned int Len;<br>   EVP_DigestFinal(Ctx, reinterpret_cast<unsigned char *>(Digest.data()), &Len);<br>   Digest.resize(Len);<br><br>   BIO *   Bio   = BIO_new_mem_buf(pk.data(), pk.size());<br>   EC_KEY *ECKey = PEM_read_bio_ECPrivateKey(Bio, nullptr, nullptr, nullptr);<br>   ECDSA_SIG *Signature = ECDSA_do_sign(reinterpret_cast<unsigned char *>(Digest.data()), Digest.size(), ECKey);</font></div></div>