Gurux.DLMS.Secure.GXDLMSSecureClient.Decrypt C# (CSharp) Method

Decrypt() public static method

Decrypt data using Key Encrypting Key.
public static Decrypt ( byte kek, byte data ) : byte[]
kek byte Key Encrypting Key, also known as Master key.
data byte Data to decrypt.
return byte[]
        public static byte[] Decrypt(byte[] kek, byte[] data)
        {
            if (kek == null)
            {
                throw new ArgumentNullException("Key Encrypting Key");
            }
            if (kek.Length < 16)
            {
                throw new ArgumentOutOfRangeException("Key Encrypting Key");
            }
            if (kek.Length % 8 != 0)
            {
                throw new ArgumentException("Key Encrypting Key");
            }
            if (data == null)
            {
                throw new ArgumentNullException("data");
            }
            if (data.Length < 16)
            {
                throw new ArgumentOutOfRangeException("data");
            }
            if (data.Length % 8 != 0)
            {
                throw new ArgumentException("data");
            }
            GXDLMSChipperingStream gcm = new GXDLMSChipperingStream(false, kek);
            return gcm.DecryptAes(data);
        }
    }