无法解密 RSA 加密密钥

本文关键字:加密 密钥 RSA 解密 | 更新日期: 2023-09-27 18:32:26

长话短说,我正在使用DES,并且正在使用RSA加密密码以进行密钥交换,密码不超过16个字符问题是当我加密密钥时,加密的大小太大而无法解密这是我的 RSA 加密和解密代码:

加密:--我一直在尝试将本地pwd作为"asd"

    byte[] plaintext = utf8.GetBytes(localpwd);
    byte[] ciphertext = rsaservice.Encrypt(plaintext, false);
    string cipherresult = Convert.ToBase64String(ciphertext);

然后我在文本框上打印加密密钥并尝试解密

    byte[] ciphertext = utf8.GetBytes(filetest.Text);
    byte[] plain = rsaservice.Decrypt(ciphertext, true);
    string plaintext = utf8.GetString(plain);

我得到"要解密的数据超过了这个 256 字节模数的最大值"。我尝试增加密钥大小以便能够加密和解密更大的密钥大小,但增加密钥只会增加加密数据的大小,从而导致相同的错误请帮忙!!

无法解密 RSA 加密密钥

//byte[] ciphertext = utf8.GetBytes(filetest.Text);
  byte[] ciphertext = Convert.FromBase64String(filetest.Text);