Ejemplo n.º 1
0
        public DecryptionBuffer(string password, string salt, SymmetricCryptoAlgorithm cryptoAlgorithm = SymmetricCryptoAlgorithm.AES_256_CBC, PaddingMode paddingMode = PaddingMode.PKCS7)
        {
            byte[]             saltValueBytes = CryptoCommon.GetBytes(salt);
            Rfc2898DeriveBytes key            = new Rfc2898DeriveBytes(password, saltValueBytes, 7);

            Initialize(key, cryptoAlgorithm, paddingMode);
        }
Ejemplo n.º 2
0
 public static string EncryptBase64String(string password, AutoSaltSizes saltSize, string strData, SymmetricCryptoAlgorithm algorithm = SymmetricCryptoAlgorithm.AES_256_CBC)
 {
     byte[] data          = CryptoCommon.GetBytes(strData);
     byte[] encryptedData = EncryptData(password, saltSize, data, algorithm);
     return(Convert.ToBase64String(encryptedData));
 }
Ejemplo n.º 3
0
 public static string DecryptString(string password, string salt, string strData, SymmetricCryptoAlgorithm algorithm = SymmetricCryptoAlgorithm.AES_256_CBC)
 {
     byte[] data          = CryptoCommon.GetBytes(strData);
     byte[] encryptedData = DecryptData(password, salt, data, algorithm);
     return(CryptoCommon.GetString(encryptedData));
 }