I'm having some issues using the .Net wrapper of the OpenSSL libraray for computing the RSA Private Key Encryption of a set of bytes.
Currently I read in a .pem file containing the private key I want to use into a BIO object.
public byte[] ComputeRSAEncryption(byte[] dataBlock, BIO privateKey)
{
RSA rsa = RSA.FromPrivateKey(privateKey);
return rsa.PrivateEncryption(dataBlock, RSA.Padding.None);
}
I'm using an RSA key of size 64 bytes and a datablock size of 64 bytes. When the above method is called I get the error:
Data too large for modulus
However if I use a datablock of size 64 bytes where all bytes are set to 0x00 the method works without error.
Is there something I'm missing?
Thanks.