IronPigeon.CryptoProviderExtensions.Encrypt C# (CSharp) Метод

Encrypt() публичный статический Метод

Symmetrically encrypts the specified buffer using a randomly generated key.
public static Encrypt ( this cryptoProvider, byte data, SymmetricEncryptionVariables encryptionVariables = null ) : SymmetricEncryptionResult
cryptoProvider this The crypto provider.
data byte The data to encrypt.
encryptionVariables SymmetricEncryptionVariables Optional encryption variables to use; or null to use randomly generated ones.
Результат SymmetricEncryptionResult
        public static SymmetricEncryptionResult Encrypt(this CryptoSettings cryptoProvider, byte[] data, SymmetricEncryptionVariables encryptionVariables = null)
        {
            Requires.NotNull(data, "data");

            encryptionVariables = ThisOrNewEncryptionVariables(cryptoProvider, encryptionVariables);
            var symmetricKey = CryptoSettings.SymmetricAlgorithm.CreateSymmetricKey(encryptionVariables.Key);
            var cipherTextBuffer = WinRTCrypto.CryptographicEngine.Encrypt(symmetricKey, data, encryptionVariables.IV);
            return new SymmetricEncryptionResult(encryptionVariables, cipherTextBuffer);
        }