Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / WCF / IdentityModel / System / IdentityModel / Tokens / EncryptedKeyIdentifierClause.cs / 1305376 / EncryptedKeyIdentifierClause.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.IdentityModel.Tokens { using System.Globalization; sealed public class EncryptedKeyIdentifierClause : BinaryKeyIdentifierClause { readonly string carriedKeyName; readonly string encryptionMethod; readonly SecurityKeyIdentifier encryptingKeyIdentifier; public EncryptedKeyIdentifierClause(byte[] encryptedKey, string encryptionMethod) : this(encryptedKey, encryptionMethod, null) { } public EncryptedKeyIdentifierClause(byte[] encryptedKey, string encryptionMethod, SecurityKeyIdentifier encryptingKeyIdentifier) : this(encryptedKey, encryptionMethod, encryptingKeyIdentifier, null) { } public EncryptedKeyIdentifierClause(byte[] encryptedKey, string encryptionMethod, SecurityKeyIdentifier encryptingKeyIdentifier, string carriedKeyName) : this(encryptedKey, encryptionMethod, encryptingKeyIdentifier, carriedKeyName, true, null, 0) { } public EncryptedKeyIdentifierClause(byte[] encryptedKey, string encryptionMethod, SecurityKeyIdentifier encryptingKeyIdentifier, string carriedKeyName, byte[] derivationNonce, int derivationLength) : this(encryptedKey, encryptionMethod, encryptingKeyIdentifier, carriedKeyName, true, derivationNonce, derivationLength) { } internal EncryptedKeyIdentifierClause(byte[] encryptedKey, string encryptionMethod, SecurityKeyIdentifier encryptingKeyIdentifier, string carriedKeyName, bool cloneBuffer, byte[] derivationNonce, int derivationLength) : base("http://www.w3.org/2001/04/xmlenc#EncryptedKey", encryptedKey, cloneBuffer, derivationNonce, derivationLength) { if (encryptionMethod == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("encryptionMethod"); } this.carriedKeyName = carriedKeyName; this.encryptionMethod = encryptionMethod; this.encryptingKeyIdentifier = encryptingKeyIdentifier; } public string CarriedKeyName { get { return this.carriedKeyName; } } public SecurityKeyIdentifier EncryptingKeyIdentifier { get { return this.encryptingKeyIdentifier; } } public string EncryptionMethod { get { return this.encryptionMethod; } } public override bool Matches(SecurityKeyIdentifierClause keyIdentifierClause) { EncryptedKeyIdentifierClause that = keyIdentifierClause as EncryptedKeyIdentifierClause; // PreSharp Bug: Parameter 'that' to this public method must be validated: A null-dereference can occur here. #pragma warning suppress 56506 return ReferenceEquals(this, that) || (that != null && that.Matches(this.GetRawBuffer(), this.encryptionMethod, this.carriedKeyName)); } public bool Matches(byte[] encryptedKey, string encryptionMethod, string carriedKeyName) { return Matches(encryptedKey) && this.encryptionMethod == encryptionMethod && this.carriedKeyName == carriedKeyName; } public byte[] GetEncryptedKey() { return GetBuffer(); } public override string ToString() { return string.Format(CultureInfo.InvariantCulture, "EncryptedKeyIdentifierClause(EncryptedKey = {0}, Method '{1}')", Convert.ToBase64String(GetRawBuffer()), this.EncryptionMethod); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.IdentityModel.Tokens { using System.Globalization; sealed public class EncryptedKeyIdentifierClause : BinaryKeyIdentifierClause { readonly string carriedKeyName; readonly string encryptionMethod; readonly SecurityKeyIdentifier encryptingKeyIdentifier; public EncryptedKeyIdentifierClause(byte[] encryptedKey, string encryptionMethod) : this(encryptedKey, encryptionMethod, null) { } public EncryptedKeyIdentifierClause(byte[] encryptedKey, string encryptionMethod, SecurityKeyIdentifier encryptingKeyIdentifier) : this(encryptedKey, encryptionMethod, encryptingKeyIdentifier, null) { } public EncryptedKeyIdentifierClause(byte[] encryptedKey, string encryptionMethod, SecurityKeyIdentifier encryptingKeyIdentifier, string carriedKeyName) : this(encryptedKey, encryptionMethod, encryptingKeyIdentifier, carriedKeyName, true, null, 0) { } public EncryptedKeyIdentifierClause(byte[] encryptedKey, string encryptionMethod, SecurityKeyIdentifier encryptingKeyIdentifier, string carriedKeyName, byte[] derivationNonce, int derivationLength) : this(encryptedKey, encryptionMethod, encryptingKeyIdentifier, carriedKeyName, true, derivationNonce, derivationLength) { } internal EncryptedKeyIdentifierClause(byte[] encryptedKey, string encryptionMethod, SecurityKeyIdentifier encryptingKeyIdentifier, string carriedKeyName, bool cloneBuffer, byte[] derivationNonce, int derivationLength) : base("http://www.w3.org/2001/04/xmlenc#EncryptedKey", encryptedKey, cloneBuffer, derivationNonce, derivationLength) { if (encryptionMethod == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("encryptionMethod"); } this.carriedKeyName = carriedKeyName; this.encryptionMethod = encryptionMethod; this.encryptingKeyIdentifier = encryptingKeyIdentifier; } public string CarriedKeyName { get { return this.carriedKeyName; } } public SecurityKeyIdentifier EncryptingKeyIdentifier { get { return this.encryptingKeyIdentifier; } } public string EncryptionMethod { get { return this.encryptionMethod; } } public override bool Matches(SecurityKeyIdentifierClause keyIdentifierClause) { EncryptedKeyIdentifierClause that = keyIdentifierClause as EncryptedKeyIdentifierClause; // PreSharp Bug: Parameter 'that' to this public method must be validated: A null-dereference can occur here. #pragma warning suppress 56506 return ReferenceEquals(this, that) || (that != null && that.Matches(this.GetRawBuffer(), this.encryptionMethod, this.carriedKeyName)); } public bool Matches(byte[] encryptedKey, string encryptionMethod, string carriedKeyName) { return Matches(encryptedKey) && this.encryptionMethod == encryptionMethod && this.carriedKeyName == carriedKeyName; } public byte[] GetEncryptedKey() { return GetBuffer(); } public override string ToString() { return string.Format(CultureInfo.InvariantCulture, "EncryptedKeyIdentifierClause(EncryptedKey = {0}, Method '{1}')", Convert.ToBase64String(GetRawBuffer()), this.EncryptionMethod); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- FlowDocument.cs
- HttpWebRequestElement.cs
- SequenceQuery.cs
- VoiceInfo.cs
- EventLogEntry.cs
- FixedSOMTableRow.cs
- CompletedAsyncResult.cs
- DataGridItemCollection.cs
- XmlSchemaType.cs
- Matrix.cs
- MobileControlsSectionHelper.cs
- ZipIOExtraFieldPaddingElement.cs
- OleDbErrorCollection.cs
- updatecommandorderer.cs
- _CommandStream.cs
- SafeFileHandle.cs
- NamespaceCollection.cs
- FormClosingEvent.cs
- XPathPatternBuilder.cs
- ResourceAttributes.cs
- safex509handles.cs
- NumericUpDown.cs
- PropertyGroupDescription.cs
- TemplateControlParser.cs
- PersistChildrenAttribute.cs
- CommandField.cs
- SchemaTableOptionalColumn.cs
- HashCoreRequest.cs
- arc.cs
- GridViewRowCollection.cs
- ZipIOModeEnforcingStream.cs
- IODescriptionAttribute.cs
- CodeArrayIndexerExpression.cs
- ThaiBuddhistCalendar.cs
- CompoundFileStreamReference.cs
- GridViewSortEventArgs.cs
- GridViewRowEventArgs.cs
- WorkItem.cs
- XXXInfos.cs
- ByteAnimationUsingKeyFrames.cs
- XmlTextWriter.cs
- ThreadStartException.cs
- OracleNumber.cs
- SafeProcessHandle.cs
- ProviderUtil.cs
- XmlHierarchicalEnumerable.cs
- HierarchicalDataBoundControl.cs
- NodeInfo.cs
- ToolStripSplitButton.cs
- ToolStripItem.cs
- RequestCache.cs
- XpsDocumentEvent.cs
- BaseComponentEditor.cs
- Rotation3DKeyFrameCollection.cs
- ContainerControlDesigner.cs
- SerializationEventsCache.cs
- Match.cs
- Menu.cs
- XmlDictionary.cs
- Attachment.cs
- WebSysDescriptionAttribute.cs
- BasicHttpMessageCredentialType.cs
- ContextConfiguration.cs
- CompositionTarget.cs
- GenericUriParser.cs
- HttpConfigurationContext.cs
- Latin1Encoding.cs
- PermissionAttributes.cs
- HttpContext.cs
- DataGridViewCellStyle.cs
- XmlAttributes.cs
- AutomationPeer.cs
- ContextMenuService.cs
- UnknownWrapper.cs
- PagePropertiesChangingEventArgs.cs
- ConfigurationException.cs
- ReflectionTypeLoadException.cs
- MethodAccessException.cs
- FrameworkReadOnlyPropertyMetadata.cs
- ListCollectionView.cs
- ServiceOperation.cs
- StartUpEventArgs.cs
- NavigationProperty.cs
- TraceListener.cs
- TextEditorThreadLocalStore.cs
- HttpDictionary.cs
- Context.cs
- WindowsFormsHostPropertyMap.cs
- IIS7WorkerRequest.cs
- PropertyDescriptorCollection.cs
- NamedPermissionSet.cs
- WebPartDisplayModeCancelEventArgs.cs
- PassportPrincipal.cs
- ToolStripOverflowButton.cs
- shaperfactory.cs
- RegexCaptureCollection.cs
- ConnectionConsumerAttribute.cs
- CompositeActivityMarkupSerializer.cs
- TagMapCollection.cs
- ServiceModelSecurityTokenRequirement.cs