Microsoft Capicom 2.1 On 64bit OS
第一步下载capicom.dll
http://files.cnblogs.com/files/chen110xi/DLL.7z
第二步注册capicom.dll至SysWow64
第三步VS中设置
1.添加com,capicom.dll的参考
2.COM 元件需注意是否內嵌 Interop 型別,设置为false(只有.NET 4.0+需要)
3.专案是否设置为x86
第四步开发
http://files.cnblogs.com/files/chen110xi/KeyC.7z
C#
/// <summary>
/// 解密
/// </summary>
/// <param name="EncryptMsg">需要解密的字串</param>
/// <param name="DecryptKey">金鑰</param>
/// <returns></returns>
/// <remarks></remarks>
public static string DoDecryptCommand(string EncryptMsg,string DecryptKey)
{
string strRetrun = string.Empty;
// Dim Contents
CAPICOM.EncryptedData EncryptedData = new CAPICOM.EncryptedData(); //dynamic EncryptedData = null;
// Create the EncryptedData object.
//EncryptedData = Interaction.CreateObject("CAPICOM.EncryptedData");
// Set decryption password.
EncryptedData.SetSecret(DecryptKey);
// Load the encrypted message.
// LoadFile FileName, Message
// Now decrypt it.
EncryptedData.Decrypt(EncryptMsg);
//DoDecryptCommand = EncryptedData.Content
strRetrun = EncryptedData.Content;
// Free resources.
EncryptedData = null;
return strRetrun;
}
// End DoDecryptCommand
/// <summary>
/// 加密
/// </summary>
/// <param name="Content">要加密的字串</param>
/// <param name="Algorithm">預設3</param>
/// <param name="KeyLength">預設0</param>
/// <param name="Password">金鑰</param>
/// <returns></returns>
/// <remarks></remarks>
public static string DoEncryptCommand(string Content, CAPICOM.CAPICOM_ENCRYPTION_ALGORITHM Algorithm, CAPICOM.CAPICOM_ENCRYPTION_KEY_LENGTH KeyLength, string Password)
{
string functionReturnValue = "";
CAPICOM.EncryptedData EncryptedData = new CAPICOM.EncryptedData();
// Set algorithm, key size, and encryption password.
EncryptedData.Algorithm.Name = Algorithm;
EncryptedData.Algorithm.KeyLength = KeyLength;
EncryptedData.SetSecret(Password);
// Now encrypt it.
EncryptedData.Content = Content;
functionReturnValue = EncryptedData.Encrypt();
// Free resources.
EncryptedData = null;
return functionReturnValue;
}
VB
Imports CAPICOM Module Decrypt
'Public Fire_Up, Login_OK, Pass1 As String
''' <summary>
''' 解密
''' </summary>
''' <param name="EncryptMsg">密文</param>
''' <param name="DecryptKey">密匙</param>
''' <returns>明文</returns>
''' <remarks></remarks>
Public Function DoDecryptCommand(ByVal EncryptMsg, ByVal DecryptKey, Optional ByVal Algorithm = , Optional ByVal KeyLength = )
'Dim Contents
'Dim EncryptedData
'' Create the EncryptedData object.
'EncryptedData = CreateObject("CAPICOM.EncryptedData")
'' Set decryption password. 'EncryptedData.Algorithm.Name = Algorithm
'EncryptedData.Algorithm.KeyLength = KeyLength 'EncryptedData.SetSecret(DecryptKey)
'' Load the encrypted message.
'' LoadFile FileName, Message
'' Now decrypt it.
'EncryptedData.Decrypt(EncryptMsg) 'Nelson Mark
'Contents = Trim(EncryptedData.Content) 'Nelson Mark
'Pass1 = Contents
'EncryptedData = Nothing
'Return Contents 'Nelson Mark
Dim encryptedData As New CAPICOM.EncryptedData
encryptedData.Algorithm.Name =
encryptedData.Algorithm.KeyLength =
encryptedData.SetSecret(DecryptKey, CAPICOM_SECRET_TYPE.CAPICOM_SECRET_PASSWORD)
encryptedData.Decrypt(EncryptMsg)
Return encryptedData.Content End Function 'Const CAPICOM_ENCRYPTION_ALGORITHM_RC2 = 0
'Const CAPICOM_ENCRYPTION_ALGORITHM_RC4 = 1
'Const CAPICOM_ENCRYPTION_ALGORITHM_DES = 2
'Const CAPICOM_ENCRYPTION_ALGORITHM_3DES = 3
'Const CAPICOM_ENCRYPTION_ALGORITHM_AES = 4 'Const CAPICOM_ENCRYPTION_KEY_LENGTH_MAXIMUM = 0
'Const CAPICOM_ENCRYPTION_KEY_LENGTH_40_BITS = 1
'Const CAPICOM_ENCRYPTION_KEY_LENGTH_56_BITS = 2
'Const CAPICOM_ENCRYPTION_KEY_LENGTH_128_BITS = 3
'Const CAPICOM_ENCRYPTION_KEY_LENGTH_192_BITS = 4
'Const CAPICOM_ENCRYPTION_KEY_LENGTH_256_BITS = 5
''' <summary>
''' 加密
''' </summary>
''' <param name="Content">明文</param>
''' <param name="DecryptKey">密匙</param>
''' <param name="Algorithm">加密類型:0:RSA RC2;1:RSA RC4;2:DES;3:3DES</param>
''' <param name="KeyLength">密匙長度:0:CAPICOM_KEY_LENGTH_MAXIMUM;1:CAPICOM_KEY_LENGTH_40_BITS(40-bit);2:56-bit;3:128-bit;5:256;</param>
''' <returns>密文</returns>
''' <remarks></remarks>
Function DoEncryptCommand(ByVal Content, ByVal DecryptKey, Optional ByVal Algorithm = , Optional ByVal KeyLength = )
'Dim EncryptedData
'' Create the EncryptedData object.
'EncryptedData = CreateObject("CAPICOM.EncryptedData")
'' Set algorithm, key size, and encryption password.
'EncryptedData.Algorithm.Name = Algorithm
'EncryptedData.Algorithm.KeyLength = KeyLength 'EncryptedData.SetSecret(DecryptKey)
'' Now encrypt it.
'EncryptedData.Content = Content
'DoEncryptCommand = EncryptedData.Encrypt
'' Free resources.
'EncryptedData = Nothing Dim encryptedData = New EncryptedDataClass()
encryptedData.Content = Content
encryptedData.Algorithm.Name =
encryptedData.Algorithm.KeyLength =
encryptedData.SetSecret(DecryptKey, CAPICOM_SECRET_TYPE.CAPICOM_SECRET_PASSWORD)
Return encryptedData.Encrypt(CAPICOM_ENCODING_TYPE.CAPICOM_ENCODE_BASE64) 'Dim functionReturnValue = ""
'Dim EncryptedData = New CAPICOM.EncryptedData()
'EncryptedData.Algorithm.Name = Algorithm
'EncryptedData.Algorithm.KeyLength = KeyLength
'EncryptedData.SetSecret(DecryptKey)
'EncryptedData.Content = Content
'functionReturnValue = EncryptedData.Encrypt()
'Return functionReturnValue End Function ' End DoEncryptCommand End Module
Microsoft Capicom 2.1 On 64bit OS的更多相关文章
- Can Live View boot up images acquired from 64bit OS evidence?
Some said Live View could only boot up images acquired from 32bit OS evidence. I have to say that it ...
- checking it the current os is a 32bit or 64bit version 检查操作系统是32位还是64位
) { Console.WriteLine("32bit os"); } ) { Console.WriteLine("64bit os"); }
- 操作系统Unix、Windows、Mac OS、Linux的故事
电脑,计算机已经成为我们生活中必不可少的一部分.无论是大型的超级计算机,还是手机般小巧的终端设备,都跑着一个操作系统.正是这些操作系统,让那些硬件和芯片得意组合起来,让那些软件得以运行,让我们的世界在 ...
- 用Windows PowerShell 控制管理 Microsoft Office 365
如果想要通过PowerShell控制管理Office365,首先要安装Microsoft Online Services Sign-In Assistant 7.0,链接如下 Microsoft On ...
- 检测到 LoaderLock:DLL"XXXX"正试图在OS加载程序锁内执行
解决方法: ctrl+D+E或alt+ctl+e或使用菜单调试——>异常——>异常窗口——>Managed Debugging Assistants——>去掉LoaderLoc ...
- OGG-00782 - OGG 11.2.1.0.2 FOR Windows x64 Microsoft SQL Server
OS ENV:主机名: WIN-NO42QRNPMFAOS 名称: Microsoft Windows Server 2008 R2 Datacenter OS ...
- win7 64bit+vs2010 操作注册表
注册表五个根键 HKEY_CLASSES_ROOT--管理文件系统 HKEY_LOCAL_MACHINE--管理当前系统硬件配置 HKEY_LOCAL_USER--管理系统当前用户配置 HKEY ...
- Unix、Windows、Mac OS、Linux系统故事
我们熟知的操作系统大概都是windows系列,近年来Apple的成功,让MacOS也逐渐走进普通用户.在服务器领域,恐怕Linux是无人不知无人不晓.他们都是操作系统,也在自己的领域里独领风骚.这都还 ...
- [转]操作系统Unix、Windows、Mac OS、Linux的故事
[写得很江湖气,可惜找不到原作者了] 文章转自:http://blog.csdn.net/wenmingchan/article/details/49925379 http://www.jb51.ne ...
随机推荐
- day27_反射
1.反射-概述(掌握) 反射就是在程序运行过程中,通过.class文件动态的获取类的信息(属性,构造,方法),并调用 注意:JAVA不是动态语言,因为动态语言强调在程序运行过程中不仅能获取并调用类里面 ...
- robotframework接口测试初探2
python这个requests模块常被用来测试接口.使用RequestLibrary库测试之前,先来看下这个模块是怎样使用的 最简单的调用是 r=requests.get("http:// ...
- Azure CDN Smart Routing 功能正式上线
经过Azure中国CDN产品团队的不懈努力,融合CDN服务的一个重要功能 Smart Routing目前已经正式上线.在接下来的一段时间该功能将逐步开放给所有客户.本文主要对Smart Routing ...
- 解决Cannot delete or update a parent row: a foreign key constraint fails (`current_source_products`.`product_storage`, CONSTRAINT `product_storage_ibfk_3` FOREIGN KEY (`InOperatorID`)
出现这个异常的原因是因为设置了外键,造成无法更新或删除数据. 1.通过设置FOREIGN_KEY_CHECKS变量来避免这种情况 删除前设置 SET FOREIGN_KEY_CHECKS=0; 删除完 ...
- Less函数说明
索引 escape(@string); // 通过 URL-encoding 编码字符串 e(@string); // 对字符串转义 %(@string, values...); // 格式化字符串 ...
- web安全之文件上传漏洞
成因: 当文件上传时,若服务端脚本语言未对上传的文件进行严格验证和过滤,若恶意用户上传恶意的 脚本文件时,就有可能控制整个网站甚至是服务器,这就是文件上传漏洞. 权限: 1. 后台权限:登陆了后台,可 ...
- JDBC修改表数据
修改数据时用到update语句,使用这个语句时也要有条件的,指定修改某一行的数据,没有条件判断,则修改全部. package qddx.JDBC; import java.sql.*; public ...
- 【学习笔记】oracle 比较运算符,逻辑运算符,特殊运算符,判断空值,大小写敏感
比较运算符:> 大于,< 小于 >= 大于等于,<= 小于等于 = 等于,!=,<>,^= 不等于 逻辑运算符运算的优先顺序:NOT > AND > O ...
- Nginx 配置 HTTP 强缓存
server { listen 80; server_name tirion.me www.tirion.me; # note that these lines are originally from ...
- LEETCODE —— Unique Binary Search Trees [动态规划]
Given n, how many structurally unique BST's (binary search trees) that store values 1...n? For examp ...