资源简介
中国银行-网上支付接口.net语言开发示例.rar

代码片段和文件信息
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Security;
using System.Security.Cryptography;
using System.Security.Cryptography.Pkcs;
using System.Security.Cryptography.X509Certificates;
using System.IO;
namespace P7Verify_CSharp
{
class PKCS7Tool
{
public static byte[] DecodeFromFile(string inFileName)
{
Frombase64Transform myTransform = new Frombase64Transform(Frombase64TransformMode.IgnoreWhiteSpaces);
byte[] myOutputBytes = new byte[myTransform.OutputBlockSize];
//Open the input and output files.
FileStream myInputFile = new FileStream(inFileName FileMode.Open FileAccess.Read);
//Retrieve the file contents into a byte array.
byte[] myInputBytes = new byte[myInputFile.Length];
myInputFile.Read(myInputBytes 0 myInputBytes.Length);
MemoryStream outputDataStream = new MemoryStream(myInputBytes.Length);
//Transform the data in chunks the size of InputBlockSize.
int i = 0;
int inputBlockSize = 4;
while (myInputBytes.Length - i > inputBlockSize)
{
int nOutput = myTransform.TransformBlock(myInputBytes i inputBlockSize myOutputBytes 0);
i += inputBlockSize;
if (nOutput > 0)
{
outputDataStream.Write(myOutputBytes 0 nOutput);
}
}
//Transform the final block of data.
myOutputBytes = myTransform.TransformFinalBlock(myInputBytes i myInputBytes.Length - i);
outputDataStream.Write(myOutputBytes 0 myOutputBytes.Length);
//Free up any used resources.
myTransform.Clear();
myInputFile.Close();
outputDataStream.Position = 0;
byte[] outputData = new byte[outputDataStream.Length];
outputDataStream.Read(outputData 0 (int)outputDataStream.Length);
outputDataStream.Close();
return outputData;
}
public static Boolean Verify(byte[] sig byte[] msgstring dn)
{
Boolean b = true;
try
{
ContentInfo signedData = new ContentInfo(msg);
SignedCms cms = new SignedCms(signedData true);
cms.Decode(sig);
//Check Signature
cms.CheckSignature(true);
//Check dn
if (cms.Certificates.Count > 0 )
{
X509Certificate2 cert = cms.Certificates[0];
if (!string.IsNullOrEmpty(dn) && !dn.Equals(cert.Subject))
{
b = false;
}
}
byte[] data = cms.Encode();
}
catch (Exception e)
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
....... 117 2012-05-15 11:08 网上支付接口.net语言开发示例\P7Verify_CSharp\P7Verify_CSharp\app.config
....... 2677 2012-05-15 11:08 网上支付接口.net语言开发示例\P7Verify_CSharp\P7Verify_CSharp\P7Verify_CSharp.csproj
....... 330 2012-05-15 11:08 网上支付接口.net语言开发示例\P7Verify_CSharp\P7Verify_CSharp\P7Verify_CSharp.csproj.user
....... 257 2012-05-15 11:08 网上支付接口.net语言开发示例\P7Verify_CSharp\P7Verify_CSharp\P7Verify_CSharp.csproj.vspscc
....... 5763 2012-05-15 11:08 网上支付接口.net语言开发示例\P7Verify_CSharp\P7Verify_CSharp\PKCS7Tool.cs
....... 3968 2012-05-15 11:08 网上支付接口.net语言开发示例\P7Verify_CSharp\P7Verify_CSharp\Program.cs
....... 1442 2012-05-15 11:08 网上支付接口.net语言开发示例\P7Verify_CSharp\P7Verify_CSharp\Properties\AssemblyInfo.cs
....... 1393 2012-05-15 11:08 网上支付接口.net语言开发示例\P7Verify_CSharp\P7Verify_CSharp.sln
....... 222 2012-05-15 11:08 网上支付接口.net语言开发示例\readme.txt
....... 1046 2012-05-15 11:08 网上支付接口.net语言开发示例\证书以及测试文件\BOC-CA.cer
....... 1900 2012-05-15 11:08 网上支付接口.net语言开发示例\证书以及测试文件\demo.pfx
....... 1308 2012-05-15 11:08 网上支付接口.net语言开发示例\证书以及测试文件\sign.txt
....... 1276 2012-05-15 11:08 网上支付接口.net语言开发示例\证书以及测试文件\signDotNet.txt
....... 34 2012-05-15 11:08 网上支付接口.net语言开发示例\证书以及测试文件\text.txt
目录 0 2013-04-23 11:09 网上支付接口.net语言开发示例\P7Verify_CSharp\P7Verify_CSharp\Properties
目录 0 2013-04-23 11:09 网上支付接口.net语言开发示例\P7Verify_CSharp\P7Verify_CSharp
目录 0 2013-04-23 11:09 网上支付接口.net语言开发示例\P7Verify_CSharp
目录 0 2013-04-23 11:09 网上支付接口.net语言开发示例\证书以及测试文件
目录 0 2013-04-23 11:09 网上支付接口.net语言开发示例
....... 1048064 2012-05-15 11:08 中行公钥证书(电子支付二级根证书)下载指引.ppt
文件 565760 2011-12-17 17:04 B2C商户端接口说明(ver 2.3).doc
----------- --------- ---------- ----- ----
1635557 21
- 上一篇:840D sl机床数据和参数
- 下一篇:一个完整的前台和后台都有的电子商务网站
相关资源
- PID_AutoTune_v0.rar
- vspd7.2.308.zip
- 价值2k的H漫画小说系统
- Pythonamp;课堂amp;笔记(高淇amp;400;集第
- ddos压力测试工具99657
- UML建模大全
- 开源1A锂电池充电板TP4056原理图+PCB
- m1卡 ic卡可选择扇区初始化加密软件
- TSCC.exe
- FTP课程设计(服务端+客户端)
- 计算机图形学 边填充算法实现代码
- 电力系统潮流计算程序集合
- oracle数据迁移项目实施方案
- Web Api 通过文件流 文件到本地
- Visio图标-最新最全的网络通信图标库
- Spire API文档
- OpenGL参考手册
- Python中Numpy库最新教程
- SPD博士V5.3.exe
- 直流无刷电机方波驱动 stm32 例程代码
- layui后台管理模板
- 仿知乎界面小程序源代码
- 云平台-阿里云详细介绍
- photoshop经典1000例
- scratch垃圾分类源码(最终版本).sb
- IAR ARM 7.8破解
- TI CCS V5.4 安装步骤及破解文件
- 松下plc FP-XH的驱动
- 局域网硬件信息收集工具
- 加快Windows XP操作系统开机速度
评论
共有 条评论