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
- TemplatePropertyEntry.cs
- MarkupProperty.cs
- ApplicationDirectoryMembershipCondition.cs
- GradientBrush.cs
- SqlCacheDependency.cs
- ContextMenuStripActionList.cs
- DataGridViewCellStyle.cs
- XmlAttributeCollection.cs
- FacetEnabledSchemaElement.cs
- XpsStructure.cs
- ZipIOExtraFieldPaddingElement.cs
- ThreadStateException.cs
- FamilyTypefaceCollection.cs
- SafeNativeMethodsOther.cs
- PtsPage.cs
- DynamicResourceExtensionConverter.cs
- ValueType.cs
- SpinLock.cs
- PreviewPrintController.cs
- MailMessageEventArgs.cs
- ListView.cs
- SchemaCollectionPreprocessor.cs
- CodeDOMProvider.cs
- TraceLog.cs
- xmlglyphRunInfo.cs
- unsafenativemethodsother.cs
- XPathParser.cs
- DynamicQueryableWrapper.cs
- XmlTypeMapping.cs
- ResourceSet.cs
- HttpHeaderCollection.cs
- Process.cs
- MethodSignatureGenerator.cs
- DetailsViewInsertEventArgs.cs
- FactoryMaker.cs
- DesignerCatalogPartChrome.cs
- PropertyGeneratedEventArgs.cs
- BamlTreeNode.cs
- ComPlusSynchronizationContext.cs
- Rfc2898DeriveBytes.cs
- DynamicValueConverter.cs
- Stream.cs
- StringConverter.cs
- NativeMethods.cs
- DynamicQueryableWrapper.cs
- Sequence.cs
- CollectionBuilder.cs
- OperationFormatUse.cs
- CompressionTransform.cs
- DbDataRecord.cs
- BuildProvider.cs
- GroupBoxRenderer.cs
- PackageRelationship.cs
- Int32RectValueSerializer.cs
- UIAgentMonitorHandle.cs
- SecurityTimestamp.cs
- SpeakInfo.cs
- CompressedStack.cs
- OrderedDictionaryStateHelper.cs
- XmlSchemaSimpleContentExtension.cs
- XPathAxisIterator.cs
- ContextMenuService.cs
- SmiEventSink_DeferedProcessing.cs
- GroupByExpressionRewriter.cs
- SafeSecurityHelper.cs
- SvcFileManager.cs
- Animatable.cs
- Ray3DHitTestResult.cs
- EndpointAddressProcessor.cs
- ListViewVirtualItemsSelectionRangeChangedEvent.cs
- WizardStepBase.cs
- HashMembershipCondition.cs
- CancellationHandlerDesigner.cs
- AsyncParams.cs
- ScrollViewer.cs
- GeneratedContractType.cs
- RuleEngine.cs
- DateTime.cs
- JsonReaderDelegator.cs
- XdrBuilder.cs
- DrawToolTipEventArgs.cs
- Operators.cs
- DesignTimeTemplateParser.cs
- EditorZoneBase.cs
- CodeTypeDeclaration.cs
- EntityContainerAssociationSet.cs
- TimeSpanSecondsOrInfiniteConverter.cs
- ResourceDefaultValueAttribute.cs
- HttpCapabilitiesSectionHandler.cs
- RecordConverter.cs
- GeometryModel3D.cs
- AdapterSwitches.cs
- nulltextnavigator.cs
- RemoveFromCollection.cs
- FactoryId.cs
- PopOutPanel.cs
- IfAction.cs
- ThreadInterruptedException.cs
- CodeGotoStatement.cs
- ObjectView.cs