• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# ProtocolVersion类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: CreateIssuedToken

        public static void CreateIssuedToken(Guid transactionId, string coordinationContextId, ProtocolVersion protocolVersion, out RequestSecurityTokenResponse issuedToken, out string sctId)
        {
            sctId = CoordinationContext.CreateNativeIdentifier(Guid.NewGuid());
            byte[] key = DeriveIssuedTokenKey(transactionId, sctId);
            DateTime utcNow = DateTime.UtcNow;
            SecurityContextSecurityToken token = new SecurityContextSecurityToken(new UniqueId(sctId), key, utcNow, utcNow + TimeSpan.FromDays(36500.0));
            BinarySecretSecurityToken token2 = new BinarySecretSecurityToken(key);
            SecurityStandardsManager standardsManager = CreateStandardsManager(protocolVersion);
            RequestSecurityTokenResponse response = new RequestSecurityTokenResponse(standardsManager) {
                TokenType = standardsManager.SecureConversationDriver.TokenTypeUri,
                RequestedUnattachedReference = SecurityContextSecurityTokenParameters.CreateKeyIdentifierClause(token, SecurityTokenReferenceStyle.External),
                RequestedAttachedReference = SecurityContextSecurityTokenParameters.CreateKeyIdentifierClause(token, SecurityTokenReferenceStyle.Internal),
                RequestedSecurityToken = token,
                RequestedProofToken = token2
            };
            DataContractSerializer serializer = IdentifierElementSerializer(protocolVersion);
            ProtocolVersionHelper.AssertProtocolVersion(protocolVersion, typeof(CoordinationServiceSecurity), "CreateIssuedToken");
            switch (protocolVersion)
            {
                case ProtocolVersion.Version10:
                    response.SetAppliesTo<IdentifierElement10>(new IdentifierElement10(coordinationContextId), serializer);
                    break;

                case ProtocolVersion.Version11:
                    response.SetAppliesTo<IdentifierElement11>(new IdentifierElement11(coordinationContextId), serializer);
                    break;
            }
            response.MakeReadOnly();
            if (DebugTrace.Verbose)
            {
                DebugTrace.Trace(TraceLevel.Verbose, "Created issued token with id {0} for transaction {1}", sctId, transactionId);
            }
            issuedToken = response;
        }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:34,代码来源:CoordinationServiceSecurity.cs


示例2: AssertProtocolVersion

 public static void AssertProtocolVersion(ProtocolVersion protocolVersion, Type type, string method)
 {
     if (!Enum.IsDefined(typeof(ProtocolVersion), protocolVersion))
     {
         DiagnosticUtility.FailFast(string.Concat(new object[] { "An invalid protocol version value was used in ", type, '.', method }));
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:ProtocolVersionHelper.cs


示例3: NpgsqlAsciiRow

 public NpgsqlAsciiRow(NpgsqlRowDescription rowDesc, ProtocolVersion protocolVersion, byte[] inputBuffer, char[] chars)
         : base(rowDesc, protocolVersion)
 {
     NpgsqlEventLog.LogMethodEnter(LogLevel.Debug, CLASSNAME, CLASSNAME);
     _inputBuffer = inputBuffer;
     _chars = chars;
 }
开发者ID:nlhepler,项目名称:mono,代码行数:7,代码来源:NpgsqlAsciiRow.cs


示例4: NpgsqlStartupPacket

        public NpgsqlStartupPacket(Int32 packet_size,
                                   ProtocolVersion protocol_version,
                                   String database_name,
                                   String user_name,
                                   String arguments,
                                   String unused,
                                   String optional_tty)
        {

            NpgsqlEventLog.LogMethodEnter(LogLevel.Debug, CLASSNAME, CLASSNAME);
            // Just copy the values.

            // [FIXME] Validate params? We are the only clients, so, hopefully, we
            // know what to send.

            this.packet_size = packet_size;
            this.protocol_version = protocol_version;

            this.database_name = database_name;
            this.user_name = user_name;
            this.arguments = arguments;
            this.unused = unused;
            this.optional_tty = optional_tty;

        }
开发者ID:nlhepler,项目名称:mono,代码行数:25,代码来源:NpgsqlStartupPacket.cs


示例5: GetBuilderFor

        public static IFrameBuilder GetBuilderFor(ProtocolVersion protocolVersion)
        {
            if(protocolVersion == ProtocolVersion.Hybi10)
                return new Hybi10ControlFrameBuilder();

            return null;
        }
开发者ID:roffster,项目名称:WuSS,代码行数:7,代码来源:FrameBuilders.cs


示例6: GetCoordinationContext

        // The demand is not added now (in 4.5), to avoid a breaking change. To be considered in the next version.
        /*
        // We demand full trust because we call into CoordinationContext and CoordinationStrings, which are defined in a non-APTCA assembly. Also, CoordinationStrings.Version(..) 
        // does an Environment.FailFast if the argument is invalid. It's recommended to not let partially trusted callers to bring down the process.
        // WSATs are not supported in partial trust, so customers should not be broken by this demand.
        [PermissionSet(SecurityAction.Demand, Unrestricted = true)]
        */
        public static CoordinationContext GetCoordinationContext(Message message, ProtocolVersion protocolVersion)
        {
            CoordinationStrings coordinationStrings = CoordinationStrings.Version(protocolVersion);
            string locWsatHeaderElement = coordinationStrings.CoordinationContext;
            string locWsatNamespace = coordinationStrings.Namespace;
            
            int index;
            try
            {
                index = message.Headers.FindHeader(locWsatHeaderElement, locWsatNamespace);
            }
            catch (MessageHeaderException e)
            {
                DiagnosticUtility.TraceHandledException(e, TraceEventType.Warning);
                return null;
            }
            if (index < 0)
                return null;

            CoordinationContext context;
            XmlDictionaryReader reader = message.Headers.GetReaderAtHeader(index);
            using (reader)
            {
                context = GetCoordinationContext(reader, protocolVersion);
            }

            MessageHeaderInfo header = message.Headers[index];
            if (!message.Headers.UnderstoodHeaders.Contains(header))
            {
                message.Headers.UnderstoodHeaders.Add(header);
            }

            return context;
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:41,代码来源:WsatTransactionHeader.cs


示例7: AssertProtocolVersion11

 public static void AssertProtocolVersion11(ProtocolVersion protocolVersion, Type type, string method)
 {
     if (protocolVersion != ProtocolVersion.Version11)
     {
         DiagnosticUtility.FailFast(string.Concat(new object[] { "Must use the protocol version 1.1 to execute ", type, '.', method }));
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:ProtocolVersionHelper.cs


示例8: GetCoordinationContext

 public static CoordinationContext GetCoordinationContext(Message message, ProtocolVersion protocolVersion)
 {
     int num;
     CoordinationContext context;
     CoordinationStrings strings = CoordinationStrings.Version(protocolVersion);
     string coordinationContext = strings.CoordinationContext;
     string ns = strings.Namespace;
     try
     {
         num = message.Headers.FindHeader(coordinationContext, ns);
     }
     catch (MessageHeaderException exception)
     {
         DiagnosticUtility.ExceptionUtility.TraceHandledException(exception, TraceEventType.Warning);
         return null;
     }
     if (num < 0)
     {
         return null;
     }
     XmlDictionaryReader readerAtHeader = message.Headers.GetReaderAtHeader(num);
     using (readerAtHeader)
     {
         context = GetCoordinationContext(readerAtHeader, protocolVersion);
     }
     MessageHeaderInfo headerInfo = message.Headers[num];
     if (!message.Headers.UnderstoodHeaders.Contains(headerInfo))
     {
         message.Headers.UnderstoodHeaders.Add(headerInfo);
     }
     return context;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:32,代码来源:WsatTransactionHeader.cs


示例9: WsatTransactionHeader

 // The demand is not added now (in 4.5), to avoid a breaking change. To be considered in the next version.
 /*
 // We demand full trust because we call into CoordinationStrings.Version(..), which is defined in a non-APTCA assembly and does an Environment.FailFast 
 // if the argument is invalid. It's recommended to not let partially trusted callers to bring down the process.
 // WSATs are not supported in partial trust, so customers should not be broken by this demand.
 [PermissionSet(SecurityAction.Demand, Unrestricted = true)]
 */
 public WsatTransactionHeader(CoordinationContext context, ProtocolVersion protocolVersion)
 {
     this.context = context;
     CoordinationStrings coordinationStrings = CoordinationStrings.Version(protocolVersion);                        
     this.wsatHeaderElement = coordinationStrings.CoordinationContext;
     this.wsatNamespace = coordinationStrings.Namespace;
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:14,代码来源:WsatTransactionHeader.cs


示例10: InteropRegistrationBinding

 public InteropRegistrationBinding(Uri clientBaseAddress, bool acceptSupportingTokens, ProtocolVersion protocolVersion) : base(clientBaseAddress, protocolVersion)
 {
     if (acceptSupportingTokens)
     {
         this.supportingTokenBE = new Microsoft.Transactions.Wsat.Messaging.SupportingTokenBindingElement(protocolVersion);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:InteropRegistrationBinding.cs


示例11: BuildStartupPacket

        public static NpgsqlStartupPacket BuildStartupPacket(ProtocolVersion protocol_version, String database_name, String user_name,
                                                             NpgsqlConnectionStringBuilder  settings)
        {
            NpgsqlEventLog.LogMethodEnter(LogLevel.Debug, CLASSNAME, "BuildStartupPacket");

            if (protocol_version == ProtocolVersion.Version2)
            {
                return new NpgsqlStartupPacketV2(database_name,user_name, "", "", "");
            }
            else
            {
                Dictionary<String, String> parameters = new Dictionary<String, String>();

                parameters.Add("DateStyle", "ISO");
                parameters.Add("client_encoding", "UTF8");
                parameters.Add("extra_float_digits", "2");
                parameters.Add("lc_monetary", "C");

                if (!string.IsNullOrEmpty(settings.ApplicationName))
                {
                    parameters.Add("application_name", settings.ApplicationName);
                }

                if (!string.IsNullOrEmpty(settings.SearchPath))
                {
                    parameters.Add("search_path", settings.SearchPath);
                }

                return new NpgsqlStartupPacketV3(database_name,user_name,parameters);
            }
        }
开发者ID:udoliess,项目名称:npgsql,代码行数:31,代码来源:NpgsqlStartupPacket.cs


示例12: GetClientKeys

		public override byte[] GetClientKeys(ProtocolVersion version, ProtocolVersion clientVersion, CertificatePublicKey publicKey)
		{
			if (!(publicKey.Algorithm is RSACryptoServiceProvider)) {
				throw new CryptographicException("RSA key exchange requires RSA public key");
			}
			return GetClientKeys(version, clientVersion, (RSACryptoServiceProvider)publicKey.Algorithm);
		}
开发者ID:cwschroeder,项目名称:MeterTestComService,代码行数:7,代码来源:KeyExchangeAlgorithmRSA.cs


示例13: parameterizedProgrammaticOPIdentifierTest

		void parameterizedProgrammaticOPIdentifierTest(Identifier opIdentifier, ProtocolVersion version,
			Identifier claimedUrl, AuthenticationRequestMode requestMode,
			AuthenticationStatus expectedResult, bool provideStore) {

			var rp = TestSupport.CreateRelyingParty(provideStore ? TestSupport.RelyingPartyStore : null, null, null);

			var returnTo = TestSupport.GetFullUrl(TestSupport.ConsumerPage);
			var realm = new Realm(TestSupport.GetFullUrl(TestSupport.ConsumerPage).AbsoluteUri);
			var request = rp.CreateRequest(opIdentifier, realm, returnTo);
			request.Mode = requestMode;

			var rpResponse = TestSupport.CreateRelyingPartyResponseThroughProvider(request,
				opReq => {
					opReq.IsAuthenticated = expectedResult == AuthenticationStatus.Authenticated;
					if (opReq.IsAuthenticated.Value) {
						opReq.ClaimedIdentifier = claimedUrl;
					}
				});
			Assert.AreEqual(expectedResult, rpResponse.Status);
			if (rpResponse.Status == AuthenticationStatus.Authenticated) {
				Assert.AreEqual(claimedUrl, rpResponse.ClaimedIdentifier);
			} else if (rpResponse.Status == AuthenticationStatus.SetupRequired) {
				Assert.IsNull(rpResponse.ClaimedIdentifier);
				Assert.IsNull(rpResponse.FriendlyIdentifierForDisplay);
				Assert.IsNull(rpResponse.Exception);
				Assert.IsInstanceOfType(typeof(ISetupRequiredAuthenticationResponse), rpResponse);
				Assert.AreEqual(opIdentifier.ToString(), ((ISetupRequiredAuthenticationResponse)rpResponse).ClaimedOrProviderIdentifier.ToString());
			}
		}
开发者ID:Belxjander,项目名称:Asuna,代码行数:29,代码来源:EndToEndTesting.cs


示例14: SupportsProtocolVersion

		public override bool SupportsProtocolVersion(ProtocolVersion version)
		{
			if (version.IsUsingDatagrams) {
				return false;
			}
			return true;
		}
开发者ID:cwschroeder,项目名称:MeterTestComService,代码行数:7,代码来源:BulkCipherAlgorithmARCFour.cs


示例15: InfoSource

 public InfoSource(GuidPrefix guidPrefix)
     : base(SubMessageKind.INFO_SRC)
 {
     this.protocolVersion = ProtocolVersion.PROTOCOLVERSION_2_1;
     this.vendorId = VendorId.VENDORID_UNKNOWN;
     this.guidPrefix = guidPrefix;
 }
开发者ID:Egipto87,项目名称:DOOP.ec,代码行数:7,代码来源:InfoSource.cs


示例16: NpgsqlPasswordPacket

		public NpgsqlPasswordPacket(String password, ProtocolVersion protocolVersion)
		{
			NpgsqlEventLog.LogMethodEnter(LogLevel.Debug, CLASSNAME, CLASSNAME);

			this.password = password;
			this.protocolVersion = protocolVersion;
		}
开发者ID:Orvid,项目名称:SQLInterfaceCollection,代码行数:7,代码来源:NpgsqlPasswordPacket.cs


示例17: ConnectionParameters

 /// <summary>
 /// Creates a new <see cref="ConnectionParameters"/>.
 /// </summary>
 public ConnectionParameters()
 {
     m_protocolVersion = ProtocolVersion.M;
     m_configurationFileName = null;
     m_refreshConfigurationFileOnChange = false;
     m_deviceLabel = null;
 }
开发者ID:rmc00,项目名称:gsf,代码行数:10,代码来源:ConnectionParameters.cs


示例18: VerifyData

		public override bool VerifyData(ProtocolVersion version, byte[] data, HashAlgorithm hashAlgorithm, CertificatePublicKey key, byte[] signature)
		{
			if (signature.Length == 0) {
				return true;
			}
			return false;
		}
开发者ID:cwschroeder,项目名称:MeterTestComService,代码行数:7,代码来源:SignatureAlgorithmNull.cs


示例19: AddVersionTests

        private static void AddVersionTests(IList testSuite, ProtocolVersion version)
        {
            string prefix = version.ToString()
                .Replace(" ", "")
                .Replace("\\", "")
                .Replace(".", "")
                + "_";

            /*
             * NOTE: Temporarily disabled automatic test runs because of problems getting a clean exit
             * of the DTLS server after a fatal alert. As of writing, manual runs show the correct
             * alerts being raised
             */

            //{
            //    TlsTestConfig c = CreateDtlsTestConfig(version);
            //    c.clientAuth = C.CLIENT_AUTH_INVALID_VERIFY;
            //    c.ExpectServerFatalAlert(AlertDescription.decrypt_error);

            //    testSuite.Add(new TestCaseData(c).SetName(prefix + "BadCertificateVerify"));
            //}

            //{
            //    TlsTestConfig c = CreateDtlsTestConfig(version);
            //    c.clientAuth = C.CLIENT_AUTH_INVALID_CERT;
            //    c.ExpectServerFatalAlert(AlertDescription.bad_certificate);

            //    testSuite.Add(new TestCaseData(c).SetName(prefix + "BadClientCertificate"));
            //}

            //{
            //    TlsTestConfig c = CreateDtlsTestConfig(version);
            //    c.clientAuth = C.CLIENT_AUTH_NONE;
            //    c.serverCertReq = C.SERVER_CERT_REQ_MANDATORY;
            //    c.ExpectServerFatalAlert(AlertDescription.handshake_failure);

            //    testSuite.Add(new TestCaseData(c).SetName(prefix + "BadMandatoryCertReqDeclined"));
            //}

            {
                TlsTestConfig c = CreateDtlsTestConfig(version);

                testSuite.Add(new TestCaseData(c).SetName(prefix + "GoodDefault"));
            }

            {
                TlsTestConfig c = CreateDtlsTestConfig(version);
                c.serverCertReq = C.SERVER_CERT_REQ_NONE;

                testSuite.Add(new TestCaseData(c).SetName(prefix + "GoodNoCertReq"));
            }

            {
                TlsTestConfig c = CreateDtlsTestConfig(version);
                c.clientAuth = C.CLIENT_AUTH_NONE;

                testSuite.Add(new TestCaseData(c).SetName(prefix + "GoodOptionalCertReqDeclined"));
            }
        }
开发者ID:martijn00,项目名称:BouncyCastle-PCL,代码行数:59,代码来源:DtlsTestSuite.cs


示例20: RequestPackage

 /// <summary>
 /// init
 /// </summary>
 public RequestPackage(int msgId, string sessionId, int actionId, int userId, ProtocolVersion ptcl = ProtocolVersion.Default)
 {
     MsgId = msgId;
     SessionId = sessionId;
     ProxySid = Guid.Empty;
     ActionId = actionId;
     UserId = userId;
     Ptcl = ptcl;
 }
开发者ID:LeeWangyeol,项目名称:Scut,代码行数:12,代码来源:RequestPackage.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Protocols类代码示例发布时间:2022-05-24
下一篇:
C# ProtocolType类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap