Skip to content

Commit 40a6423

Browse files
committed
Fix Set-ASSVD to send CIK along with the SEK
1 parent 37ec0eb commit 40a6423

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src/ServiceManagement/StorSimple/Commands.StorSimple/Cmdlets/DeviceDetails/SetAzureStorSimpleVirtualDevice.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,11 @@ public override void ExecuteCmdlet()
7676
// Get the current device details. ( If we found id from the name, this call is bound to succeed)
7777
var deviceDetails = StorSimpleClient.GetDeviceDetails(deviceId);
7878

79+
// The cik also needs to be sent to the service.
80+
string cik = EncryptionCmdLetHelper.RetrieveCIK(this, StorSimpleContext.ResourceId);
81+
7982
// Update device details.
80-
StorSimpleClient.UpdateVirtualDeviceDetails(deviceDetails, NewName, TimeZone, SecretKey);
83+
StorSimpleClient.UpdateVirtualDeviceDetails(deviceDetails, NewName, TimeZone, SecretKey, cik);
8184

8285
// Make request with updated data
8386
WriteVerbose(string.Format(Resources.BeginningDeviceConfiguration, deviceDetails.DeviceProperties.FriendlyName));

src/ServiceManagement/StorSimple/Commands.StorSimple/ServiceClients/StorSimpleDevicesClient.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
using Microsoft.WindowsAzure.Commands.StorSimple.Cmdlets.Library;
2121
using System.Net;
2222
using System.Net.Sockets;
23+
using Microsoft.WindowsAzure.Commands.StorSimple.Encryption;
2324

2425
namespace Microsoft.WindowsAzure.Commands.StorSimple
2526
{
@@ -201,7 +202,7 @@ private void UpdateDeviceDetailsObject(DeviceDetails deviceDetails, string newNa
201202
deviceDetails.WebProxy = null;
202203
}
203204

204-
public void UpdateVirtualDeviceDetails(DeviceDetails details, string newName, TimeZoneInfo timeZone, string sek)
205+
public void UpdateVirtualDeviceDetails(DeviceDetails details, string newName, TimeZoneInfo timeZone, string sek, string cik)
205206
{
206207
if (newName != null)
207208
{
@@ -216,6 +217,13 @@ public void UpdateVirtualDeviceDetails(DeviceDetails details, string newName, Ti
216217

217218
details.VirtualApplianceProperties.EncodedServiceEncryptionKey = encryptedSecretKey;
218219

220+
// Also set the CIK before making the request - service needs it.
221+
var encryptedCik = this.EncryptWithDevicePublicKey(details.DeviceProperties.DeviceId, cik);
222+
223+
details.VirtualApplianceProperties.EncodedChannelIntegrityKey = encryptedCik;
224+
225+
details.VirtualApplianceProperties.IsServiceEncryptionKeySet = true;
226+
219227
// mark everything that we dont intend to modify as null - indicating
220228
// to the service that there has been no change
221229
details.AlertNotification = null;

0 commit comments

Comments
 (0)