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


C# SecurityTokenParameters.CreateKeyIdentifierClause方法代码示例

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


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

示例1: CreateWrappedKeyToken

 private WrappedKeySecurityToken CreateWrappedKeyToken(SecurityToken wrappingToken, SecurityTokenParameters wrappingTokenParameters, SecurityTokenReferenceStyle wrappingTokenReferenceStyle)
 {
     int keyLength = Math.Max(0x80, this.Factory.OutgoingAlgorithmSuite.DefaultSymmetricKeyLength);
     CryptoHelper.ValidateSymmetricKeyLength(keyLength, this.Factory.OutgoingAlgorithmSuite);
     byte[] buffer = new byte[keyLength / 8];
     CryptoHelper.FillRandomBytes(buffer);
     string id = System.ServiceModel.Security.SecurityUtils.GenerateId();
     string defaultAsymmetricKeyWrapAlgorithm = this.Factory.OutgoingAlgorithmSuite.DefaultAsymmetricKeyWrapAlgorithm;
     SecurityKeyIdentifierClause clause = wrappingTokenParameters.CreateKeyIdentifierClause(wrappingToken, wrappingTokenReferenceStyle);
     SecurityKeyIdentifier wrappingTokenReference = new SecurityKeyIdentifier();
     wrappingTokenReference.Add(clause);
     return new WrappedKeySecurityToken(id, buffer, defaultAsymmetricKeyWrapAlgorithm, wrappingToken, wrappingTokenReference);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:13,代码来源:SymmetricSecurityProtocol.cs

示例2: AddPrimaryTokenSignatureReference

        void AddPrimaryTokenSignatureReference(SecurityToken token, SecurityTokenParameters securityTokenParameters)
        {
            // Currently we only support signing the primary token if the primary token is an issued token and protectTokens knob is set to true.
            // We will get rid of the below check when we support all token types.
            IssuedSecurityTokenParameters istp = securityTokenParameters as IssuedSecurityTokenParameters;
            if (istp == null)
            {
                return;
            }

            bool strTransformEnabled = istp != null && istp.UseStrTransform;
            SecurityKeyIdentifierClause keyIdentifierClause = null;
            // Only if the primary token is included in the message that we sign it because WCF at present does not resolve externally referenced tokens. 
            // This means in the server's response 
            if (ShouldSerializeToken(securityTokenParameters, this.MessageDirection))
            {
                if (strTransformEnabled)
                {
                    keyIdentifierClause = securityTokenParameters.CreateKeyIdentifierClause(token, GetTokenReferenceStyle(securityTokenParameters));
                }
                AddTokenSignatureReference(token, keyIdentifierClause, strTransformEnabled);
            }
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:23,代码来源:WSSecurityOneDotZeroSendSecurityHeader.cs

示例3: CreateWrappedKeyToken

 WrappedKeySecurityToken CreateWrappedKeyToken(SecurityToken wrappingToken, SecurityTokenParameters wrappingTokenParameters, SecurityTokenReferenceStyle wrappingTokenReferenceStyle)
 {
     int keyLength = Math.Max(128, this.Factory.OutgoingAlgorithmSuite.DefaultSymmetricKeyLength);
     CryptoHelper.ValidateSymmetricKeyLength(keyLength, this.Factory.OutgoingAlgorithmSuite);
     byte[] key = new byte[keyLength / 8];
     CryptoHelper.FillRandomBytes(key);
     string tokenId = SecurityUtils.GenerateId();
     string wrappingAlgorithm = this.Factory.OutgoingAlgorithmSuite.DefaultAsymmetricKeyWrapAlgorithm;
     SecurityKeyIdentifierClause clause = wrappingTokenParameters.CreateKeyIdentifierClause(wrappingToken, wrappingTokenReferenceStyle);
     SecurityKeyIdentifier identifier = new SecurityKeyIdentifier();
     identifier.Add(clause);
     return new WrappedKeySecurityToken(tokenId, key, wrappingAlgorithm, wrappingToken, identifier);
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:13,代码来源:SymmetricSecurityProtocol.cs


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