/// <summary> /// Encrypts the AS4 Message using the specified <paramref name="keyEncryptionConfig"/> /// and <paramref name="dataEncryptionConfig"/> /// </summary> /// <param name="keyEncryptionConfig"></param> /// <param name="dataEncryptionConfig"></param> public void Encrypt(KeyEncryptionConfiguration keyEncryptionConfig, DataEncryptionConfiguration dataEncryptionConfig) { if (keyEncryptionConfig == null) { throw new ArgumentNullException(nameof(keyEncryptionConfig)); } if (dataEncryptionConfig == null) { throw new ArgumentNullException(nameof(dataEncryptionConfig)); } var encryptor = EncryptionStrategyBuilder .Create(this, keyEncryptionConfig) .WithDataEncryptionConfiguration(dataEncryptionConfig) .Build(); SecurityHeader.Encrypt(encryptor); }