private void button3_Click(object sender, EventArgs e) { byte[] priKey = PKCS8.PrivateKeyInfo.Encode(CertificateLoader.ConvertPrivateKeyToRSA(certificate.PrivateKeyInfo.PrivateKey)); if (File.Exists(textBox2.Text)) { MessageBox.Show("파일이 이미 존재함", "오류", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } using (FileStream fs = new FileStream(textBox2.Text, FileMode.Create, FileAccess.Write)) { fs.Write(priKey, 0, priKey.Length); fs.Flush(); } MessageBox.Show("내보냈습니다.", "결과", MessageBoxButtons.OK, MessageBoxIcon.Information); }