<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" dir="ltr" style="font-size: 12pt; color: rgb(0, 0, 0); font-family: Calibri,Arial,Helvetica,sans-serif,"EmojiFont","Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols;">
<p>Hello everyone,</p>
<p><br>
</p>
<p>i am having some issues understanding the RSA_sign function:</p>
<p></p>
<div>RSA_sign(int type, const unsigned char *m, unsigned int m_len, unsigned char *sigret, unsigned int *siglen, RSA *rsa);</div>
<p></p>
<p><br>
</p>
<p>As far as I know, the signing is a four step process:</p>
<p>- Calculate hash with digest algorithm <type> (given as argument to this function -> m)</p>
<p>- Encapsulate hash in a DigestInfo structure (X509_SIG)</p>
<p>- Structure padding (in RSA_private_encrypt)</p>
<p>- Private key operation on this padded structure <span>(in RSA_private_encrypt)</span><br>
</p>
<p><br>
</p>
<p>Is that correct?</p>
<p><br>
</p>
<p>So, during the TLS handshake, the RSA_sign function is called in the CertificateVerify step.
<br>
</p>
For my tests, everytime this function is called, the hashing type is SHA512 even though I specify to use a SHA256 hash.<br>
<br>
These are the commands that I use to test TLS:<br>
<br>
<div>#<span id="ms-rterangepaste-start"></span><span>openssl s_server -accept 443 -cert cert.pem -key key.pem  -Verify 1 -msg -debug -cipher eNULL:aRSA:!SHA512:SHA256 -serverpref</span></div>
<div>#openssl s_client -connect localhost:443 -cert client_cert.pem   -key client.key -state -cipher eNULL:aRSA:!SHA512:SHA256</div>
<span></span><br>
How can I force TLS to use a SHA256 digest for DH?<br>
</div>
</body>
</html>