3

In Java, one can register a security provider like BouncyCastle statically by editing the security policy files for the JRE or JDK or dynamically by adding the provider programmatically.

When the java security provider like BouncyCastle is converted to a C# callable dll using IKVM one can continue to use BouncyCastle through the dll by adding a reference to IKVM.OpenJDK.Core and IKVM.OpenJDK.Security and then make use of the following C# code.

java.security.Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());

I understand that the source code for BouncyCastle is already available in the flavor of C#. However, what I need is to convert my own crypto library written in Java to be usable in C# and as such I need to make use of IKVM to achieve this. I can already do this using by converting my crypto library from jar to dll and using the dynamic approach as described above.

Just wondering whether it is possible to register the provider statically using IKVM like in Java. Any ideas?

Lopper
  • 3,499
  • 7
  • 38
  • 57

1 Answers1

0

Had the same problem and could not find a way to do this statically. Ended up recompiling the whole IKVM project to make BouncyCastle provider work. -Download the source project of IKVM (https://sourceforge.net/projects/ikvm/files/ikvm/7.2.4630.5/ikvmsrc-7.2.4630.5.zip/download ) -Inside the project there's a HOWTO file with instructions to compile. The first step says "This IKVM.NET source bundle requires OpenJDK 7u6 b24 sources (and build artifacts).", So you can manually edit the "lib/security/java.security"in that OpenJDK and add the security.provider.XX=org.bouncycastle.jce.provider.BouncyCastleProvider, and then follow the rest of steps to recompile the project.