Skip to content

Commit 7c14c33

Browse files
committed
GCM match check for ipsec policy
1 parent 99e1b18 commit 7c14c33

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/ResourceManager/Network/Commands.Network/VirtualNetworkGatewayConnection/NewAzureRmIpsecPolicyCommand.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
// ----------------------------------------------------------------------------------
1414

1515
using Microsoft.Azure.Commands.Network.Models;
16+
using System;
1617
using System.Management.Automation;
1718
using MNM = Microsoft.Azure.Management.Network.Models;
1819

@@ -129,6 +130,12 @@ public override void Execute()
129130
ipsecPolicy.SALifeTimeSeconds = (!this.MyInvocation.BoundParameters.ContainsKey("SALifeTimeSeconds")) ? 27000 : this.SALifeTimeSeconds;
130131
ipsecPolicy.SADataSizeKilobytes = (!this.MyInvocation.BoundParameters.ContainsKey("SADataSizeKilobytes")) ? 102400000 : this.SADataSizeKilobytes;
131132

133+
// GCM matching check
134+
if ((this.IpsecEncryption.Contains("GCM") || this.IpsecIntegrity.Contains("GCM")) && this.IpsecEncryption != this.IpsecIntegrity)
135+
{
136+
throw new ArgumentException("IpsecEncryption and IpsecIntegrity must use matching GCM algorithms");
137+
}
138+
132139
ipsecPolicy.IpsecEncryption = this.IpsecEncryption;
133140
ipsecPolicy.IpsecIntegrity = this.IpsecIntegrity;
134141
ipsecPolicy.IkeEncryption = this.IkeEncryption;

0 commit comments

Comments
 (0)