C++ handling very large integers

Tomek, it sounds like you aren’t linking to the BigInteger code correctly. I think you should resolve this problem rather than looking for a new library. I took a look at the source, and BigInteger::BigInteger(int) is most definitely defined. A brief glance indicates that the others are as well. The link errors you’re getting imply … Read more

Signing and verifying signatures with RSA C#

Your problem is at the beginning of the VerifyData method: public static bool VerifyData(string originalMessage, string signedMessage, RSAParameters publicKey) { bool success = false; using (var rsa = new RSACryptoServiceProvider()) { //Don’t do this, do the same as you did in SignData: //byte[] bytesToVerify = Convert.FromBase64String(originalMessage); var encoder = new UTF8Encoding(); byte[] bytesToVerify = encoder.GetBytes(originalMessage); … Read more

How to load the RSA public key from file in C#

You can create an RSACryptoServiceProvider from a PEM file using the following class (GetRSAProviderFromPemFile method). Warning: Don’t just copy code from StackOverflow without verification! Especially not crypto code! This code has bugs (see comments). You may want to write and run tests before using this in production (if you really have no better option). I … Read more

C# RSA encryption/decryption with transmission

well there are really enough examples for this, but anyway, here you go using System; using System.Security.Cryptography; namespace RsaCryptoExample { static class Program { static void Main() { //lets take a new CSP with a new 2048 bit rsa key pair var csp = new RSACryptoServiceProvider(2048); //how to get the private key var privKey = … Read more

Use OpenSSL RSA key with .Net

I am using openssl 0.9.6g and I have created public/private keypair using RSA_generate_key(). It gives me keys like: —–BEGIN RSA PUBLIC KEY—– … —–END RSA PUBLIC KEY—– I think what I am looking for is “how to convert rsa public key from pkcs#1 to x509 format. Yeah, .Net can consume some ASN.1/DER encoded keys, and … Read more