public DtlsClientSecurityContext(
            SecurityPackageType packageType,
            CertificateCredential clientCredential,
            string serverPrincipal,
            ClientSecurityContextAttribute contextAttributes,
            SecurityTargetDataRepresentation targetDataRep)
        {
            if (clientCredential == null)
            {
                clientCredential = new CertificateCredential(null);
            }
            this.packageType               = packageType;
            this.serverPrincipalName       = serverPrincipal;
            this.securityContextAttributes = contextAttributes;
            this.targetDataRepresentaion   = targetDataRep;

            SspiUtility.DtlsAcquireCredentialsHandle(
                packageType,
                clientCredential,
                serverPrincipal,
                NativeMethods.SECPKG_CRED_OUTBOUND,
                out this.credentialHandle);

            bStreamSizes     = false;
            hasMoreFragments = false;
        }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="clientCredential">Client account credential.</param>
 /// <param name="serverPrincipal">Server principal.</param>
 /// <param name="contextAttributes">Client security context attributes.</param>
 /// <param name="targetDataRep">The data representation, such as byte ordering, on the target.</param>
 public SspiClientSecurityConfig(
     AccountCredential clientCredential,
     string serverPrincipal,
     ClientSecurityContextAttribute contextAttributes,
     SecurityTargetDataRepresentation targetDataRep)
     : base(SecurityPackageType.Unknown)
 {
     this.clientCredential = clientCredential;
     this.serverPrincipal = serverPrincipal;
     this.securityAttributes = contextAttributes;
     this.targetDataRep = targetDataRep;
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="clientCredential">Client account credential.</param>
 /// <param name="serverPrincipal">Server principal.</param>
 /// <param name="contextAttributes">Client security context attributes.</param>
 /// <param name="targetDataRep">The data representation, such as byte ordering, on the target.</param>
 public SspiClientSecurityConfig(
     AccountCredential clientCredential,
     string serverPrincipal,
     ClientSecurityContextAttribute contextAttributes,
     SecurityTargetDataRepresentation targetDataRep)
     : base(SecurityPackageType.Unknown)
 {
     this.clientCredential   = clientCredential;
     this.serverPrincipal    = serverPrincipal;
     this.securityAttributes = contextAttributes;
     this.targetDataRep      = targetDataRep;
 }
Пример #4
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="packageType">Specifies the name of the security package with which these credentials will be used
 /// </param>
 /// <param name="serverCredential">The credential of server, if null, use default user account.</param>
 /// <param name="serverPrincipal">Server principal name</param>
 /// <param name="contextAttributes">Bit flags that specify the attributes required by the server to establish
 /// the context</param>
 /// <param name="targetDataRep">The data representation, such as byte ordering, on the target. This parameter
 /// can be either SECURITY_NATIVE_DREP or SECURITY_NETWORK_DREP.</param>
 public SspiServerSecurityContext(
     SecurityPackageType packageType,
     CertificateCredential serverCredential,
     string serverPrincipal,
     ServerSecurityContextAttribute contextAttributes,
     SecurityTargetDataRepresentation targetDataRep)
 {
     this.packageType               = packageType;
     this.serverPrincipalName       = serverPrincipal;
     this.securityContextAttributes = contextAttributes;
     this.targetDataRepresentaion   = targetDataRep;
     this.AcquireCredentialsHandle(serverCredential);
 }
        /// <summary>
        /// Constructor with client credential, principal of server, ContextAttributes and TargetDataRep.
        /// </summary>
        /// <param name="packageType">Specifies the name of the security package with which these credentials will be used
        /// </param>
        /// <param name="clientCredential">Client account credential, if null, use default user account</param>
        /// <param name="serverPrincipal">Server principal name</param>
        /// <param name="contextAttributes">Context attributes</param>
        /// <param name="targetDataRep">The data representation, such as byte ordering, on the target.
        /// This parameter can be either SECURITY_NATIVE_DREP or SECURITY_NETWORK_DREP.</param>
        public SspiClientSecurityContext(
            SecurityPackageType packageType,
            AccountCredential clientCredential,
            string serverPrincipal,
            ClientSecurityContextAttribute contextAttributes,
            SecurityTargetDataRepresentation targetDataRep)
        {
            this.packageType               = packageType;
            this.serverPrincipalName       = serverPrincipal;
            this.securityContextAttributes = contextAttributes;
            this.targetDataRepresentaion   = targetDataRep;

            this.AcquireCredentialsHandle(clientCredential);
        }
        public DtlsServerSecurityContext(
            SecurityPackageType packageType,
            CertificateCredential serverCredential,
            string serverPrincipal,
            ServerSecurityContextAttribute contextAttributes,
            SecurityTargetDataRepresentation targetDataRep)
        {
            this.packageType               = packageType;
            this.serverPrincipalName       = serverPrincipal;
            this.securityContextAttributes = contextAttributes;
            this.targetDataRepresentaion   = targetDataRep;

            this.Context = new Sspi.DtlsServerSecurityContext(packageType, serverCredential, serverPrincipal, contextAttributes, targetDataRep);
        }
        public DtlsClientSecurityContext(
            SecurityPackageType packageType,
            CertificateCredential clientCredential,
            string serverPrincipal,
            ClientSecurityContextAttribute contextAttributes,
            SecurityTargetDataRepresentation targetDataRep)
        {
            if (clientCredential == null)
            {
                clientCredential = new CertificateCredential(null);
            }
            this.packageType               = packageType;
            this.serverPrincipalName       = serverPrincipal;
            this.securityContextAttributes = contextAttributes;
            this.targetDataRepresentaion   = targetDataRep;

            this.Context = new Sspi.DtlsClientSecurityContext(packageType, clientCredential, serverPrincipal, contextAttributes, targetDataRep) as IDtlsClientSecurityContext;
        }
Пример #8
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="packageType">Specifies the name of the security package with which these credentials will be used
 /// </param>
 /// <param name="serverCredential">The credential of server, if null, use default user account.</param>
 /// <param name="serverPrincipal">Server principal name</param>
 /// <param name="contextAttributes">Bit flags that specify the attributes required by the server to establish
 /// the context</param>
 /// <param name="targetDataRep">The data representation, such as byte ordering, on the target. This parameter
 /// can be either SECURITY_NATIVE_DREP or SECURITY_NETWORK_DREP.</param>
 public SspiServerSecurityContext(
     SecurityPackageType packageType,
     AccountCredential serverCredential,
     string serverPrincipal,
     ServerSecurityContextAttribute contextAttributes,
     SecurityTargetDataRepresentation targetDataRep)
 {
     this.packageType               = packageType;
     this.serverPrincipalName       = serverPrincipal;
     this.securityContextAttributes = contextAttributes;
     this.targetDataRepresentaion   = targetDataRep;
     SspiUtility.AcquireCredentialsHandle(
         packageType,
         serverCredential,
         serverPrincipal,
         NativeMethods.SECPKG_CRED_INBOUND,
         out this.credentialHandle);
 }
        public DtlsServerSecurityContext(
            SecurityPackageType packageType,
            CertificateCredential serverCredential,
            string serverPrincipal,
            ServerSecurityContextAttribute contextAttributes,
            SecurityTargetDataRepresentation targetDataRep)
        {
            this.packageType = packageType;
            this.serverPrincipalName = serverPrincipal;
            this.securityContextAttributes = contextAttributes;
            this.targetDataRepresentaion = targetDataRep;
            SspiUtility.DtlsAcquireCredentialsHandle(
                packageType,
                serverCredential,
                serverPrincipal,
                NativeMethods.SECPKG_CRED_INBOUND,
                out this.credentialHandle);

            bStreamSizes = false;
            hasMoreFragments = false;
        }
        public SspiClientSecurityContext(
            SecurityPackageType packageType,
            AccountCredential clientCredential,
            string serverPrincipal,
            ClientSecurityContextAttribute contextAttributes,
            SecurityTargetDataRepresentation targetDataRep)
        {
            this.packageType = packageType;
            this.serverPrincipalName = serverPrincipal;
            this.securityContextAttributes = contextAttributes;
            this.targetDataRepresentaion = targetDataRep;

            SspiUtility.AcquireCredentialsHandle(
                packageType,
                clientCredential,
                serverPrincipal,
                NativeMethods.SECPKG_CRED_OUTBOUND,
                out this.credentialHandle);
        }