Example #1
0
 public void ExportPrivateKey(string filename)
 {
     if (Rsa.PublicOnly)
     {
         throw new Exception("no private key!");
     }
     AesFileEncryptionPrivider.WriteFile(PrivateKey, filename);
 }
Example #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);
 }