📄 encryption.mht
字号:
From: <由 Microsoft Internet Explorer 5 保存>
Subject: Encryption using the Win32 Crypto API - The Code Project - C++ / MFC
Date: Sat, 20 Oct 2007 13:28:12 +0800
MIME-Version: 1.0
Content-Type: multipart/related;
type="text/html";
boundary="----=_NextPart_000_0059_01C8131D.1065DE70"
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028
This is a multi-part message in MIME format.
------=_NextPart_000_0059_01C8131D.1065DE70
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Content-Location: http://www.codeproject.com/cpp/EncryptionCryptoAPI.asp
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Encryption using the Win32 Crypto API - The Code =
Project - C++ / MFC</TITLE>
<META http-equiv=3DReply-to content=3Dmailto:webmaster@codeproject.com>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3DISO-8859-1">
<META content=3Den-US name=3DMS.LOCALE>
<META content=3D"How to encrypt using the Win32 Crypto API." =
name=3DDescription>
<META content=3DkbArticle name=3DSearch.TopicType>
<META content=3DJessn name=3DAuthor>
<META content=3D"07 Sep 2005 14:00:00 GMT" name=3DSearch.PublishDate>
<META content=3D"07 Sep 2005 14:00:00 GMT" name=3DSearch.RevisedDate>
<META=20
content=3D"Free source code, , Visual C++, MFC, Windows, Encryption =
Win32 Crypto API"=20
name=3Dkeywords>
<META=20
content=3D"Article content copyright Jessn, 2005, everthing else =
Copyright =A9 CodeProject, 1999-2007, All Rights Reserved."=20
name=3DCopyright><LINK title=3D"CodeProject Lounge Postings"=20
href=3D"http://www.codeproject.com/webservices/LoungeRSS.aspx"=20
type=3Dapplication/rss+xml rel=3Dalternate><LINK=20
title=3D"CodeProject Latest articles - All topics"=20
href=3D"http://www.codeproject.com/webservices/articlerss.aspx?cat=3D1"=20
type=3Dapplication/rss+xml rel=3Dalternate><LINK=20
title=3D"CodeProject Latest articles - MFC / C++"=20
href=3D"http://www.codeproject.com/webservices/articlerss.aspx?cat=3D2"=20
type=3Dapplication/rss+xml rel=3Dalternate><LINK=20
title=3D"CodeProject Latest articles - C#"=20
href=3D"http://www.codeproject.com/webservices/articlerss.aspx?cat=3D3"=20
type=3Dapplication/rss+xml rel=3Dalternate><LINK=20
title=3D"CodeProject Latest articles - ASP.NET"=20
href=3D"http://www.codeproject.com/webservices/articlerss.aspx?cat=3D4"=20
type=3Dapplication/rss+xml rel=3Dalternate><LINK=20
title=3D"CodeProject Latest articles - .NET"=20
href=3D"http://www.codeproject.com/webservices/articlerss.aspx?cat=3D5"=20
type=3Dapplication/rss+xml rel=3Dalternate><LINK=20
title=3D"CodeProject Latest articles - VB.NET"=20
href=3D"http://www.codeproject.com/webservices/articlerss.aspx?cat=3D6"=20
type=3Dapplication/rss+xml rel=3Dalternate><LINK title=3D"The Code =
Project"=20
href=3D"http://www.codeproject.com/info/OpenSearch.xml"=20
type=3Dapplication/opensearchdescription+xml rel=3Dsearch><LINK =
href=3D"/favicon.ico"=20
type=3Dimage/ico rel=3Dicon><LINK href=3D"/favicon.ico" rel=3D"SHORTCUT =
ICON"><LINK=20
href=3D"http://www.codeproject.com/styles/global.css" type=3Dtext/css=20
rel=3Dstylesheet>
<SCRIPT language=3Djavascript=20
src=3D"http://www.codeproject.com/script/oncopy.js"></SCRIPT>
<SCRIPT language=3Djavascript>
if (top !=3D self) top.location.href =3D location.href;
if (typeof(DemoUrl) !=3D "undefined")
document.write('<me' + 'ta http' + '-equiv=3D"re' + 'fresh" con' + =
'tent=3D"1;url=3D' + DemoUrl + '">');
</SCRIPT>
<META content=3D"MSHTML 6.00.2900.3199" name=3DGENERATOR></HEAD>
<BODY style=3D"MARGIN: 0px" oncopy=3D"return copyCode();" text=3Dblack =
vLink=3Dnavy=20
aLink=3Dred link=3Dblue bgColor=3Dwhite>
<SCRIPT src=3D"http://www.google-analytics.com/urchin.js" =
type=3Dtext/javascript>
</SCRIPT>
<SCRIPT type=3Dtext/javascript>
_uacct =3D "UA-1735123-1";
urchinTracker();
</SCRIPT>
<TABLE cellSpacing=3D0 cellPadding=3D0 width=3D"100%" border=3D0>
<TBODY>
<TR>
<TD class=3DHeaderLogo><A href=3D"http://www.codeproject.com/"><IMG =
height=3D90=20
alt=3DHome=20
=
src=3D"http://www.codeproject.com/images/standard/codeproject225x90.gif" =
border=3D0></A></TD>
<TD class=3DHeaderBanner><SPAN id=3DAdBanner4>
<SCRIPT language=3Djavascript>document.write("<a =
href=3D\"/script/admentor/admentorredir.asp?id=3D3074&way=3Dban\" =
target=3D_blank><img =
src=3D\"/script/ann/ServeImg.aspx?File=3D%2Fscript%2Fadmentor%2Fimages%2F=
aspose%5F728x90%5FAni%5FTotal%5FStr%2Egif&C=3DFalse&id=3D3074&cb=3D504785=
\" alt=3D\"\" border=3D0 width=3D728 height=3D90></a>");</SCRIPT>
</SPAN></TD></TR>
<TR>
<TD colSpan=3D2>
<TABLE class=3DMemberNavBar cellSpacing=3D0 cellPadding=3D5 =
width=3D"100%"=20
border=3D0>
<TBODY>
<TR vAlign=3Dcenter>
<TD class=3DsmallText style=3D"FONT-WEIGHT: bold">4,616,414 =
members and=20
growing! 7,860 now online. </TD>
<TD class=3DuserNavText align=3Dright><A=20
=
href=3D"http://www.codeproject.com/script/profile/whos_who.asp?id=3D41437=
97">qzwsz=20
</A>| <A=20
=
href=3D"http://www.codeproject.com/script/profile/modify.asp?ct=3D/cpp/En=
cryptionCryptoAPI.asp"><B>My=20
Settings</B></A> | <A=20
=
href=3D"http://www.codeproject.com/script/profile/bookmark_list.asp">My=20
Bookmarks</A> | <A=20
=
href=3D"http://www.codeproject.com/script/articles/list_articles.asp?user=
id=3D4143797">My=20
Articles</A> | <A=20
=
href=3D"http://www.codeproject.com/script/profile/logoff.asp?ct=3D/cpp/En=
cryptionCryptoAPI.asp">Sign=20
out</A> </TD></TR></TBODY></TABLE></TD></TR>
<TR>
<TD colSpan=3D2>
<TABLE class=3DSiteNavBar id=3DtblSiteToolbar cellSpacing=3D0 =
cellPadding=3D0>
<TBODY>
<TR>
<TD><A href=3D"http://www.codeproject.com/">Home</A></TD>
<TD class=3DSelCat noWrap><A=20
=
href=3D"http://www.codeproject.com/index.asp?cat=3D2">MFC/C++</A></TD>
<TD><A =
href=3D"http://www.codeproject.com/index.asp?cat=3D3">C#</A></TD>
<TD noWrap><A=20
=
href=3D"http://www.codeproject.com/index.asp?cat=3D4">ASP.NET</A></TD>
<TD noWrap><A=20
=
href=3D"http://www.codeproject.com/index.asp?cat=3D6">VB.NET</A></TD>
<TD noWrap><A=20
=
href=3D"http://www.codeproject.com/index.asp?cat=3D8">Architect</A></TD>
<TD noWrap><A=20
=
href=3D"http://www.codeproject.com/index.asp?cat=3D9">SQL</A></TD>
<TD noWrap><A =
href=3D"http://www.codeproject.com/index.asp?cat=3D1">All=20
Topics</A></TD>
<TD width=3D"100%"> </TD>
<TD>
<DIV id=3DMenuPos=20
style=3D"WIDTH: 300px; POSITION: relative; TOP: 1px; HEIGHT: =
22px">
<TABLE id=3DMPH=20
style=3D"BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; =
BORDER-BOTTOM-WIDTH: 0px; HEIGHT: 20px; BORDER-RIGHT-WIDTH: 0px"=20
cellSpacing=3D0 cellPadding=3D0 width=3D300>
<TBODY>
<TR vAlign=3Dcenter>
<TD=20
style=3D"BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; =
BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px"=20
noWrap><A=20
=
href=3D"http://www.codeproject.com/info/faq.asp">Help!</A></TD>
<TD=20
style=3D"BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; =
BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px"=20
noWrap><A=20
=
href=3D"http://www.codeproject.com/info/latest.asp">Articles</A></TD>
<TD=20
style=3D"BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; =
BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px"=20
noWrap><A=20
=
href=3D"http://www.codeproject.com/script/comments/forums.asp">Message=20
Boards</A></TD>
<TD=20
style=3D"BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; =
BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px"=20
noWrap><A=20
=
href=3D"http://www.codeproject.com/lounge.asp">Lounge</A></TD></TR></TBOD=
Y></TABLE></DIV></TD></TR></TBODY></TABLE>
<SCRIPT type=3Dtext/javascript>function Go(){return}</SCRIPT>
<SCRIPT =
src=3D"http://www.codeproject.com/script/HVMenu/cpmenu_var.js"=20
type=3Dtext/javascript></SCRIPT>
<SCRIPT =
src=3D"http://www.codeproject.com/script/HVMenu/menu10_com.js"=20
type=3Dtext/javascript></SCRIPT>
<SCRIPT type=3Dtext/javascript>
var MPH =3D document.getElementById("MPH");
if (MPH) MPH.style.display=3D'none';
</SCRIPT>
</TD></TR>
<TR>
<TD colSpan=3D2>
<TABLE class=3DArticleHeader cellSpacing=3D0 cellPadding=3D3 =
width=3D"100%">
<TBODY>
<TR vAlign=3Dtop>
<TD class=3DsmallText style=3D"PADDING-RIGHT: 10px"><A=20
href=3D"http://www.codeproject.com/?cat=3D1">All Topics</A>, =
<A=20
href=3D"http://www.codeproject.com/?cat=3D2">MFC/C++</A> =
>> <A=20
href=3D"http://www.codeproject.com/cpp/">C++ / MFC</A> =
>> <A=20
=
href=3D"http://www.codeproject.com/cpp/#Cryptography">Cryptography</A><BR=
><BR>
<DIV style=3D"FONT-WEIGHT: bold; FONT-SIZE: 16pt">Encryption =
using the=20
Win32 Crypto API</DIV><B>By <A=20
=
href=3D"http://www.codeproject.com/script/Articles/list_articles.asp?user=
id=3D1546914">Jessn</A></B>.=20
<BR><BR>
<DIV style=3D"FONT-SIZE: 12px">How to encrypt using the =
Win32 Crypto=20
API.</DIV></TD>
<TD class=3DsmallText style=3D"WIDTH: 200px">C++ =
(VC6)<BR>Windows=20
(WinXP)<BR>Win32, VS (VS6), MFC<BR>Dev<BR><SPAN=20
style=3D"PADDING-RIGHT: 2ex">Posted</SPAN>: <B>8 Sep 2005=20
</B><BR><SPAN style=3D"PADDING-RIGHT: 3ex">Views</SPAN>: =
<B>44,952</B>=20
</TD></TR></TD></TR></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=3D0 cellPadding=3D0 border=3D0>
<TBODY>
<TR vAlign=3Dtop>
<TD class=3DLHNavBar rowSpan=3D2><!-- Yes, there are IE hacks =
that will allow us to create a min-width DIV=20
(eg http://www.webreference.com/programming/min-width/) but I =
couldn't
be arsed. Wait for it in v2.0 -->
<DIV class=3DFeatureBlockHeader>Announcements</DIV>
<DIV class=3D"FeatureBlockContent RHFeatureBar">
<DIV style=3D"PADDING-TOP: 5px"><IMG=20
style=3D"PADDING-RIGHT: 10px; FLOAT: left; MARGIN: 12px 3px =
12px 0px"=20
height=3D12 alt=3D"VS 2008"=20
=
src=3D"http://www.codeproject.com/Feature/VS2008/VS2008_sm.gif"=20
width=3D20> <A=20
href=3D"http://www.codeproject.com/Feature/VS2008/">Visual =
Studio=20
2008<BR>competition.<BR>$10,000 in prizes</A></DIV>
<DIV style=3D"PADDING-TOP: 3px"><IMG=20
style=3D"MARGIN-LEFT: 2px; MARGIN-RIGHT: 5px" height=3D16 =
alt=3DJobs=20
=
src=3D"http://www.codeproject.com/script/images/staff_sm.gif" width=3D12 =
align=3DabsMiddle> <A=20
=
href=3D"http://www.codeproject.com/info/jobs/">http://www.codeproject.com=
/info/jobs/</A></DIV>
<DIV style=3D"PADDING-TOP: 3px"><IMG=20
style=3D"MARGIN-LEFT: 2px; MARGIN-RIGHT: 5px" height=3D20 =
alt=3DComp=20
=
src=3D"http://www.codeproject.com/script/images/prize_winner_sm.gif"=20
width=3D10 align=3DabsMiddle> <A=20
=
href=3D"http://www.codeproject.com/script/competitions/monthly/">Monthly =
Competition</A></DIV></DIV>
<CENTER>
<SCRIPT language=3Djavascript>document.write("<a =
href=3D\"/script/admentor/admentorredir.asp?id=3D4392&way=3Dban\" =
target=3D_blank><img =
src=3D\"/script/ann/ServeImg.aspx?File=3D%2Fscript%2Fadmentor%2Fimages%2F=
WholeTomato%5FChangeSigExt%5F160x600%2Egif&C=3DFalse&id=3D4392&cb=3D50480=
5\" alt=3D\"The intellisense upgrade for Visual Studio .NET - make your =
IDE as smart as you.\" border=3D0 width=3D160 =
height=3D600></a>");</SCRIPT>
</CENTER><BR><BR><IMG height=3D1=20
src=3D"http://www.codeproject.com/script/images/t.gif" =
width=3D160> </TD>
<TD width=3D"100%">
<TABLE class=3DSearchHeaderBar cellSpacing=3D0 =
width=3D"100%">
<TBODY>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -