资源简介
中国银行-网上支付接口.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机床数据和参数
- 下一篇:一个完整的前台和后台都有的电子商务网站
相关资源
- libxl-3.1.zip
- 暴风影音csf解码器(1).rar
- IAR10.10破解文件.rar
- Teleport_Ultra_1.65_full_SC.rar
- osg3.0.0.rar
- GBT21062-2007政务信息资源交换体系-完整
- 1126068ViVi万能小偷网站程序站群版V3
- SEED-XDS510PLUS仿真器安装、使用指南-
- 高仿今日头条二.zip
- iptapev3.zip
- niutousoft.zip
- 自行车租赁管理系统.7z
- 1591808GrapeCity.Activate.S
- multi_RAM.zip
- GeoSOS软件用户手册.pdf
- 虚拟机批量克隆工具.rar
- 新麦客服1.2.8.rar
- IDAPro权威指南全代码.zip
- WindowsLoader.exe.zip
- gcr1218_9916885.pdf
- 网络硬盘网站.7z
- IDM套装.zip
- WindowsFormsApplication1.rar
- 微擎首页模版,首页PC应用模块官网代
- RoutingTCPIPVolume12ndEdition(2005).chm
- GBT222392008.rar
- ProbabilisticRobotics.pdf
- foresightyj_7504901.zip
- 02、网络监听及防御技术.pdf
- 2hndve.rar
评论
共有 条评论