当前位置: 首页>>代码示例>>C#>>正文


C# Asn1SequenceOf类代码示例

本文整理汇总了C#中Asn1SequenceOf的典型用法代码示例。如果您正苦于以下问题:C# Asn1SequenceOf类的具体用法?C# Asn1SequenceOf怎么用?C# Asn1SequenceOf使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Asn1SequenceOf类属于命名空间,在下文中一共展示了Asn1SequenceOf类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: KerberosFunctionalClient

        /// <summary>
        /// Construct a Kerberos test client
        /// </summary>
        /// <param name="domain">The realm part of the client's principal identifier.
        /// This argument cannot be null.</param>
        /// <param name="cName">The account to logon the remote machine. Either user account or computer account
        /// This argument cannot be null.</param>
        /// <param name="password">The password of the user. This argument cannot be null.</param>
        /// <param name="accountType">The type of the logon account. User or Computer</param>
        public KerberosFunctionalClient(string domain, string cName, string password, KerberosAccountType accountType, string kdcAddress, int kdcPort, TransportType transportType, KerberosConstValue.OidPkt oidPkt, ITestSite baseTestSite,string salt = null)
            : base(domain, cName, password, accountType, kdcAddress, kdcPort, transportType, oidPkt, salt)
        {
            testSite = baseTestSite;
            if (accountType == KerberosAccountType.Device)
            {
                testSite.Log.Add(LogEntryKind.Debug, "Construct Kerberos client using computer account: {0}@{1}.",
                                    cName, domain);
            }
            else
            {
                testSite.Log.Add(LogEntryKind.Debug, "Construct Kerberos client using user account: {0}@{1}.",
                                    cName, domain);
            }
            EncryptionType[] encryptionTypes = new EncryptionType[]
            {
                EncryptionType.AES256_CTS_HMAC_SHA1_96,
                EncryptionType.AES128_CTS_HMAC_SHA1_96,
                EncryptionType.RC4_HMAC,
                EncryptionType.RC4_HMAC_EXP,
                EncryptionType.DES_CBC_CRC,
                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;

            Context.Pvno = KerberosConstValue.KERBEROSV5;
        }
开发者ID:gitter-badger,项目名称:WindowsProtocolTestSuites,代码行数:44,代码来源:KerberosFunctionalClient.cs

示例2: ModifyRequest

 public ModifyRequest(
     LDAPDN object1,
     Asn1SequenceOf<ModifyRequest_modification_element> modification)
 {
     this.object1 = object1;
     this.modification = modification;
 }
开发者ID:yazeng,项目名称:WindowsProtocolTestSuites,代码行数:7,代码来源:ModifyRequest.cs

示例3: EncASRepPart

 public EncASRepPart(
     EncryptionKey param0,
     LastReq param1,
     KerbUInt32 param2,
     KerberosTime param3,
     TicketFlags param4,
     KerberosTime param5,
     KerberosTime param6,
     KerberosTime param7,
     KerberosTime param8,
     Realm param9,
     PrincipalName param10,
     HostAddresses param11,
     Asn1SequenceOf<PA_DATA> param12)
 {
     this.key = param0;
     this.last_req = param1;
     this.nonce = param2;
     this.key_expiration = param3;
     this.flags = param4;
     this.authtime = param5;
     this.starttime = param6;
     this.endtime = param7;
     this.renew_till = param8;
     this.srealm = param9;
     this.sname = param10;
     this.caddr = param11;
     this.pa_datas = param12;
 }
开发者ID:gitter-badger,项目名称:WindowsProtocolTestSuites,代码行数:29,代码来源:EncASRepPart.cs

示例4: CreateAddRequest

        /// <summary>
        /// Creates an AddRequest packet.
        /// </summary>
        /// <param name="context">The user context which contains message ID.</param>
        /// <param name="objectDn">The DN of the object to be added.</param>
        /// <param name="attributes">Attributes to be set.</param>
        /// <returns>The packet that contains the request.</returns>
        internal override AdtsAddRequestPacket CreateAddRequest(
            AdtsLdapContext context,
            string objectDn,
            params KeyValuePair<string, string[]>[] attributes)
        {
            int length = (attributes != null) ? attributes.Length : 0;

            AddRequest_attrs_element[] addrequestAttrsArray = new AddRequest_attrs_element[length];
            for (int i = 0; i < length; i++)
            {
                addrequestAttrsArray[i] = new AddRequest_attrs_element(
                    new AttributeType(attributes[i].Key),
                    CreateAttributeValueSet(attributes[i].Value));
            }
            Asn1SequenceOf<AddRequest_attrs_element> attributeList = new Asn1SequenceOf<AddRequest_attrs_element>(addrequestAttrsArray);

            AddRequest addRequest = new AddRequest(
                new LDAPDN(objectDn ?? string.Empty),
                attributeList);

            LDAPMessage_protocolOp operation = new LDAPMessage_protocolOp();
            operation.SetData(LDAPMessage_protocolOp.addRequest, addRequest);

            LDAPMessage message = new LDAPMessage(new MessageID(context.MessageId), operation);

            AdtsAddRequestPacket packet = new AdtsAddRequestPacket();
            packet.ldapMessagev2 = message;
            packet.messageId = context.MessageId;

            return packet;
        }
开发者ID:yazeng,项目名称:WindowsProtocolTestSuites,代码行数:38,代码来源:AdtsLdapV2Encoder.cs

示例5: SearchResponse_entry

 public SearchResponse_entry(
     LDAPDN objectName,
     Asn1SequenceOf<SearchResponse_entry_attributes_element> attributes)
 {
     this.objectName = objectName;
     this.attributes = attributes;
 }
开发者ID:yazeng,项目名称:WindowsProtocolTestSuites,代码行数:7,代码来源:SearchResponse_entry.cs

示例6: SubstringFilter

 public SubstringFilter(
     AttributeType type,
     Asn1SequenceOf<SubstringFilter_substrings_element> substrings)
 {
     this.type = type;
     this.substrings = substrings;
 }
开发者ID:yazeng,项目名称:WindowsProtocolTestSuites,代码行数:7,代码来源:SubstringFilter.cs

示例7: PrincipalName

 public PrincipalName(
     KerbInt32 param0,
     Asn1SequenceOf<KerberosString> param1)
 {
     this.name_type = param0;
     this.name_string = param1;
 }
开发者ID:gitter-badger,项目名称:WindowsProtocolTestSuites,代码行数:7,代码来源:PrincipalName.cs

示例8: KDC_REQ_BODY

 public KDC_REQ_BODY(
     KDCOptions param0,
     PrincipalName param1,
     Realm param2,
     PrincipalName param3,
     KerberosTime param4,
     KerberosTime param5,
     KerberosTime param6,
     KerbUInt32 param7,
     Asn1SequenceOf<KerbInt32> param8,
     HostAddresses param9,
     EncryptedData param10,
     Asn1SequenceOf<Ticket> param11)
 {
     this.kdc_options = param0;
     this.cname = param1;
     this.realm = param2;
     this.sname = param3;
     this.from = param4;
     this.till = param5;
     this.rtime = param6;
     this.nonce = param7;
     this.etype = param8;
     this.addresses = param9;
     this.enc_authorization_data = param10;
     this.additional_tickets = param11;
 }
开发者ID:gitter-badger,项目名称:WindowsProtocolTestSuites,代码行数:27,代码来源:KDC_REQ_BODY.cs

示例9: AddRequest

 public AddRequest(
     LDAPDN entry,
     Asn1SequenceOf<AddRequest_attrs_element> attrs)
 {
     this.entry = entry;
     this.attrs = attrs;
 }
开发者ID:yazeng,项目名称:WindowsProtocolTestSuites,代码行数:7,代码来源:AddRequest.cs

示例10: KrbFastReq

 public KrbFastReq(
     FastOptions param0,
     Asn1SequenceOf<PA_DATA> param1,
     KDC_REQ_BODY param2)
 {
     this.fast_options = param0;
     this.padata = param1;
     this.req_body = param2;
 }
开发者ID:gitter-badger,项目名称:WindowsProtocolTestSuites,代码行数:9,代码来源:KrbFastReq.cs

示例11: GetADUserClaims_SingleRealm

        public CLAIMS_SET? GetADUserClaims_SingleRealm(string realm, string user, string userPwd, string server, string servicePwd, string serviceSpn)
        {
            base.Logging();

            client = new KerberosTestClient(this.testConfig.LocalRealm.RealmName,
                this.testConfig.LocalRealm.User[2].Username,
                this.testConfig.LocalRealm.User[2].Password,
                KerberosAccountType.User,
                testConfig.LocalRealm.KDC[0].IPAddress,
                testConfig.LocalRealm.KDC[0].Port,
                testConfig.TransportType,
                testConfig.SupportedOid);

            KdcOptions options = KdcOptions.FORWARDABLE | KdcOptions.CANONICALIZE | KdcOptions.RENEWABLE;
            client.SendAsRequest(options, null);
            METHOD_DATA methodData;
            KerberosKrbError krbError = client.ExpectPreauthRequiredError(out methodData);

            BaseTestSite.Log.Add(LogEntryKind.Comment, "Create and send AS request with PaEncTimeStamp, PaPacRequest and paPacOptions.");
            string timeStamp = KerberosUtility.CurrentKerberosTime.Value;
            PaEncTimeStamp paEncTimeStamp = new PaEncTimeStamp(timeStamp,
                0,
                client.Context.SelectedEType,
                client.Context.CName.Password,
                this.client.Context.CName.Salt);
            PaPacRequest paPacRequest = new PaPacRequest(true);
            PaPacOptions paPacOptions = new PaPacOptions(PacOptions.Claims | PacOptions.ForwardToFullDc);
            Asn1SequenceOf<PA_DATA> seqOfPaData = new Asn1SequenceOf<PA_DATA>(new PA_DATA[] { paEncTimeStamp.Data, paPacRequest.Data, paPacOptions.Data });
            client.SendAsRequest(options, seqOfPaData);
            KerberosAsResponse asResponse = client.ExpectAsResponse();

            BaseTestSite.Log.Add(LogEntryKind.Comment, "Create and send FAST armored TGS request: {0}.", this.testConfig.LocalRealm.FileServer[0].Smb2ServiceName);
            Asn1SequenceOf<PA_DATA> seqOfPaData2 = new Asn1SequenceOf<PA_DATA>(new PA_DATA[] { paPacRequest.Data, paPacOptions.Data });
            client.SendTgsRequest(this.testConfig.LocalRealm.FileServer[0].Smb2ServiceName, options, seqOfPaData2);
            KerberosTgsResponse tgsResponse = client.ExpectTgsResponse();
            EncryptionKey key = testConfig.QueryKey(this.testConfig.LocalRealm.FileServer[0].Smb2ServiceName, client.Context.Realm.ToString(), client.Context.SelectedEType);
            tgsResponse.DecryptTicket(key);
            BaseTestSite.Assert.IsNotNull(tgsResponse.EncPart, "The encrypted part of TGS-REP is decrypted.");

            if (this.testConfig.IsKileImplemented)
            {
                BaseTestSite.Assert.IsNotNull(tgsResponse.TicketEncPart.authorization_data, "The ticket contains Authorization data.");
                AdWin2KPac adWin2kPac = FindOneInAuthData<AdWin2KPac>(tgsResponse.TicketEncPart.authorization_data.Elements);
                BaseTestSite.Assert.IsNotNull(adWin2kPac, "The Authorization data contains AdWin2KPac.");

                foreach (PacInfoBuffer buf in adWin2kPac.Pac.PacInfoBuffers)
                {
                    if (buf.GetType() == typeof(ClientClaimsInfo))
                    {
                        return ((ClientClaimsInfo)buf).NativeClaimSet;
                    }
                }
            }
            return null;
        }
开发者ID:yazeng,项目名称:WindowsProtocolTestSuites,代码行数:55,代码来源:ADTSClaim.cs

示例12: KrbErrorBadIntegrity

        public void KrbErrorBadIntegrity()
        {
            base.Logging();

            client = new KerberosTestClient(this.testConfig.LocalRealm.RealmName,
                this.testConfig.LocalRealm.User[1].Username,
                this.testConfig.LocalRealm.User[1].Password,
                KerberosAccountType.User,
                testConfig.LocalRealm.KDC[0].IPAddress,
                testConfig.LocalRealm.KDC[0].Port,
                testConfig.TransportType,
                testConfig.SupportedOid);

            // Kerberos Proxy Service is used
            if (this.testConfig.UseProxy)
            {
                BaseTestSite.Log.Add(LogEntryKind.Comment, "Initialize KKDCP Client .");
                KKDCPClient proxyClient = new KKDCPClient(proxyClientConfig);
                proxyClient.TargetDomain = this.testConfig.LocalRealm.RealmName;
                client.UseProxy = true;
                client.ProxyClient = proxyClient;
            }

            //Create and send AS request
            KdcOptions options = KdcOptions.FORWARDABLE | KdcOptions.CANONICALIZE | KdcOptions.RENEWABLE;
            client.SendAsRequest(options, null);
            //Recieve preauthentication required error
            METHOD_DATA methodData;
            KerberosKrbError krbError = client.ExpectPreauthRequiredError(out methodData);

            //Create sequence of PA data
            string timeStamp = KerberosUtility.CurrentKerberosTime.Value;
            PaEncTimeStamp paEncTimeStamp = new PaEncTimeStamp(timeStamp,
                0,
                client.Context.SelectedEType,
                this.client.Context.CName.Password,
                this.client.Context.CName.Salt);
            PaPacRequest paPacRequest = new PaPacRequest(true);
            Asn1SequenceOf<PA_DATA> seqOfPaData = new Asn1SequenceOf<PA_DATA>(new PA_DATA[] { paEncTimeStamp.Data, paPacRequest.Data });
            //Create and send AS request
            client.SendAsRequest(options, seqOfPaData);
            KerberosAsResponse asResponse = client.ExpectAsResponse();

            // Modify ciphertext of TGT
            byte originalFirstByte = (byte)client.Context.Ticket.Ticket.enc_part.cipher.ByteArrayValue.GetValue(0);
            client.Context.Ticket.Ticket.enc_part.cipher.ByteArrayValue.SetValue((byte)(originalFirstByte + 1), 0);

            //Create and send TGS request
            client.SendTgsRequest(this.testConfig.LocalRealm.FileServer[0].Smb2ServiceName, options);
            krbError = client.ExpectKrbError();
            BaseTestSite.Log.Add(LogEntryKind.Comment, "Recieve Kerberos error.");
            BaseTestSite.Assert.AreEqual(KRB_ERROR_CODE.KRB_AP_ERR_BAD_INTEGRITY, krbError.ErrorCode,
                "If decrypting the authenticator using the session key shows that it has been modified, " +
                "the KRB_AP_ERR_BAD_INTEGRITY error is returned");
        }
开发者ID:yazeng,项目名称:WindowsProtocolTestSuites,代码行数:55,代码来源:KileKrbErrorTest.cs

示例13: KrbFastResponse

 public KrbFastResponse(
     Asn1SequenceOf<PA_DATA> param0,
     EncryptionKey param1,
     KrbFastFinished param2,
     KerbUInt32 param3)
 {
     this.padata = param0;
     this.strengthen_key = param1;
     this.finished = param2;
     this.nonce = param3;
 }
开发者ID:gitter-badger,项目名称:WindowsProtocolTestSuites,代码行数:11,代码来源:KrbFastResponse.cs

示例14: TGS_REQ

 public TGS_REQ(
     Asn1Integer param0,
     Asn1Integer param1,
     Asn1SequenceOf<PA_DATA> param2,
     KDC_REQ_BODY param3)
 {
     this.pvno = param0;
     this.msg_type = param1;
     this.padata = param2;
     this.req_body = param3;
 }
开发者ID:gitter-badger,项目名称:WindowsProtocolTestSuites,代码行数:11,代码来源:TGS_REQ.cs

示例15: KRB_CRED

 public KRB_CRED(
     Asn1Integer param0,
     Asn1Integer param1,
     Asn1SequenceOf<Ticket> param2,
     EncryptedData param3)
 {
     this.pvno = param0;
     this.msg_type = param1;
     this.tickets = param2;
     this.enc_part = param3;
 }
开发者ID:gitter-badger,项目名称:WindowsProtocolTestSuites,代码行数:11,代码来源:KRB_CRED.cs


注:本文中的Asn1SequenceOf类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。