开发者

Use Bouncy Castle library with .NET Compact Framework

开发者 https://www.devze.com 2023-03-23 18:48 出处:网络
I’m trying to use Bouncy Castle v1.7 on a Windows Mobile 6.5 device. I’m trying to execute the following code:

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");

Using the Bouncy Castle binaries

On the Windows Mobile device, the code results in the following exception being thrown:

"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."

On a classic desktop application (using the whole .NET framework), this code runs without problem.

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

Compiling Bouncy Castle from source-code

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

When I reference the DLL resulting from the 开发者_开发问答compilation and run the code mentioned above (on a Device) I get the following exception:

"Method not found: GetSigner Org.BouncyCastle.Security.SignerUtilities."

This seems really strange since I get IntelliSense in Visual Studio while coding.

Can someone tell me how to get Bouncy Castle running on Compact Framework 3.5 ?

Thanks a lot,

Christophe


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"); 
    }
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号