<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
span.E-MailFormatvorlage17
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="DE" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US">I have a question to following situation with RSA and DH structures:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">I’m testing these in separated unit tests.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Both test cases (each one for RSA and DH) are doing the same:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">I’m creating a new DH or RSA structure, filling it with my params (pqg …) and convert it to an EVP_PKEY (for example:
</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:#C55A11">EVP_PKEY_assign_DH</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:#6F008A">
</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas">=> pkey1<span style="color:#6F008A">)</span></span><span lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Next step, I’m writing and reading this structure with these functions:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#C55A11">PEM_write_bio_PrivateKey()
</span><span lang="EN-US">(not <span style="color:#C55A11">PEM_write_bio_PrivateKey_<b>traditional()
</b></span>) (with password)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:#2B91AF">EVP_PKEY</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black">* pkey2 =</span><span lang="EN-US">
<span style="color:#C55A11">PEM_read_bio_PrivateKey() </span>(with same password)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">(or even without a password)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Now I want to compare these two </span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:#2B91AF">EVP_PKEY</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black">*
</span><span lang="EN-US">variables (pkey1 and pkey2) and for that I can use these two functions:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#C55A11">EVP_PKEY_cmp(pkey1, pkey2)
</span><span lang="EN-US">(compares components and params)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#C55A11">EVP_PKEY_cmp_parameters(pkey1, pkey2)
</span><span lang="EN-US">(compares params)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Now the Problem:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:DE">Even the tests work the same way, the one with RSA only accept the compare-function “<span style="color:#C55A11">EVP_PKEY_cmp</span>” and not the other one.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:DE">The one with DH is only with the “<span style="color:#C55A11">EVP_PKEY_cmp_parameters</span>” successful.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:DE"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:DE">Question:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:DE">Why can the first compare function find the components and params of the RSA structure (and even after the
<span style="color:#C55A11">PEM_write_bio</span>…) and not of the DH?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:DE">Also, why it’s with the second compare function (only params) the other way around (keys match in DH unit test and not in RSA unit test)?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:DE"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:DE">Thanks<o:p></o:p></span></p>
</div>
</body>
</html>