示例#1
0
 public void ExportPrivateKey(string filename)
 {
     if (Rsa.PublicOnly)
     {
         throw new Exception("no private key!");
     }
     AesFileEncryptionPrivider.WriteFile(PrivateKey, filename);
 }
示例#2
0
 public KeyContainer(string filepath)
 {
     PrivateKey = AesFileEncryptionPrivider.ReadFile(filepath);
     Rsa        = new RSACryptoServiceProvider();
     Rsa.ImportCspBlob(PrivateKey);
     PrivateKey = Rsa.ExportCspBlob(true);
     PublicKey  = Rsa.ExportCspBlob(false);
     PublicKeyS = Convert.ToBase64String(PublicKey);
 }