结合使用Bouncy Castle库和.NET Compact Framework [英] Use Bouncy Castle library with .NET Compact Framework
问题描述
我正在尝试在Windows Mobile 6.5上使用 Bouncy Castle v1.7 设备。
I’m trying to use Bouncy Castle v1.7 on a Windows Mobile 6.5 device.
我正在尝试执行以下代码:
I’m trying to execute the following code:
ISigner signer = SignerUtilities.GetSigner("SHA256withRSA");
使用Bouncy Castle二进制文件
Windows Mobile设备上,该代码导致引发以下异常:
Using the Bouncy Castle binaries
On the Windows Mobile device, the code results in the following exception being thrown:
程序集系统的版本,版本= 1.0.5000.0 ,Culture = neutral,PublicKeyToken = B77A5C561934E089不能通过此版本的Microsoft .NET Compact Framework加载。
"The version of the assembly System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=B77A5C561934E089 cannot be loaded by this version of the Microsoft .NET Compact Framework."
在经典台式机上应用程序(使用整个.NET框架),此代码运行就没有问题。
On a classic desktop application (using the whole .NET framework), this code runs without problem.
因此,我想Bouncy Castle和Compact Framework之间不兼容。
但是 Bouncy Castle C#索引页表示 现在正在构建源在.NET Compact Framework 1.0上(版本1.2)
So I’m guessing there is an incompatibility between Bouncy Castle and the Compact Framework. However the Bouncy Castle C# index page says "Source now builds on .NET Compact Framework 1.0" for version 1.2
我还尝试从其源代码中编译Bouncy Castle。
我已经使用Visual Studio 2008对其进行了编译(必须转换项目并删除链接到所引用的IDEA加密算法的类。但缺少),并带有以下编译符号: NET_1_1; NETCF_2_0
I've also tried to compile Bouncy Castle from its source-code.
I've compile it using Visual Studio 2008 (had to convert the project and remove classes linked to the IDEA encryption algorithm that were referenced but missing) with the following compilation symbols: NET_1_1;NETCF_2_0
当我引用编译产生的DLL并运行上述代码时(在设备上),出现以下异常:
When I reference the DLL resulting from the compilation and run the code mentioned above (on a Device) I get the following exception:
未找到方法:GetSigner Org.BouncyCastle.Security.SignerUtilities。
"Method not found: GetSigner Org.BouncyCastle.Security.SignerUtilities."
这似乎很奇怪,因为我在编码时在Visual Studio中获得了IntelliSense。
This seems really strange since I get IntelliSense in Visual Studio while coding.
可以某人e告诉我如何在Compact Framework 3.5上运行Bouncy Castle?
Can someone tell me how to get Bouncy Castle running on Compact Framework 3.5 ?
非常感谢,
Christophe
Thanks a lot,
Christophe
推荐答案
我创建了所需的文件,并将SLN / CSPROJ文件放到我的博客上。我创建了一个非常简单的测试应用程序,该应用程序成功创建了ISigner实现实例。这是我的消费者代码:
I created the required files and put the SLN/CSPROJ files up on my blog. I created a very simple test app that successfully created an ISigner implementation instance. This was my consumer code:
class Program
{
static void Main(string[] args)
{
ISigner signer = SignerUtilities.GetSigner("SHA256withRSA");
}
}
这篇关于结合使用Bouncy Castle库和.NET Compact Framework的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!