Пример #1
0
 public byte[] encrypt(string dataEncrypt)
 {
     byte[] encrypted;
     if (File.Exists(PublicKeyFile))
     {
         encrypted = CryptographyModule.Encrypt(PublicKeyFile, Encoding.UTF8.GetBytes(dataEncrypt));
     }
     else
     {
         CryptographyModule.generateKeys(PublicKeyFile, PrivateKeyFile);
         encrypted = CryptographyModule.Encrypt(PublicKeyFile, Encoding.UTF8.GetBytes(dataEncrypt));
     }
     return encrypted;
 }
Пример #2
0
 public byte[] decrypt(byte[] encrypted)
 {
     byte[] decrypted;
     decrypted = CryptographyModule.Decrypt(PrivateKeyFile, encrypted);
     return decrypted;
 }