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 ...
随机推荐
- oracle远程连接配置
今日需要对站内所有的空间数据做入库处理,所以在服务器上安装了oracle,在本地需要对其进行连接,在网上查阅了相关资料,整理如下: 远程服务端配置:1. 数据库配置 因为要为外界客户端提供数据服 ...
- 搞懂 SynchronizationContext
SynchronizationContext -MSDN 很让人失望 我不知道为什么,目前在.Net下关于这个类只有很少的资料.MSDN文档也只有很少的关于如何使用SynchronizationCon ...
- Something about Wake-sleep
DBN可以看做是n个RBM串联组成,是一个多层神经网络. 多层的好处是可以用较少的参数表示复杂的函数. 而一些传统的training算法如BP算法,处理多层网络时,效果就不是很理想.
- 全新的跨平台app软件开发工具——Lae软件开发平台
Lae是一款运行于windows的界面开发工具,具有所见即所得.开发跨平台.UI布局自由.机制简单.维护容易等诸多优点,可以开发同时运行在windows.Linux.MacOX.iOS.Android ...
- ios系统(苹果手机)按钮显示为圆角和渐变的问题
按钮在安卓手机上显示正常,但在苹果手机上会显示如下: 解决办法:给该按钮的样式加上:-webkit-appearance:none;这样按钮就会显示正常
- study java language
2016.11.30 1).About the Java Technology 2).The Java Language Environment: Contents
- ipython安装
sudo pip install jupyter 然后用jupyter notebook来运行
- java.nio.ByteBuffer中flip,rewind,clear方法的区别
对缓冲区的读写操作首先要知道缓冲区的下限.上限和当前位置.下面这些变量的值对Buffer类中的某些操作有着至关重要的作用: limit:所有对Buffer读写操作都会以limit变量的值作为上限. p ...
- 防止sql注入
sqlmap 较专业的sql注入工具YII2 activeform 注意传过来的modle的rules规则 <?php$form=\yii\widgets\ActiveForm::begi ...
- Android之ScrollView嵌套ListView和GridView冲突
由于ListView,GridView本身都继承于ScrollView,一旦在ScrollView中嵌套ScrollView, 在ScrollView中嵌套使用ListView或者GridView,L ...