Bouncy Castle C # Library - Encryption from Java to C # with PKCS8 and RSA

I need to convert a small piece of code about encryption from Java to C #. I found the Bouncy Castle C # library ( https://www.nuget.org/packages/BouncyCastle/ ) but I didn't find an equivalent C # code for:

java.security.PrivateKey privatekey = KeyFactory.getInstance("RSA").generatePrivate(new    
PKCS8EncodedKeySpec(PRIVATE_RSA_KEY));//PRIVATE_RSA_KEY is a byte array
cipher = Cipher.getInstance("RSA/None/PKCS1Padding");
cipher.init(2, privatekey);
(...)
cipher.doFinal(examPrivateKey, k, l); //k and l are integers

      

Can anyone help me?

+3


source to share





All Articles