<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 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Texto de bal\00E3o Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";}
span.EstiloDeEmail17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.TextodebaloChar
        {mso-style-name:"Texto de bal\00E3o Char";
        mso-style-priority:99;
        mso-style-link:"Texto de bal\00E3o";
        font-family:"Tahoma","sans-serif";}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 3.0cm 70.85pt 3.0cm;}
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=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal>I’m working on a C++ security library solution that uses openssl internally.<o:p></o:p></p><p class=MsoNormal>It offers Sign/Verify, Digest and Encrypt/Decrypt as its features (please check available methods below).<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>I’m using FIPS 2.0 test vectors to validate my library, but I’m having a bit of trouble with that.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Testing Digest is easy. It is just a matter of providing any data and check whether the returned value matches expected values.<o:p></o:p></p><p class=MsoNormal>FIPS 2.0 is working just fine here.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Testing Sign/Verify is a whole different story. My understanding is that algorithms use random parameters to sign data, so two consecutive calls to sign with the same parameters would yield different results.<o:p></o:p></p><p class=MsoNormal>I guess I have to sign some data, and verify it to make sure that’s working.<o:p></o:p></p><p class=MsoNormal>FIPS provides testing parameters that are not trivial (message, y, r, s) and I’m not sure how to handle them. Is it possible to use those parameters considering my API (check below)?<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>I haven’t tried testing the encrypt/decrypt methods, since I’m stuck in the Sign/Verify.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Do you think using FIPS test vectors to validate my solution is a good/feasible approach?<o:p></o:p></p><p class=MsoNormal>Is there any better/simpler testing approach?<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>This is my API:<o:p></o:p></p><p class=MsoNormal>    Sign/Verify:<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>        std::string /* B64 */ sign( std::string algorithm, std::string private_key /* B64 */, std::string data /* B64 */, bool &error );<o:p></o:p></p><p class=MsoNormal>        bool verify( std::string algorithm, std::string data /* B64 */, std::string signature /* B64 */, std::string public_key /* B64 */, bool &error );<o:p></o:p></p><p class=MsoNormal>    <o:p></o:p></p><p class=MsoNormal>        Algorithims: SHA1, SHA256, SHA384, SHA512 with RSA, ECDSA and SHA1withDSA.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>    Digest:<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>        std::string /* B64 */ digest( std::string algorithm, std::string data );<o:p></o:p></p><p class=MsoNormal>    <o:p></o:p></p><p class=MsoNormal>        Algorithms: SHA1, SHA256, SHA384, SHA512.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>    Encrypt/Decrypt:<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>        std::string /* B64 */ encrypt( std::string algorithm, bool padding, std::string data /* B64 */, std::string key  /* B64 */ );<o:p></o:p></p><p class=MsoNormal>        std::string /* B64 */ decrypt( std::string algorithm, bool padding, std::string data /* B64 */, std::string key  /* B64 */ );<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>        Algorithms: des-ede-cbc, des-ede, des-ede-cfb, des-ede-ofb, des-ede3-cbc, des-ede3, des3, des-ede3-cfb, des-ede3-ofb, aes-[128|192|256]-cbc, aes-[128|192|256], aes-[128|192|256]-cfb, aes-[128|192|256]-cfb1, aes-[128|192|256]-cfb8, aes-[128|192|256]-ecb, aes-[128|192|256]-ofb.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Thanks very much,<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Marcus<span lang=PT-BR><o:p></o:p></span></p><p class=MsoNormal><span lang=PT-BR><o:p> </o:p></span></p></div></body></html>