小编imo*_*t01的帖子

RSA加密/解密的结果带有3个问号

我正在使用RSA加密和解密1或2个单词的小型记事本文件。处理文件结果后,结果请求上有3个问号。

例如,如果我加密然后用单词“ Hello”解密记事本文件,则结果将是“ ??? Hello”。那三个问号来自哪里?

这是代码:

    public partial class Form1 : Form
{

    private RSAParameters publicKey;
    private RSAParameters privateKey;

    public string result;

    public Form1()
    {
        InitializeComponent();
        var rsa = new RSACryptoServiceProvider();
        this.publicKey = rsa.ExportParameters(false);
        this.privateKey = rsa.ExportParameters(true);
    }

    private void button1_Click(object sender, EventArgs e)
    {
        openFileDialog1.ShowDialog();
    }

    private void openFileDialog1_FileOk(object sender, CancelEventArgs e)
    {
        textBox1.Text = openFileDialog1.FileName;
    }

    private void button2_Click(object sender, EventArgs e)
    {
        FileStream fileStream = new FileStream(textBox1.Text, FileMode.Open);

        byte[] buffer = new byte[fileStream.Length];
        int len = (int)fileStream.Length; …
Run Code Online (Sandbox Code Playgroud)

c# cryptography rsa

1
推荐指数
1
解决办法
957
查看次数

标签 统计

c# ×1

cryptography ×1

rsa ×1