Exemple #1
0
        private void UpdateDefaultSettings()
        {
            EncryptionType[] encryptionTypes = new EncryptionType[]
            {
                EncryptionType.AES256_CTS_HMAC_SHA1_96,
                EncryptionType.AES128_CTS_HMAC_SHA1_96,
                EncryptionType.RC4_HMAC,
                EncryptionType.RC4_HMAC_EXP,
                EncryptionType.UnusedValue_135,
                EncryptionType.DES_CBC_MD5,
            };

            KerbInt32[] etypes = new KerbInt32[encryptionTypes.Length];
            for (int i = 0; i < encryptionTypes.Length; i++)
            {
                etypes[i] = new KerbInt32((int)encryptionTypes[i]);
            }
            Asn1SequenceOf <KerbInt32> etype = new Asn1SequenceOf <KerbInt32>(etypes);

            Context.SupportedEType = etype;

            this.Context.Pvno = KerberosConstValue.KERBEROSV5;

            contextSizes = new SecurityPackageContextSizes();
            contextSizes.MaxTokenSize        = KerberosConstValue.MAX_TOKEN_SIZE;
            contextSizes.MaxSignatureSize    = KerberosConstValue.MAX_SIGNATURE_SIZE;
            contextSizes.BlockSize           = KerberosConstValue.BLOCK_SIZE;
            contextSizes.SecurityTrailerSize = KerberosConstValue.SECURITY_TRAILER_SIZE;
        }
Exemple #2
0
 private void InitContextSize()
 {
     contextSizes = new SecurityPackageContextSizes();
     contextSizes.MaxTokenSize        = ConstValue.MAX_TOKEN_SIZE;
     contextSizes.MaxSignatureSize    = ConstValue.MAX_SIGNATURE_SIZE;
     contextSizes.BlockSize           = ConstValue.BLOCK_SIZE;
     contextSizes.SecurityTrailerSize = ConstValue.SECURITY_TRAILER_SIZE;
 }
Exemple #3
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="ticketEncryptKey">Encrypt key of the service principle. This parameter cannot be null.</param>
        /// <exception cref="System.ArgumentNullException">Thrown when the input parameter is null.</exception>
        public KerberosServerSecurityContext(EncryptionKey ticketEncryptKey)
        {
            if (ticketEncryptKey == null)
            {
                throw new ArgumentNullException("ticketEncryptKey");
            }

            server                           = new KileServer("");
            server.context                   = new KileServerContext();
            this.ticketEncryptKey            = ticketEncryptKey;
            isInitialToken                   = true;
            contextSizes                     = new SecurityPackageContextSizes();
            contextSizes.MaxTokenSize        = ConstValue.MAX_TOKEN_SIZE;
            contextSizes.MaxSignatureSize    = ConstValue.MAX_SIGNATURE_SIZE;
            contextSizes.BlockSize           = ConstValue.BLOCK_SIZE;
            contextSizes.SecurityTrailerSize = ConstValue.SECURITY_TRAILER_SIZE;
        }
        public KerberosClientSecurityContext(AccountCredential clientCredential,
                                             string logonName,
                                             string serviceName,
                                             IPAddress kdcIpAddress,
                                             ClientSecurityContextAttribute contextAttributes,
                                             KileConnectionType transportType)
        {
            if (clientCredential.DomainName == null)
            {
                throw new ArgumentNullException(nameof(clientCredential.DomainName));
            }
            if (clientCredential.AccountName == null)
            {
                throw new ArgumentNullException(nameof(clientCredential.AccountName));
            }
            if (clientCredential.Password == null)
            {
                throw new ArgumentNullException(nameof(clientCredential.Password));
            }
            if (kdcIpAddress == null)
            {
                throw new ArgumentNullException(nameof(kdcIpAddress));
            }
            if (logonName == null)
            {
                throw new ArgumentNullException(nameof(logonName));
            }
            if (serviceName == null)
            {
                throw new ArgumentNullException(nameof(serviceName));
            }

            client = new KileClient(clientCredential.DomainName, clientCredential.AccountName, clientCredential.Password,
                                    KileAccountType.User);
            service          = serviceName;
            domain           = clientCredential.DomainName;
            userLogonName    = logonName;
            contextAttribute = contextAttributes;
            client.Connect(kdcIpAddress.ToString(), ConstValue.KDC_PORT, transportType);
            contextSizes = new SecurityPackageContextSizes();
            contextSizes.MaxTokenSize        = ConstValue.MAX_TOKEN_SIZE;
            contextSizes.MaxSignatureSize    = ConstValue.MAX_SIGNATURE_SIZE;
            contextSizes.BlockSize           = ConstValue.BLOCK_SIZE;
            contextSizes.SecurityTrailerSize = ConstValue.SECURITY_TRAILER_SIZE;
        }