Posts

Post not yet marked as solved
5 Replies
Hi biotto,The answer seems to be a lot late.Almost all of the official c ++ libraries specified on https://jwt.io/ use openssl.Their implementation first,1) obtains openssl's es256 signature.2) And they use some function and structure to get the values of r and s from 1)'s es256 signature.In my case, I got the values of r and s with the code below. byte * signaturePtr = signature.Ptr(); // 1)'s es256 signature result string std::unique_ptr<ECDSA_SIG, decltype(&ECDSA_SIG_free)> esSig( // convert to ECDSA_SIG sturture d2i_ECDSA_SIG(nullptr, (const unsigned char**)&signaturePtr, signature.Count()), ECDSA_SIG_free ); if (!esSig) return false; *out = EncodeBase64Url(Bignumber2Raw(esSig->r) + Bignumber2Raw(esSig->s)); // base64 encode // BigNumber2Raw is custom func