Esempio n. 1
0
        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();
                }
            }
        }
Esempio n. 2
0
        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();
                }
            }
        }
Esempio n. 3
0
        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();
                }
            }
        }