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

C# Security.SecurityMessageProperty类代码示例

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

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



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

示例1: OnAcceptUpgrade

 protected override Stream OnAcceptUpgrade(Stream stream, out SecurityMessageProperty remoteSecurity)
 {
     SslStream stream2 = new SslStream(stream, false, new RemoteCertificateValidationCallback(this.ValidateRemoteCertificate));
     try
     {
         stream2.AuthenticateAsServer(this.parent.ServerCertificate, this.parent.RequireClientCertificate, SslProtocols.Default, false);
     }
     catch (AuthenticationException exception)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new SecurityNegotiationException(exception.Message, exception));
     }
     catch (IOException exception2)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new SecurityNegotiationException(System.ServiceModel.SR.GetString("NegotiationFailedIO", new object[] { exception2.Message }), exception2));
     }
     if (System.ServiceModel.Security.SecurityUtils.ShouldValidateSslCipherStrength())
     {
         System.ServiceModel.Security.SecurityUtils.ValidateSslCipherStrength(stream2.CipherStrength);
     }
     remoteSecurity = this.clientSecurity;
     if (this.IsChannelBindingSupportEnabled)
     {
         this.channelBindingToken = ChannelBindingUtility.GetToken(stream2);
     }
     return stream2;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:26,代码来源:SslStreamSecurityUpgradeAcceptor.cs


示例2: InitiatorSecureMessageDecryptor

		public InitiatorSecureMessageDecryptor (
			Message source, SecurityMessageProperty secprop, InitiatorMessageSecurityBindingSupport security)
			: base (source, security)
		{
			this.security = security;
			request_security = secprop;
		}
开发者ID:kumpera,项目名称:mono,代码行数:7,代码来源:SecureMessageDecryptor.cs


示例3: CreateCopy

 public IMessageProperty CreateCopy()
 {
     this.ThrowIfDisposed();
     SecurityMessageProperty property = new SecurityMessageProperty();
     if (this.HasOutgoingSupportingTokens)
     {
         for (int i = 0; i < this.outgoingSupportingTokens.Count; i++)
         {
             property.OutgoingSupportingTokens.Add(this.outgoingSupportingTokens[i]);
         }
     }
     if (this.HasIncomingSupportingTokens)
     {
         for (int j = 0; j < this.incomingSupportingTokens.Count; j++)
         {
             property.IncomingSupportingTokens.Add(this.incomingSupportingTokens[j]);
         }
     }
     property.securityContext = this.securityContext;
     property.externalAuthorizationPolicies = this.externalAuthorizationPolicies;
     property.senderIdPrefix = this.senderIdPrefix;
     property.protectionToken = this.protectionToken;
     property.initiatorToken = this.initiatorToken;
     property.recipientToken = this.recipientToken;
     property.transportToken = this.transportToken;
     return property;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:27,代码来源:SecurityMessageProperty.cs


示例4: SingletonConnectionReader

 protected SingletonConnectionReader(IConnection connection, int offset, int size, SecurityMessageProperty security, IConnectionOrientedTransportFactorySettings transportSettings, Uri via)
 {
     this.connection = connection;
     this.offset = offset;
     this.size = size;
     this.security = security;
     this.transportSettings = transportSettings;
     this.via = via;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:9,代码来源:SingletonConnectionReader.cs


示例5: AddSupportingToken

 public static void AddSupportingToken(Message message, RequestSecurityTokenResponse rstr)
 {
     GenericXmlSecurityToken token = rstr.GetIssuedToken(null, null, SecurityKeyEntropyMode.ServerEntropy, null, null, null);
     SecurityMessageProperty property = new SecurityMessageProperty();
     SupportingTokenSpecification item = new SupportingTokenSpecification(token, new List<IAuthorizationPolicy>().AsReadOnly(), SecurityTokenAttachmentMode.Endorsing, SecurityContextSecurityTokenParameters);
     property.OutgoingSupportingTokens.Add(item);
     message.Properties.Security = property;
     if (DebugTrace.Verbose)
     {
         DebugTrace.Trace(TraceLevel.Verbose, "Attached supporting token {0} to register message", rstr.Context);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:12,代码来源:CoordinationServiceSecurity.cs


示例6: SingletonConnectionReader

        protected SingletonConnectionReader(IConnection connection, int offset, int size, SecurityMessageProperty security,
            IConnectionOrientedTransportFactorySettings transportSettings, Uri via)
        {
            Contract.Assert(connection != null);

            _connection = connection;
            _offset = offset;
            _size = size;
            _security = security;
            _transportSettings = transportSettings;
            _via = via;
        }
开发者ID:weshaggard,项目名称:wcf,代码行数:12,代码来源:SingletonConnectionReader.cs


示例7: SessionConnectionReader

 protected SessionConnectionReader(IConnection connection, IConnection rawConnection,
     int offset, int size, SecurityMessageProperty security)
 {
     _offset = offset;
     _size = size;
     if (size > 0)
     {
         _buffer = connection.AsyncReadBuffer;
     }
     _connection = connection;
     _rawConnection = rawConnection;
     _security = security;
 }
开发者ID:TerabyteX,项目名称:wcf,代码行数:13,代码来源:SessionConnectionReader.cs


示例8: SessionConnectionReader

 protected SessionConnectionReader(IConnection connection, IConnection rawConnection, int offset, int size, SecurityMessageProperty security)
 {
     this.offset = offset;
     this.size = size;
     if (size > 0)
     {
         this.buffer = connection.AsyncReadBuffer;
     }
     this.connection = connection;
     this.rawConnection = rawConnection;
     this.onAsyncReadComplete = new WaitCallback(this.OnAsyncReadComplete);
     this.security = security;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:13,代码来源:SessionConnectionReader.cs


示例9: GetRemoteSecurity

 public override SecurityMessageProperty GetRemoteSecurity()
 {
     if (this.clientSecurity.TransportToken != null)
     {
         return this.clientSecurity;
     }
     if (this.clientCertificate != null)
     {
         SecurityToken token = new X509SecurityToken(this.clientCertificate);
         ReadOnlyCollection<IAuthorizationPolicy> tokenPolicies = System.ServiceModel.Security.SecurityUtils.NonValidatingX509Authenticator.ValidateToken(token);
         this.clientSecurity = new SecurityMessageProperty();
         this.clientSecurity.TransportToken = new SecurityTokenSpecification(token, tokenPolicies);
         this.clientSecurity.ServiceSecurityContext = new ServiceSecurityContext(tokenPolicies);
         return this.clientSecurity;
     }
     return base.GetRemoteSecurity();
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:17,代码来源:SslStreamSecurityUpgradeAcceptor.cs


示例10: SendPreamble

        internal IConnection SendPreamble(IConnection connection, ref TimeoutHelper timeoutHelper,
            ClientFramingDecoder decoder, out SecurityMessageProperty remoteSecurity)
        {
            connection.Write(Preamble, 0, Preamble.Length, true, timeoutHelper.RemainingTime());

            if (_upgrade != null)
            {
                IStreamUpgradeChannelBindingProvider channelBindingProvider = _upgrade.GetProperty<IStreamUpgradeChannelBindingProvider>();

                StreamUpgradeInitiator upgradeInitiator = _upgrade.CreateUpgradeInitiator(this.RemoteAddress, this.Via);

                if (!ConnectionUpgradeHelper.InitiateUpgrade(upgradeInitiator, ref connection, decoder,
                    this, ref timeoutHelper))
                {
                    ConnectionUpgradeHelper.DecodeFramingFault(decoder, connection, Via, _messageEncoder.ContentType, ref timeoutHelper);
                }

#if FEATURE_CORECLR // ExtendedProtection
                if (channelBindingProvider != null && channelBindingProvider.IsChannelBindingSupportEnabled)
                {
                    _channelBindingToken = channelBindingProvider.GetChannelBinding(upgradeInitiator, ChannelBindingKind.Endpoint);
                }
#endif // FEATURE_CORECLR // ExtendedProtection

                remoteSecurity = StreamSecurityUpgradeInitiator.GetRemoteSecurity(upgradeInitiator);

                connection.Write(ClientSingletonEncoder.PreambleEndBytes, 0,
                    ClientSingletonEncoder.PreambleEndBytes.Length, true, timeoutHelper.RemainingTime());
            }
            else
            {
                remoteSecurity = null;
            }

            // read ACK
            byte[] ackBuffer = new byte[1];
            int ackBytesRead = connection.Read(ackBuffer, 0, ackBuffer.Length, timeoutHelper.RemainingTime());
            if (!ConnectionUpgradeHelper.ValidatePreambleResponse(ackBuffer, ackBytesRead, decoder, this.Via))
            {
                ConnectionUpgradeHelper.DecodeFramingFault(decoder, connection, Via, _messageEncoder.ContentType, ref timeoutHelper);
            }

            return connection;
        }
开发者ID:weshaggard,项目名称:wcf,代码行数:44,代码来源:StreamedFramingRequestChannel.cs


示例11: End

 public static IConnection End(IAsyncResult result, out SecurityMessageProperty remoteSecurity)
 {
     StreamedFramingRequestChannel.StreamedConnectionPoolHelper.SendPreambleAsyncResult result2 = AsyncResult.End<StreamedFramingRequestChannel.StreamedConnectionPoolHelper.SendPreambleAsyncResult>(result);
     remoteSecurity = result2.remoteSecurity;
     return result2.connection;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:6,代码来源:StreamedFramingRequestChannel.cs


示例12: SecureMessage

		public Message SecureMessage ()
		{
			secprop = Message.Properties.Security ?? new SecurityMessageProperty ();

			SecurityToken encToken =
				secprop.InitiatorToken != null ? secprop.InitiatorToken.SecurityToken : security.EncryptionToken;
			// FIXME: it might be still incorrect.
			SecurityToken signToken =
				Parameters == CounterParameters ? null :
				security.SigningToken;
			MessageProtectionOrder protectionOrder =
				security.MessageProtectionOrder;
			SecurityTokenSerializer serializer =
				security.TokenSerializer;
			SecurityBindingElement element =
				security.Element;
			SecurityAlgorithmSuite suite = element.DefaultAlgorithmSuite;

// FIXME: remove this hack
if (!ShouldOutputEncryptedKey)
	encToken = new BinarySecretSecurityToken (secprop.EncryptionKey);

			string messageId = "uuid-" + Guid.NewGuid ();
			int identForMessageId = 1;
			XmlDocument doc = new XmlDocument ();
			doc.PreserveWhitespace = true;

			UniqueId relatesTo = RelatesTo;
			if (relatesTo != null)
				msg.Headers.RelatesTo = relatesTo;
			else // FIXME: probably it is always added when it is stateful ?
				msg.Headers.MessageId = new UniqueId ("urn:" + messageId);

			// FIXME: get correct ReplyTo value
			if (Direction == MessageDirection.Input)
				msg.Headers.ReplyTo = new EndpointAddress (Constants.WsaAnonymousUri);

			if (MessageTo != null)
				msg.Headers.To = MessageTo.Uri;

			// wss:Security
			WSSecurityMessageHeader header =
				new WSSecurityMessageHeader (serializer);
			msg.Headers.Add (header);
			// 1. 1653525092
			if (element.IncludeTimestamp) {
				WsuTimestamp timestamp = new WsuTimestamp ();
				timestamp.Id = messageId + "-" + identForMessageId++;
				timestamp.Created = DateTime.Now;
				// FIXME: on service side, use element.LocalServiceSettings.TimestampValidityDuration
				timestamp.Expires = timestamp.Created.Add (element.LocalClientSettings.TimestampValidityDuration);
				header.AddContent (timestamp);
			}

			XmlNamespaceManager nsmgr = new XmlNamespaceManager (doc.NameTable);
			nsmgr.AddNamespace ("s", msg.Version.Envelope.Namespace);
			nsmgr.AddNamespace ("o", Constants.WssNamespace);
			nsmgr.AddNamespace ("u", Constants.WsuNamespace);
			nsmgr.AddNamespace ("o11", Constants.Wss11Namespace);

			/*WrappedKey*/SecurityToken primaryToken = null;
			DerivedKeySecurityToken dkeyToken = null;
			SecurityToken actualToken = null;
			SecurityKeyIdentifierClause actualClause = null;
			Signature sig = null;

			List<DerivedKeySecurityToken> derivedKeys =
				new List<DerivedKeySecurityToken> ();

			SymmetricAlgorithm masterKey = new RijndaelManaged ();
			masterKey.KeySize = suite.DefaultSymmetricKeyLength;
			masterKey.Mode = CipherMode.CBC;
			masterKey.Padding = PaddingMode.ISO10126;
			SymmetricAlgorithm actualKey = masterKey;

			// 2. [Encryption Token]

			// SecurityTokenInclusionMode
			// - Initiator or Recipient
			// - done or notyet. FIXME: not implemented yet
			// It also affects on key reference output

			bool includeEncToken = // /* FIXME: remove this hack */Parameters is SslSecurityTokenParameters ? false :
						ShouldIncludeToken (
				Security.RecipientParameters.InclusionMode, false);
			bool includeSigToken = // /* FIXME: remove this hack */ Parameters is SslSecurityTokenParameters ? false :
						ShouldIncludeToken (
				Security.InitiatorParameters.InclusionMode, false);

			SecurityKeyIdentifierClause encClause = ShouldOutputEncryptedKey ?
				CounterParameters.CallCreateKeyIdentifierClause (encToken, !ShouldOutputEncryptedKey ? SecurityTokenReferenceStyle.Internal : includeEncToken ? Parameters.ReferenceStyle : SecurityTokenReferenceStyle.External) : null;

			MessagePartSpecification sigSpec = SignaturePart;
			MessagePartSpecification encSpec = EncryptionPart;

			// encryption key (possibly also used for signing)
			// FIXME: get correct SymmetricAlgorithm according to the algorithm suite
			if (secprop.EncryptionKey != null)
				actualKey.Key = secprop.EncryptionKey;

//.........这里部分代码省略.........
开发者ID:stabbylambda,项目名称:mono,代码行数:101,代码来源:SecureMessageGenerator.cs


示例13: End

 public static Stream End(IAsyncResult result, out SecurityMessageProperty remoteSecurity)
 {
     StreamSecurityUpgradeAcceptorAsyncResult thisPtr = AsyncResult.End<StreamSecurityUpgradeAcceptorAsyncResult>(result);
     remoteSecurity = thisPtr.remoteSecurity;
     return thisPtr.upgradedStream;
 }
开发者ID:uQr,项目名称:referencesource,代码行数:6,代码来源:StreamSecurityUpgradeAcceptorAsyncResult.cs


示例14: End

 public static Stream End(IAsyncResult result, out SecurityMessageProperty remoteSecurity, out ChannelBinding channelBinding)
 {
     Stream stream = StreamSecurityUpgradeInitiatorAsyncResult.End(result, out remoteSecurity);
     channelBinding = ((SslStreamSecurityUpgradeInitiator.InitiateUpgradeAsyncResult) result).channelBindingToken;
     return stream;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:6,代码来源:SslStreamSecurityUpgradeInitiator.cs


示例15: OnEndInitiateUpgrade

 protected override Stream OnEndInitiateUpgrade(IAsyncResult result, out SecurityMessageProperty remoteSecurity)
 {
     return InitiateUpgradeAsyncResult.End(result, out remoteSecurity, out this.channelBindingToken);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:4,代码来源:SslStreamSecurityUpgradeInitiator.cs


示例16: GetOrCreate

 public static SecurityMessageProperty GetOrCreate(Message message)
 {
     if (message == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("message");
     }
     SecurityMessageProperty security = null;
     if (message.Properties != null)
     {
         security = message.Properties.Security;
     }
     if (security == null)
     {
         security = new SecurityMessageProperty();
         message.Properties.Security = security;
     }
     return security;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:18,代码来源:SecurityMessageProperty.cs


示例17: OnAcceptUpgrade

 protected abstract Stream OnAcceptUpgrade(Stream stream, out SecurityMessageProperty remoteSecurity);
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:1,代码来源:StreamSecurityUpgradeAcceptorBase.cs


示例18: OnEndAcceptUpgrade

 protected abstract Stream OnEndAcceptUpgrade(IAsyncResult result,
     out SecurityMessageProperty remoteSecurity);
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:2,代码来源:StreamSecurityUpgradeAcceptorBase.cs


示例19: RecipientMessageSecurityGenerator

		public RecipientMessageSecurityGenerator (
			Message msg,
			SecurityMessageProperty requestSecProp,
			RecipientMessageSecurityBindingSupport security)
			: base (msg, security)
		{
			this.security = security;
			SecurityMessageProperty secprop =
				(SecurityMessageProperty) requestSecProp.CreateCopy ();
			msg.Properties.Security = secprop;
		}
开发者ID:nlhepler,项目名称:mono,代码行数:11,代码来源:SecureMessageGenerator.cs


示例20: ProcessReply

		Message ProcessReply (Message message, SecurityMessageProperty secprop)
		{
			// FIXME: provide correct parameters
			return message.IsFault ? message : new InitiatorSecureMessageDecryptor (message, secprop, security).DecryptMessage ();
		}
开发者ID:nickchal,项目名称:pash,代码行数:5,代码来源:SecurityRequestChannel.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Security.SecurityProtocolCorrelationState类代码示例发布时间:2022-05-26
下一篇:
C# Security.MessagePartSpecification类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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