CryptoAPI加解密签名验证
标签:
•
文件类型: .rar
•
文件大小: 11.48MB
•
下载次数: 1
•
利用CryptoAPI进行文件的加解密以及签名和验证服务,文件包括附录ppt
代码片段和文件信息
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 30380 2017-12-17 20:47 CryptoAPICryptoAPI.cpp
文件 3437 2017-12-04 08:17 CryptoAPICryptoAPI.dsp
文件 526 2017-12-04 09:11 CryptoAPICryptoAPI.dsw
文件 41984 2017-12-04 09:11 CryptoAPICryptoAPI.ncb
文件 48640 2017-12-04 09:11 CryptoAPICryptoAPI.opt
文件 1345 2017-12-04 09:08 CryptoAPICryptoAPI.plg
文件 24072192 2017-12-18 10:00 CryptoAPICryptoAPI.sdf
文件 3584 2017-12-18 10:00 CryptoAPICryptoAPI.suo
文件 6138 2017-12-18 08:03 CryptoAPICryptoAPI.vcxproj
文件 143 2017-12-04 09:16 CryptoAPICryptoAPI.vcxproj.user
文件 1226 2017-12-17 19:06 CryptoAPIDe.txt
文件 788 2017-12-17 20:50 CryptoAPIDebugcl.command.1.tlog
文件 13524 2017-12-17 20:50 CryptoAPIDebugCL.read.1.tlog
文件 476 2017-12-17 20:50 CryptoAPIDebugCL.write.1.tlog
文件 474624 2017-12-18 08:17 CryptoAPIDebugCryptoAPI.exe
文件 406 2017-12-11 07:59 CryptoAPIDebugCryptoAPI.exe.embed.manifest
文件 472 2017-12-11 07:59 CryptoAPIDebugCryptoAPI.exe.embed.manifest.res
文件 381 2017-12-18 08:17 CryptoAPIDebugCryptoAPI.exe.intermediate.manifest
文件 1056180 2017-12-18 08:17 CryptoAPIDebugCryptoAPI.ilk
文件 100 2017-12-18 08:17 CryptoAPIDebugCryptoAPI.lastbuildstate
文件 2107 2017-12-18 08:17 CryptoAPIDebugCryptoAPI.log
文件 60891 2017-12-17 20:50 CryptoAPIDebugCryptoAPI.obj
文件 1895424 2017-12-18 08:17 CryptoAPIDebugCryptoAPI.pdb
文件 713 2017-12-11 07:59 CryptoAPIDebugCryptoAPI.vcxprojResolveAssemblyReference.cache
文件 0 2017-12-11 07:59 CryptoAPIDebugCryptoAPI.write.1.tlog
文件 214 2017-12-11 07:59 CryptoAPIDebugCryptoAPI_manifest.rc
文件 0 2017-12-18 08:51 CryptoAPIDebugEn.txt
文件 2 2017-12-18 08:17 CryptoAPIDebuglink-cvtres.read.1.tlog
文件 2 2017-12-18 08:17 CryptoAPIDebuglink-cvtres.write.1.tlog
文件 2 2017-12-18 08:17 CryptoAPIDebuglink.10812-cvtres.read.1.tlog
............此处省略61个文件信息
#include “stdafx.h“
#include
#include
#include
#define MY_ENCODING_TYPE (PKCS_7_ASN_ENCODING | X509_ASN_ENCODING)
#define KEYLENGTH 0x00800000
void HandleError(char *s);
//--------------------------------------------------------------------
// These additional #define statements are required.
#define ENCRYPT_ALGORITHM CALG_RC4
#define ENCRYPT_BLOCK_SIZE 8
#define MAX_FILE_SIZE 4000000
#define SIGNATURE_SIZE 500
BYTE *pbKeyBlob; //用来保存导出的公钥
DWORD dwBlobLen;
// Declare the functions. The function definition
// follows main.
BOOL VerifyFile (
PCHAR szSource
PCHAR szDestination);
BOOL SignFile (
PCHAR szSource
PCHAR szDestination);
BOOL DecryptFile(
PCHAR szSource
PCHAR szDestination
PCHAR szPassword);
BOOL EncryptFile(
PCHAR szSource
PCHAR szDestination
PCHAR szPassword);
//--------------------------------------------------------------------
// Begin main.
int main()
{
CHAR szSource[100];
CHAR szDestination[100];
CHAR szPassword[100];
int Service;
char judge;
bool DoOrNot=true;
do{
printf(“**************************************************************
“);
printf(“请选择服务开始项:
“);
printf(“1.加密 2.解密
3.签名 4.验证
“);
scanf(“%d“&Service);
switch(Service){
case 1:
//--------------------------------------------------------------------
// Call EncryptFile to do the actual encryption. 加密文件
printf(“
------------------------------------------------------------
“);
printf(“
1.Encrypt a file.
“);
printf(“
Enter the name of the file to be encrypted: “);
scanf(“%s“szSource);
printf(“
Enter the name of the output file: “);
scanf(“%s“szDestination);
printf(“
Enter the password:“);
scanf(“%s“szPassword);
if(EncryptFile(szSource szDestination szPassword))
{
printf(“
Encryption of the file %s was a success.
“ szSource);
printf(“
The encrypted data is in file %s.
“szDestination);
}else{
HandleError(“
Error encrypting file!“);
}
case 2:
//--------------------------------------------------------------------
// Call Decryptfile to do the actual decryption. 解密文件
printf(“
------------------------------------------------------------
“);
printf(“
2.Decrypt a file.
“);
printf(“
Enter the name of the file to be decrypted: “);
scanf(“%s“szSource);
printf(“
Enter the name of the output file: “);
scanf(“%s“szDestination);
printf(“
Enter the password:“);
scanf(“%s“szPassword);
if(DecryptFile(szSource szDestination szPassword))
{
printf(“
Decryption of the file %s was a success.
“ szSource);
printf(“
The decrypted data is in file %s.
“szDestination);
}else{
HandleError(“
Error decrypting file!“);
}
case 3:
//--------------------------------------------------------------------
// Call S
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 30380 2017-12-17 20:47 CryptoAPICryptoAPI.cpp
文件 3437 2017-12-04 08:17 CryptoAPICryptoAPI.dsp
文件 526 2017-12-04 09:11 CryptoAPICryptoAPI.dsw
文件 41984 2017-12-04 09:11 CryptoAPICryptoAPI.ncb
文件 48640 2017-12-04 09:11 CryptoAPICryptoAPI.opt
文件 1345 2017-12-04 09:08 CryptoAPICryptoAPI.plg
文件 24072192 2017-12-18 10:00 CryptoAPICryptoAPI.sdf
文件 3584 2017-12-18 10:00 CryptoAPICryptoAPI.suo
文件 6138 2017-12-18 08:03 CryptoAPICryptoAPI.vcxproj
文件 143 2017-12-04 09:16 CryptoAPICryptoAPI.vcxproj.user
文件 1226 2017-12-17 19:06 CryptoAPIDe.txt
文件 788 2017-12-17 20:50 CryptoAPIDebugcl.command.1.tlog
文件 13524 2017-12-17 20:50 CryptoAPIDebugCL.read.1.tlog
文件 476 2017-12-17 20:50 CryptoAPIDebugCL.write.1.tlog
文件 474624 2017-12-18 08:17 CryptoAPIDebugCryptoAPI.exe
文件 406 2017-12-11 07:59 CryptoAPIDebugCryptoAPI.exe.em
文件 472 2017-12-11 07:59 CryptoAPIDebugCryptoAPI.exe.em
文件 381 2017-12-18 08:17 CryptoAPIDebugCryptoAPI.exe.intermediate.manifest
文件 1056180 2017-12-18 08:17 CryptoAPIDebugCryptoAPI.ilk
文件 100 2017-12-18 08:17 CryptoAPIDebugCryptoAPI.lastbuildstate
文件 2107 2017-12-18 08:17 CryptoAPIDebugCryptoAPI.log
文件 60891 2017-12-17 20:50 CryptoAPIDebugCryptoAPI.obj
文件 1895424 2017-12-18 08:17 CryptoAPIDebugCryptoAPI.pdb
文件 713 2017-12-11 07:59 CryptoAPIDebugCryptoAPI.vcxprojResolveAssemblyReference.cache
文件 0 2017-12-11 07:59 CryptoAPIDebugCryptoAPI.write.1.tlog
文件 214 2017-12-11 07:59 CryptoAPIDebugCryptoAPI_manifest.rc
文件 0 2017-12-18 08:51 CryptoAPIDebugEn.txt
文件 2 2017-12-18 08:17 CryptoAPIDebugli
文件 2 2017-12-18 08:17 CryptoAPIDebugli
文件 2 2017-12-18 08:17 CryptoAPIDebugli
............此处省略61个文件信息
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。
评论列表(条)