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; }
public byte[] decrypt(byte[] encrypted) { byte[] decrypted; decrypted = CryptographyModule.Decrypt(PrivateKeyFile, encrypted); return decrypted; }