RE: Problem(s) verifying signed message with detached content
"Rupe, Jonathan C UTCFS" <[email protected]> Thu, 17 May 2007 11:57:38 -0400
| Newsgroups | gmane.ietf.sfl |
|---|---|
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format. ------_=_NextPart_001_01C7989C.184012E0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Tom, =20 Thank you very much for your quick response! I added the code for SHA256 and this fixed the first problem as you said. Thanks for looking into the second problem as well. I appreciate your help! =20 -Jon ________________________________ From: Horvath, Tom (US SSA) [mailto:[email protected]]=20 Sent: Thursday, May 17, 2007 11:24 AM To: Rupe, Jonathan C UTCFS; [email protected] Subject: RE: Problem(s) verifying signed message with detached content Jon, =20 Your usage of the SFL looks appropriate you have just found one bug and I am not sure yet about the second problem. The first problem you reported "encapsulated content digest !=3D message digest attribute" happens because the SHA-256 message digest reference algorithm that we use does not return the digest in platform independent endianness, so the digest comparison fails. The first problem was easy to fix, simply add the following code at line 4674 of smp/SMIME/alg_libs/sm_free3/sm_free3.cpp: =20 } else if (oidDigest =3D=3D SNACC::id_SHA256 || oidDigest =3D=3D SNACC::id_ecdsa_with_SHA256) { bool bLastBlock =3D false; // set to true when this is the last block CryptoPP::SHA256 sha256; =20 int bytesProcessed=3D0; int loop =3D pData->Length() / sha256.DigestSize(); =20 SME(pData->Open(SM_FOPEN_READ)); while (!bLastBlock) { SME(pchData =3D pData->nRead(sha256.DigestSize(), (SM_SIZE_T&)lBytesRead)); if ((lBytesRead !=3D sha256.DigestSize()) || (pchData = =3D=3D NULL)) bLastBlock =3D true; sha256.Update((const unsigned char *)pchData, lBytesRead); } =20 CryptoPP::SecByteBlock digest(sha256.DigestSize()); sha256.Final(digest); =20 SME(pDigest->Open(SM_FOPEN_WRITE)); // open the digest buffer SME(pDigest->Write((char *)digest.data(), digest.m_size));=20 status =3D 0; } =20 If you do this then the SFL Free 3 CTIL will use crypto++ SHA-256 message digest algorithm which works correctly and returns the digest in the correct endianness. =20 I am still looking into the second problem and will get back to your shortly. =20 =20 --Tom =20 ________________________________ From: [email protected] [mailto:[email protected]] On Behalf Of Rupe, Jonathan C UTCFS Sent: Wednesday, May 16, 2007 11:47 AM To: [email protected] Subject: Problem(s) verifying signed message with detached content =20 I am having a problem (or two) verifying a signed message that has detached content. I am getting the error "encapsulated content digest = !=3D message digest attribute". However, I have been able to successfully verify the message with another API (that I cannot use). If I skip past where this exception is thrown (in sm_msgsignerinfo.cpp) I also get the following error: "RSA OID Unknown or Not Handled Yet!" The hashing algorithm is SHA-256 and signature algorithm is RSA. Is this supported? Below is my code and attached are the sample files. I'm new with all this stuff so any help (especially sample code :)) will be greatly appreciated!=20 Thanks!=20 Jon=20 =20 CSM_AppLogin appLogin;=20 appLogin.AddLogin(CTIL_FILE_NAME, NULL);=20 CSM_Buffer contentInfoBuf("./CHUIDSig.bin");=20 CSM_Buffer* pSignedDataBuf =3D NULL;=20 CSM_ContentInfoMsg contentInfoMsg(&contentInfoBuf);=20 if (contentInfoMsg.IsSignedData())=20 {=20 SM_RET_VAL retVal =3D 0;=20 CSM_MsgToVerify msgToVerify; //(&contentInfoMsg);=20 =20 pSignedDataBuf =3D new CSM_Buffer( contentInfoMsg.AccessEncapContentClear()->m_content.Access(),=20 =20 contentInfoMsg.AccessEncapContentClear()->m_content.Length() );=20 =20 retVal =3D msgToVerify.PreProc(&appLogin, pSignedDataBuf);=20 if( retVal !=3D SM_NO_ERROR )=20 {=20 tcout <<_T("Failed to process verification message.") <<endl;=20 return 1;=20 }=20 CSM_Buffer encapContent("./CHUIDData.bin");=20 CSM_Content content(&encapContent);=20 SNACC::AsnOid encapAsnOid =3D ID_PIV_CHUIDSECURITYOBJECT;=20 msgToVerify.SetEncapContentClear(content);=20 if( (retVal =3D msgToVerify.Verify(&appLogin)) =3D=3D = SM_NO_ERROR )=20 {=20 tcout <<_T("Verification passed!") <<endl;=20 }=20 else=20 {=20 tcout <<_T("Failed signature verification.") <<endl;=20 }=20 }=20 else=20 {=20 tcout <<_T("Content doesn't contain SignedData") <<endl;=20 }=20 <<TestData.zip>>=20 ------_=_NextPart_001_01C7989C.184012E0 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML xmlns=3D"http://www.w3.org/TR/REC-html40" xmlns:v =3D=20 "urn:schemas-microsoft-com:vml" xmlns:o =3D=20 "urn:schemas-microsoft-com:office:office" xmlns:w =3D=20 "urn:schemas-microsoft-com:office:word"><HEAD><TITLE>Problem(s) = verifying signed message with detached content</TITLE> <META http-equiv=3DContent-Type content=3D"text/html; = charset=3Dus-ascii"> <META content=3D"MSHTML 6.00.2900.3059" name=3DGENERATOR><!--[if !mso]> <STYLE>v\:* { BEHAVIOR: url(#default#VML) } o\:* { BEHAVIOR: url(#default#VML) } w\:* { BEHAVIOR: url(#default#VML) } .shape { BEHAVIOR: url(#default#VML) } </STYLE> <![endif]--> <STYLE>@font-face { font-family: Tahoma; } @page Section1 {size: 8.5in 11.0in; margin: 1.0in 1.25in 1.0in 1.25in; } P.MsoNormal { FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman" } LI.MsoNormal { FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman" } DIV.MsoNormal { FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman" } A:link { COLOR: blue; TEXT-DECORATION: underline } SPAN.MsoHyperlink { COLOR: blue; TEXT-DECORATION: underline } A:visited { COLOR: purple; TEXT-DECORATION: underline } SPAN.MsoHyperlinkFollowed { COLOR: purple; TEXT-DECORATION: underline } P { FONT-SIZE: 12pt; MARGIN-LEFT: 0in; MARGIN-RIGHT: 0in; FONT-FAMILY: = "Times New Roman"; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto } SPAN.EmailStyle18 { COLOR: navy; FONT-FAMILY: Arial; mso-style-type: personal-reply } DIV.Section1 { page: Section1 } </STYLE> </HEAD> <BODY lang=3DEN-US vLink=3Dpurple link=3Dblue> <DIV dir=3Dltr align=3Dleft><SPAN class=3D675415415-17052007><FONT = face=3DArial=20 color=3D#0000ff size=3D2>Tom,</FONT></SPAN></DIV> <DIV dir=3Dltr align=3Dleft><SPAN class=3D675415415-17052007><FONT = face=3DArial=20 color=3D#0000ff size=3D2></FONT></SPAN> </DIV> <DIV dir=3Dltr align=3Dleft><SPAN class=3D675415415-17052007><FONT = face=3DArial=20 color=3D#0000ff size=3D2>Thank you very much for your quick response! I = added the=20 code for SHA256 and this fixed the first problem as you said. Thanks for = looking=20 into the second problem as well. I appreciate your = help!</FONT></SPAN></DIV> <DIV dir=3Dltr align=3Dleft><SPAN class=3D675415415-17052007><FONT = face=3DArial=20 color=3D#0000ff size=3D2></FONT></SPAN> </DIV> <DIV dir=3Dltr align=3Dleft><SPAN class=3D675415415-17052007><FONT = face=3DArial=20 color=3D#0000ff size=3D2>-Jon</FONT></SPAN></DIV><BR> <DIV class=3DOutlookMessageHeader lang=3Den-us dir=3Dltr align=3Dleft> <HR tabIndex=3D-1> <FONT face=3DTahoma size=3D2><B>From:</B> Horvath, Tom (US SSA)=20 [mailto:[email protected]] <BR><B>Sent:</B> Thursday, May 17, = 2007=20 11:24 AM<BR><B>To:</B> Rupe, Jonathan C UTCFS;=20 [email protected]<BR><B>Subject:</B> RE: Problem(s) verifying signed = message with=20 detached content<BR></FONT><BR></DIV> <DIV></DIV> <DIV class=3DSection1> <P class=3DMsoNormal><FONT face=3DArial color=3Dnavy size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: = Arial">Jon,<o:p></o:p></SPAN></FONT></P> <P class=3DMsoNormal><FONT face=3DArial color=3Dnavy size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: = Arial"><o:p> </o:p></SPAN></FONT></P> <P class=3DMsoNormal><FONT face=3DArial size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">Your usage of the SFL = looks=20 appropriate you have just found one bug and I am not sure yet about the = second=20 problem.<FONT color=3Dnavy><SPAN=20 style=3D"COLOR: navy"><o:p></o:p></SPAN></FONT></SPAN></FONT></P> <P class=3DMsoNormal><FONT face=3DArial color=3Dnavy size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">The first = problem you=20 reported </SPAN></FONT><FONT face=3DArial size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">"encapsulated content = digest !=3D=20 message digest attribute" happens because the SHA-256 message digest = reference=20 algorithm that we use does not return the digest in platform independent = endianness, so the digest comparison fails. The first problem was = easy to=20 fix, simply add the following code at line 4674 of=20 smp/SMIME/alg_libs/sm_free3/sm_free3.cpp:<o:p></o:p></SPAN></FONT></P> <P class=3DMsoNormal><FONT face=3DArial size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; FONT-FAMILY: = Arial"><o:p> </o:p></SPAN></FONT></P> <P class=3DMsoNormal><FONT face=3D"Courier New" size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier = New'"> =20 } else if (oidDigest =3D=3D SNACC::id_SHA256=20 ||<o:p></o:p></SPAN></FONT></P> <P class=3DMsoNormal><FONT face=3D"Courier New" size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier = New'"> &= nbsp;=20 oidDigest =3D=3D = SNACC::id_ecdsa_with_SHA256)<o:p></o:p></SPAN></FONT></P> <P class=3DMsoNormal><FONT face=3D"Courier New" size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier = New'"> =20 {<o:p></o:p></SPAN></FONT></P> <P class=3DMsoNormal><FONT face=3D"Courier New" size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier = New'"> = bool bLastBlock =3D false; // set to true when this is the last=20 block<o:p></o:p></SPAN></FONT></P> <P class=3DMsoNormal><FONT face=3D"Courier New" size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier = New'"> = CryptoPP::SHA256 sha256;<o:p></o:p></SPAN></FONT></P> <P class=3DMsoNormal><FONT face=3D"Courier New" size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier = New'"><o:p> </o:p></SPAN></FONT></P> <P class=3DMsoNormal><FONT face=3D"Courier New" size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier = New'"> = int bytesProcessed=3D0;<o:p></o:p></SPAN></FONT></P> <P class=3DMsoNormal><FONT face=3D"Courier New" size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier = New'"> = int loop =3D pData->Length() /=20 sha256.DigestSize();<o:p></o:p></SPAN></FONT></P> <P class=3DMsoNormal><FONT face=3D"Courier New" size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier = New'"><o:p> </o:p></SPAN></FONT></P> <P class=3DMsoNormal><FONT face=3D"Courier New" size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> = =20 =20 SME(pData->Open(SM_FOPEN_READ));<o:p></o:p></SPAN></FONT></P> <P class=3DMsoNormal><FONT face=3D"Courier New" size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier = New'"> =20 while = (!bLastBlock)<o:p></o:p></SPAN></FONT></P> <P class=3DMsoNormal><FONT face=3D"Courier New" size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier = New'"> =20 {<o:p></o:p></SPAN></FONT></P> <P class=3DMsoNormal style=3D"MARGIN-LEFT: 1.5in"><FONT face=3D"Courier = New"=20 size=3D2><SPAN style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier = New'">SME(pchData =3D=20 pData->nRead(sha256.DigestSize(),=20 (SM_SIZE_T&)lBytesRead));<o:p></o:p></SPAN></FONT></P> <P class=3DMsoNormal><FONT face=3D"Courier New" size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier = New'"> =20 if ((lBytesRead !=3D=20 sha256.DigestSize()) || (pchData =3D=3D = NULL))<o:p></o:p></SPAN></FONT></P> <P class=3DMsoNormal><FONT face=3D"Courier New" size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier = New'"> = = bLastBlock =3D=20 true;<o:p></o:p></SPAN></FONT></P> <P class=3DMsoNormal><FONT face=3D"Courier New" size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier = New'"> =20 sha256.Update((const = unsigned=20 char *)pchData, lBytesRead);<o:p></o:p></SPAN></FONT></P> <P class=3DMsoNormal><FONT face=3D"Courier New" size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier = New'"> =20 }<o:p></o:p></SPAN></FONT></P> <P class=3DMsoNormal><FONT face=3D"Courier New" size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier = New'"> = <o:p></o:p></SPAN></FONT></P> <P class=3DMsoNormal><FONT face=3D"Courier New" size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier = New'"> = CryptoPP::SecByteBlock = digest(sha256.DigestSize());<o:p></o:p></SPAN></FONT></P> <P class=3DMsoNormal><FONT face=3D"Courier New" size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier = New'"> = sha256.Final(digest);<o:p></o:p></SPAN></FONT></P> <P class=3DMsoNormal><FONT face=3D"Courier New" size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier = New'"><o:p> </o:p></SPAN></FONT></P> <P class=3DMsoNormal><FONT face=3D"Courier New" size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier = New'"> = SME(pDigest->Open(SM_FOPEN_WRITE)); // open the digest=20 buffer<o:p></o:p></SPAN></FONT></P> <P class=3DMsoNormal><FONT face=3D"Courier New" size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier = New'"> = SME(pDigest->Write((char *)digest.data(), digest.m_size));=20 <o:p></o:p></SPAN></FONT></P> <P class=3DMsoNormal><FONT face=3D"Courier New" size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier = New'"> = status =3D 0;<o:p></o:p></SPAN></FONT></P> <P class=3DMsoNormal><FONT face=3D"Courier New" size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier = New'"> =20 }<o:p></o:p></SPAN></FONT></P> <P class=3DMsoNormal><FONT face=3D"Courier New" size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier = New'"><o:p> </o:p></SPAN></FONT></P> <P class=3DMsoNormal><FONT face=3DArial size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">If you do this then the = SFL Free 3=20 CTIL will use crypto++ SHA-256 message digest algorithm which works = correctly=20 and returns the digest in the correct = endianness.<o:p></o:p></SPAN></FONT></P> <P class=3DMsoNormal><FONT face=3DArial size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; FONT-FAMILY: = Arial"><o:p> </o:p></SPAN></FONT></P> <P class=3DMsoNormal><FONT face=3DArial size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">I am still looking into = the second=20 problem and will get back to your shortly. = <o:p></o:p></SPAN></FONT></P> <P class=3DMsoNormal><FONT face=3DArial size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; FONT-FAMILY: = Arial"><o:p> </o:p></SPAN></FONT></P> <P class=3DMsoNormal><FONT face=3DArial size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; FONT-FAMILY: = Arial">--Tom<o:p></o:p></SPAN></FONT></P> <P class=3DMsoNormal><FONT face=3DArial color=3Dnavy size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: = Arial"><o:p> </o:p></SPAN></FONT></P> <DIV> <DIV class=3DMsoNormal style=3D"TEXT-ALIGN: center" align=3Dcenter><FONT = face=3D"Times New Roman" size=3D3><SPAN style=3D"FONT-SIZE: 12pt"> <HR tabIndex=3D-1 align=3Dcenter width=3D"100%" SIZE=3D2> </SPAN></FONT></DIV> <P class=3DMsoNormal><B><FONT face=3DTahoma size=3D2><SPAN=20 style=3D"FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: = Tahoma">From:</SPAN></FONT></B><FONT=20 face=3DTahoma size=3D2><SPAN style=3D"FONT-SIZE: 10pt; FONT-FAMILY: = Tahoma">=20 [email protected] [mailto:[email protected]] <B><SPAN=20 style=3D"FONT-WEIGHT: bold">On Behalf Of </SPAN></B>Rupe, Jonathan C=20 UTCFS<BR><B><SPAN style=3D"FONT-WEIGHT: bold">Sent:</SPAN></B> = Wednesday, May 16,=20 2007 11:47 AM<BR><B><SPAN style=3D"FONT-WEIGHT: bold">To:</SPAN></B>=20 [email protected]<BR><B><SPAN style=3D"FONT-WEIGHT: = bold">Subject:</SPAN></B>=20 Problem(s) verifying signed message with detached=20 content</SPAN></FONT><o:p></o:p></P></DIV> <P class=3DMsoNormal><FONT face=3D"Times New Roman" size=3D3><SPAN=20 style=3D"FONT-SIZE: 12pt"><o:p> </o:p></SPAN></FONT></P> <P><FONT face=3DArial size=3D2><SPAN style=3D"FONT-SIZE: 10pt; = FONT-FAMILY: Arial">I=20 am having a problem (or two) verifying a signed message that has = detached=20 content. I am getting the error "encapsulated content digest !=3D = message digest=20 attribute". However, I have been able to successfully verify the message = with=20 another API (that I cannot use). If I skip past where this exception is = thrown=20 (in sm_msgsignerinfo.cpp) I also get the following error: "RSA OID = Unknown or=20 Not Handled Yet!" The hashing algorithm is SHA-256 and signature = algorithm is=20 RSA. Is this supported? Below is my code and attached are the = sample=20 files.</SPAN></FONT><o:p></o:p></P> <P><FONT face=3DArial size=3D2><SPAN style=3D"FONT-SIZE: 10pt; = FONT-FAMILY: Arial">I'm=20 new with all this stuff so any help (especially sample code :)) will be = greatly=20 appreciated!</SPAN></FONT> <o:p></o:p></P> <P><FONT face=3DArial size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">Thanks!</SPAN></FONT> = <BR><FONT=20 face=3DArial size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">Jon</SPAN></FONT> = <o:p></o:p></P> <P class=3DMsoNormal><FONT face=3D"Times New Roman" size=3D3><SPAN=20 style=3D"FONT-SIZE: 12pt"><o:p> </o:p></SPAN></FONT></P> <P><FONT face=3D"Courier New" size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">CSM_AppLogin=20 appLogin;</SPAN></FONT> <BR><FONT face=3D"Courier New" size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier = New'">appLogin.AddLogin(CTIL_FILE_NAME,=20 NULL);</SPAN></FONT> <o:p></o:p></P> <P><FONT face=3D"Courier New" size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">CSM_Buffer=20 contentInfoBuf("./CHUIDSig.bin");</SPAN></FONT> <BR><FONT = face=3D"Courier New"=20 size=3D2><SPAN style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier = New'">CSM_Buffer*=20 pSignedDataBuf =3D NULL;</SPAN></FONT> <o:p></o:p></P> <P><FONT face=3D"Courier New" size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">CSM_ContentInfoMsg = contentInfoMsg(&contentInfoBuf);</SPAN></FONT> <BR><FONT = face=3D"Courier New"=20 color=3Dblue size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier = New'">if</SPAN></FONT><FONT=20 face=3D"Courier New" size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">=20 (contentInfoMsg.IsSignedData())</SPAN></FONT> <BR><FONT face=3D"Courier = New"=20 size=3D2><SPAN style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier = New'">{</SPAN></FONT>=20 <BR> <FONT face=3D"Courier = New"=20 size=3D2><SPAN style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier = New'">SM_RET_VAL=20 retVal =3D 0;</SPAN></FONT> <o:p></o:p></P> <P><FONT face=3D"Times New Roman" size=3D3><SPAN=20 style=3D"FONT-SIZE: 12pt"> =20 </SPAN></FONT><FONT face=3D"Courier New" size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">CSM_MsgToVerify = msgToVerify;=20 <FONT color=3Dgreen><SPAN=20 style=3D"COLOR: = green">//(&contentInfoMsg);</SPAN></FONT></SPAN></FONT>=20 <BR> =20 =20 =20 <BR> <FONT face=3D"Courier = New"=20 size=3D2><SPAN style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier = New'">pSignedDataBuf=20 =3D <FONT color=3Dblue><SPAN style=3D"COLOR: blue">new</SPAN></FONT>=20 CSM_Buffer( =20 contentInfoMsg.AccessEncapContentClear()->m_content.Access(),</SPAN></= FONT>=20 <BR> =20 =20 =20 =20 =20 =20 <FONT face=3D"Courier New" = size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier = New'">contentInfoMsg.AccessEncapContentClear()->m_content.Length()=20 );</SPAN></FONT> <BR> =20 =20 =20 <BR> <FONT face=3D"Courier = New"=20 size=3D2><SPAN style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier = New'">retVal =3D=20 msgToVerify.PreProc(&appLogin, pSignedDataBuf);</SPAN></FONT>=20 <BR> <FONT face=3D"Courier = New"=20 color=3Dblue size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier = New'">if</SPAN></FONT><FONT=20 face=3D"Courier New" size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">( retVal !=3D = SM_NO_ERROR=20 )</SPAN></FONT> <BR> <FONT=20 face=3D"Courier New" size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">{</SPAN></FONT>=20 <BR> =20 <FONT face=3D"Courier New" = size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">tcout = <<_T("Failed to=20 process verification message.") <<endl;</SPAN></FONT>=20 <BR> =20 <FONT face=3D"Courier New" = color=3Dblue=20 size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier = New'">return</SPAN></FONT><FONT=20 face=3D"Courier New" size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> 1;</SPAN></FONT>=20 <BR> <FONT face=3D"Courier = New"=20 size=3D2><SPAN style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier = New'">}</SPAN></FONT>=20 <o:p></o:p></P> <P><FONT face=3D"Times New Roman" size=3D3><SPAN=20 style=3D"FONT-SIZE: 12pt"> =20 </SPAN></FONT><FONT face=3D"Courier New" size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">CSM_Buffer=20 encapContent("./CHUIDData.bin");</SPAN></FONT>=20 <BR> <FONT face=3D"Courier = New"=20 size=3D2><SPAN style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier = New'">CSM_Content=20 content(&encapContent);</SPAN></FONT>=20 <BR> <FONT face=3D"Courier = New"=20 size=3D2><SPAN style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier = New'">SNACC::AsnOid=20 encapAsnOid =3D ID_PIV_CHUIDSECURITYOBJECT;</SPAN></FONT>=20 <BR> <FONT face=3D"Courier = New"=20 size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier = New'">msgToVerify.SetEncapContentClear(content);</SPAN></FONT>=20 <o:p></o:p></P> <P><FONT face=3D"Times New Roman" size=3D3><SPAN=20 style=3D"FONT-SIZE: 12pt"> =20 </SPAN></FONT><FONT face=3D"Courier New" color=3Dblue size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier = New'">if</SPAN></FONT><FONT=20 face=3D"Courier New" size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">( (retVal =3D=20 msgToVerify.Verify(&appLogin)) =3D=3D SM_NO_ERROR )</SPAN></FONT>=20 <BR> <FONT face=3D"Courier = New"=20 size=3D2><SPAN style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier = New'">{</SPAN></FONT>=20 <BR> =20 <FONT face=3D"Courier New" = size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">tcout=20 <<_T("Verification passed!") <<endl;</SPAN></FONT>=20 <BR> <FONT face=3D"Courier = New"=20 size=3D2><SPAN style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier = New'">}</SPAN></FONT>=20 <BR> <FONT face=3D"Courier = New"=20 color=3Dblue size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier = New'">else</SPAN></FONT>=20 <BR> <FONT face=3D"Courier = New"=20 size=3D2><SPAN style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier = New'">{</SPAN></FONT>=20 <BR> =20 <FONT face=3D"Courier New" = size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">tcout = <<_T("Failed=20 signature verification.") <<endl;</SPAN></FONT>=20 <BR> <FONT face=3D"Courier = New"=20 size=3D2><SPAN style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier = New'">}</SPAN></FONT>=20 <BR><FONT face=3D"Courier New" size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">}</SPAN></FONT> = <BR><FONT=20 face=3D"Courier New" color=3Dblue size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier = New'">else</SPAN></FONT>=20 <BR><FONT face=3D"Courier New" size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">{</SPAN></FONT>=20 <BR> <FONT face=3D"Courier = New"=20 size=3D2><SPAN style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier = New'">tcout=20 <<_T("Content doesn't contain SignedData") = <<endl;</SPAN></FONT>=20 <BR><FONT face=3D"Courier New" size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">}</SPAN></FONT>=20 <o:p></o:p></P> <P><FONT face=3DArial color=3Dblack size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: = Arial"><<TestData.zip>>=20 </SPAN></FONT><o:p></o:p></P></DIV></BODY></HTML> ------_=_NextPart_001_01C7989C.184012E0--