-
大小: 10.39MB文件類型: .rar金幣: 2下載: 0 次發(fā)布日期: 2023-12-20
- 語言: C#
- 標(biāo)簽:
資源簡介
史上資料最全的資料,和示例程序,C#RSA證書操作,用cer,pfx證書進(jìn)行RSA加解密帶Makecert,exe工具,參考資料,很全,微軟數(shù)字證書操作API函數(shù)使用
1。Makecert.exe ---證書創(chuàng)建工具
2。Cert2Spc.exe ---發(fā)行者證書測試工具
3。signcode.exe ---文件簽名工具
4。chktrust.exe ---來查驗(yàn)已經(jīng)簽名的代碼
我們可以使用signcode.exe和自己的"數(shù)字證書"簽署自己的軟件,給軟件加上數(shù)字簽名

代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.Text;
using?System.Diagnostics;
using?System.Security.Cryptography.X509Certificates;
using?System.IO;
namespace?WindowsFormsAppPfs
{
????public?sealed?class?DataCertificate???
????{??
????????#region?生成證書???
????????///????
????????///?根據(jù)指定的證書名和makecert全路徑生成證書(包含公鑰和私鑰,并保存在MY存儲(chǔ)區(qū))???
????????///? ???
????????///????
????????///????
????????///? ???
????????public?static?bool?CreateCertWithPrivateKey(string?subjectName?string?makecertPath)???
????????{???
????????????subjectName?=?“CN=“?+?subjectName;???
????????????string?param?=?“?-pe?-ss?my?-n?\““?+?subjectName?+?“\“?“;???
????????????try??
????????????{???
????????????????Process?p?=?Process.Start(makecertPath?param);???
????????????????p.WaitForExit();???
????????????????p.Close();???
????????????}???
????????????catch?(Exception?e)???
????????????{???
????????????????throw?e;???
????????????}???
????????????return?true;???
????????}??
????????#endregion??
?
????????#region?文件導(dǎo)入導(dǎo)出???
????????///????
????????///?從WINDOWS證書存儲(chǔ)區(qū)的個(gè)人MY區(qū)找到主題為subjectName的證書,???
????????///?并導(dǎo)出為pfx文件,同時(shí)為其指定一個(gè)密碼???
????????///?并將證書從個(gè)人區(qū)刪除(如果isDelFromstor為true)???
????????///? ???
????????///?證書主題,不包含CN=???
????????///?pfx文件名???
????????///?pfx文件密碼???
????????///?是否從存儲(chǔ)區(qū)刪除???
????????///? ???
????????public?static?bool?ExportToPfxFile(string?subjectName?string?pfxFileName???
????????????string?password?bool?isDelFromStore)???
????????{???
????????????subjectName?=?“CN=“?+?subjectName;???
????????????X509Store?store?=?new?X509Store(StoreName.My?StoreLocation.CurrentUser);???
????????????store.Open(OpenFlags.ReadWrite);???
????????????X509Certificate2Collection?storecollection?=?(X509Certificate2Collection)store.Certificates;???
????????????foreach?(X509Certificate2?x509?in?storecollection)???
????????????{???
????????????????if?(x509.Subject?==?subjectName)???
????????????????{???
????????????????????Debug.Print(string.Format(“certificate?name:?{0}“?x509.Subject));???
??
????????????????????byte[]?pfxByte?=?x509.Export(X509ContentType.Pfx?password);???
????????????????????using?(FileStream?fileStream?=?new?FileStream(pfxFileName?FileMode.Create))???
????????????????????{???
????????????????????????//?Write?the?data?to?the?file?byte?by?byte.???
????????????????????????for?(int?i?=?0;?i?????????????????????????????fileStream.WriteByte(pfxByte[i]);???
????????????????????????//?Set?the?stream?position?to?the?beginning?of?the?file.???
????????????????????????fileStream.Seek(0?SeekOrigin.Begin);???
????????????????????????//?Read?and?verify?the?data.???
????????????????????????for?(int?i?=?0;?
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件???????1346??2010-11-11?14:04??證書操作\cer.pfx
?????文件?????680842??2010-05-03?22:24??證書操作\rsa證書操作\rsa證書操作\使用X_509數(shù)字證書加密解密實(shí)務(wù)(一)--?證書的獲得和管理?-?Focus?on?biztalk?--?chnking?-?博客園.mht
?????文件?????741345??2010-05-03?22:26??證書操作\rsa證書操作\rsa證書操作\使用X_509數(shù)字證書加密解密實(shí)務(wù)(三)--?使用RSA證書結(jié)合對稱加密技術(shù)加密長數(shù)據(jù)?-?conkeyn?-?JavaEye技術(shù)網(wǎng)站.mht
?????文件?????538949??2010-05-03?22:25??證書操作\rsa證書操作\rsa證書操作\使用X_509數(shù)字證書加密解密實(shí)務(wù)(二)--?使用RSA證書加密敏感數(shù)據(jù)?-?筆記?-?張軍?-?CSDN學(xué)生大本營?-?Powered?by?UCenter?Home.mht
?????文件????????898??2010-05-04?00:03??證書操作\rsa證書操作\rsa證書操作\RSA\RSA\RSA.sln
????..A..H.?????25600??2010-11-19?09:48??證書操作\rsa證書操作\rsa證書操作\RSA\RSA\RSA.suo
?????文件???????4321??2010-05-21?09:54??證書操作\rsa證書操作\rsa證書操作\RSA\RSA\RSA\Form1.cs
?????文件???????8422??2010-05-04?00:32??證書操作\rsa證書操作\rsa證書操作\RSA\RSA\RSA\Form1.Designer.cs
?????文件???????5814??2010-05-04?00:32??證書操作\rsa證書操作\rsa證書操作\RSA\RSA\RSA\Form1.resx
?????文件????????462??2010-05-03?23:07??證書操作\rsa證書操作\rsa證書操作\RSA\RSA\RSA\Program.cs
?????文件???????3213??2010-05-21?09:53??證書操作\rsa證書操作\rsa證書操作\RSA\RSA\RSA\RSA.csproj
?????文件???????1154??2010-05-03?23:07??證書操作\rsa證書操作\rsa證書操作\RSA\RSA\RSA\Properties\AssemblyInfo.cs
?????文件???????2830??2010-11-19?09:29??證書操作\rsa證書操作\rsa證書操作\RSA\RSA\RSA\Properties\Resources.Designer.cs
?????文件???????5612??2010-05-03?23:07??證書操作\rsa證書操作\rsa證書操作\RSA\RSA\RSA\Properties\Resources.resx
?????文件???????1101??2010-11-19?09:29??證書操作\rsa證書操作\rsa證書操作\RSA\RSA\RSA\Properties\Settings.Designer.cs
?????文件????????249??2010-05-03?23:07??證書操作\rsa證書操作\rsa證書操作\RSA\RSA\RSA\Properties\Settings.settings
?????文件???????1586??2010-11-19?09:28??證書操作\rsa證書操作\rsa證書操作\RSA\RSA\RSA\obj\RSA.csproj.FileListAbsolute.txt
?????文件????????903??2010-05-04?00:32??證書操作\rsa證書操作\rsa證書操作\RSA\RSA\RSA\obj\Debug\RSA.csproj.GenerateResource.Cache
?????文件??????24576??2010-05-21?09:53??證書操作\rsa證書操作\rsa證書操作\RSA\RSA\RSA\obj\Debug\RSA.exe
?????文件????????180??2010-05-04?00:32??證書操作\rsa證書操作\rsa證書操作\RSA\RSA\RSA\obj\Debug\RSA.Form1.resources
?????文件??????32256??2010-05-21?09:53??證書操作\rsa證書操作\rsa證書操作\RSA\RSA\RSA\obj\Debug\RSA.pdb
?????文件????????180??2010-05-03?23:08??證書操作\rsa證書操作\rsa證書操作\RSA\RSA\RSA\obj\Debug\RSA.Properties.Resources.resources
?????文件???????4608??2010-11-19?09:29??證書操作\rsa證書操作\rsa證書操作\RSA\RSA\RSA\obj\Debug\TempPE\Properties.Resources.Designer.cs.dll
?????文件???????1126??2010-05-03?23:40??證書操作\rsa證書操作\rsa證書操作\RSA\RSA\RSA\bin\Debug\MycerCert.cer
?????文件???????2566??2010-05-03?22:57??證書操作\rsa證書操作\rsa證書操作\RSA\RSA\RSA\bin\Debug\MypfxCert.pfx
?????文件??????24576??2010-05-21?09:53??證書操作\rsa證書操作\rsa證書操作\RSA\RSA\RSA\bin\Debug\RSA.exe
?????文件??????32256??2010-05-21?09:53??證書操作\rsa證書操作\rsa證書操作\RSA\RSA\RSA\bin\Debug\RSA.pdb
?????文件???????5632??2005-12-08?14:51??證書操作\rsa證書操作\rsa證書操作\RSA\RSA\RSA\bin\Debug\RSA.vshost.exe
?????文件?????571513??2010-05-03?22:33??證書操作\rsa證書操作\rsa證書操作\證書創(chuàng)建工具?(Makecert_exe).mht
?????文件???????1114??2007-03-10?12:58??證書操作\rsa證書操作\rsa證書操作\數(shù)字簽證制作工具\(yùn)制做工具\(yùn)NETZS\dads.SED
............此處省略1059個(gè)文件信息
- 上一篇:WPF漂亮倒計(jì)時(shí)界面
- 下一篇:一體機(jī)簽到程序身份證
評論
共有 條評論