/// <summary> /// Encrypt data using Key Encrypting Key. /// </summary> /// <param name="kek">Key Encrypting Key, also known as Master key.</param> /// <param name="data">Data to encrypt.</param> /// <returns>Encrypt data.</returns> public static byte[] Encrypt(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"); } GXDLMSChipperingStream gcm = new GXDLMSChipperingStream(true, kek); return(gcm.EncryptAes(data)); }
/// <summary> /// Encrypt data using Key Encrypting Key. /// </summary> /// <param name="kek">Key Encrypting Key, also known as Master key.</param> /// <param name="data">Data to encrypt.</param> /// <returns>Encrypt data.</returns> public static byte[] Encrypt(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"); } GXDLMSChipperingStream gcm = new GXDLMSChipperingStream(true, kek); return gcm.EncryptAes(data); }