public void SetInitiatorSharedSecret(SecureString initiatorSharedSecret, Guid targetId) { this.InitializeComInterfaces(); if (this.serviceIscsi == null) { throw new NotSupportedException("iSCSI not supported in this version of the service."); } SecureStringAnsiHandle sharedSecret = new SecureStringAnsiHandle(initiatorSharedSecret); try { SharedSecret secret = new SharedSecret(sharedSecret); this.serviceIscsi.SetInitiatorSharedSecret(ref secret, targetId); } catch (COMException exception) { throw new VdsException("The call to IVdsServiceIscsi::SetInitiatorSharedSecret failed.", exception); } finally { if (sharedSecret != null) { sharedSecret.Dispose(); } } }
public void SetIpsecGroupPresharedKey(SecureString ipsecKey) { this.InitializeComInterfaces(); if (this.serviceIscsi == null) { throw new NotSupportedException("iSCSI not supported in this version of the service."); } SecureStringAnsiHandle handle = new SecureStringAnsiHandle(ipsecKey); try { IpsecKey key = new IpsecKey(handle); this.serviceIscsi.SetIpsecGroupPresharedKey(ref key); } catch (COMException exception) { throw new VdsException("The call the IVdsServiceIscsi::SetIpsecGroupPresharedKey failed.", exception); } finally { if (handle != null) { handle.Dispose(); } } }
public void SetIpsecSecurity(Guid targetPortalId, IpsecFlags securityFlags, SecureString ipsecKey) { if (ipsecKey == null) { throw new ArgumentNullException("ipsecKey", "ipsecKey cannot be set to null"); } this.InitializeComInterfaces(); SecureStringAnsiHandle handle = new SecureStringAnsiHandle(ipsecKey); try { IpsecKey key = new IpsecKey(handle); this.initiatorPortal.SetIpsecSecurity(targetPortalId, securityFlags, ref key); } catch (COMException exception) { throw new VdsException("The call to IVdsIscsiInitiatorPortal::SetIpsecSecurity failed.", exception); } finally { if (handle != null) { handle.Dispose(); } } }
public void SetAllIpsecSecurity(Guid targetPortalId, IpsecFlags securityFlags, SecureString ipsecKey) { this.InitializeComInterfaces(); if (this.serviceIscsi == null) { throw new NotSupportedException("iSCSI not supported in this version of the service."); } SecureStringAnsiHandle handle = new SecureStringAnsiHandle(ipsecKey); try { IpsecKey key = new IpsecKey(handle); this.serviceIscsi.SetAllIpsecSecurity(targetPortalId, securityFlags, ref key); } catch (COMException exception) { throw new VdsException("The call to IVdsServiceIscsi::SetAllIpsecSecurity failed.", exception); } finally { if (handle != null) { handle.Dispose(); } } }
public void SetIpsecGroupPresharedKey(SecureString ipsecKey) { if (ipsecKey == null) { throw new ArgumentNullException("ipsecKey", "ipsecKey cannot be null"); } this.InitializeComInterfaces(); SecureStringAnsiHandle handle = new SecureStringAnsiHandle(ipsecKey); try { IpsecKey key = new IpsecKey(handle); this.subSystemIscsi.SetIpsecGroupPresharedKey(ref key); } catch (COMException exception) { throw new VdsException("The call to SetIpsecGroupPresharedKey failed.", exception); } finally { if (handle != null) { handle.Dispose(); } } }
public void SetIpsecSecurityLocal(IpsecFlags securityFlags, SecureString ipsecKey) { if (ipsecKey == null) { throw new ArgumentNullException("ipsecKey", "ipsecKey cannot be set to null"); } this.InitializeComInterfaces(); if (this.portalLocal == null) { throw new NotSupportedException("The portal is not a local portal"); } SecureStringAnsiHandle handle = new SecureStringAnsiHandle(ipsecKey); try { IpsecKey key = new IpsecKey(handle); this.portalLocal.SetIpsecSecurityLocal(securityFlags, ref key); } catch (COMException exception) { throw new VdsException("The call to IVdsIscsiPortalLocal::SetIpsecSecurityLocal failed.", exception); } finally { if (handle != null) { handle.Dispose(); } } }
public void SetSharedSecret(SecureString targetSharedSecret, string initiatorName) { if (targetSharedSecret == null) { throw new ArgumentNullException("targetSharedSecret", "Cannot pass in null for shared secret"); } this.InitializeComInterfaces(); SecureStringAnsiHandle sharedSecret = new SecureStringAnsiHandle(targetSharedSecret); try { SharedSecret secret = new SharedSecret(sharedSecret); this.target.SetSharedSecret(ref secret, initiatorName); } catch (COMException exception) { throw new VdsException("The call to IVdsIscsiTarget::SetSharedSecret failed.", exception); } finally { if (sharedSecret != null) { sharedSecret.Dispose(); } } }
public IpsecKey(SecureStringAnsiHandle ipsecKey) { this.Key = ipsecKey; this.KeySize = (uint)ipsecKey.Length; }
public SharedSecret(SecureStringAnsiHandle sharedSecret) { this.Secret = sharedSecret; this.SecretSize = (uint)sharedSecret.Length; }