C # OpenSSL RSA Private Key Encryption

I'm having problems using the .Net shell of the OpenSSL library to calculate the RSA secret key encryption for a set of bytes.

I am currently reading in a .pem file containing the private key that I want to use in a BIO object.

public byte[] ComputeRSAEncryption(byte[] dataBlock, BIO privateKey)
{
   RSA rsa = RSA.FromPrivateKey(privateKey);
   return rsa.PrivateEncryption(dataBlock, RSA.Padding.None);
}

I use an RSA key of 64 bytes and a data block size of 64 bytes. When the above method is called, I get an error:

Data is too large for the module.

However, if I use a 64-byte data block where all the bytes are set to 0x00, the method works without errors.

Is there something I am missing?

Thank.

+3
source share
1 answer

. -, , 0x00. , RSA- .

+4

All Articles