Code:
/ 4.0 / 4.0 / untmp / 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- TextSelectionHighlightLayer.cs
- MachineKeySection.cs
- EncoderFallback.cs
- CmsInterop.cs
- SiblingIterators.cs
- ProvidersHelper.cs
- ProfileProvider.cs
- ZipIOExtraField.cs
- Invariant.cs
- ConfigurationSettings.cs
- VersionPair.cs
- DataServiceQueryProvider.cs
- ItemsControl.cs
- ModelItemCollectionImpl.cs
- ConstantCheck.cs
- RepeaterItemCollection.cs
- HtmlTableRow.cs
- LinkLabel.cs
- ElementProxy.cs
- MarkupProperty.cs
- AuthenticationException.cs
- CryptoStream.cs
- EmptyControlCollection.cs
- PagesSection.cs
- SqlRemoveConstantOrderBy.cs
- PrePostDescendentsWalker.cs
- StringValueSerializer.cs
- XpsS0ValidatingLoader.cs
- OdbcError.cs
- ObjectDataSourceDisposingEventArgs.cs
- XPathNavigatorReader.cs
- StreamGeometry.cs
- TextFormatterImp.cs
- PerformanceCountersElement.cs
- HealthMonitoringSectionHelper.cs
- NativeMethodsOther.cs
- ModelVisual3D.cs
- safex509handles.cs
- ClientRoleProvider.cs
- SqlXmlStorage.cs
- CheckBoxField.cs
- EnumConverter.cs
- ApplicationManager.cs
- MemberCollection.cs
- UseAttributeSetsAction.cs
- CallContext.cs
- TextBlock.cs
- ZipIOEndOfCentralDirectoryBlock.cs
- MemberPath.cs
- QualifierSet.cs
- PropertyPathWorker.cs
- GenericWebPart.cs
- ConnectionManagementElement.cs
- ScriptControlManager.cs
- ReachSerializer.cs
- ListBoxChrome.cs
- MultiView.cs
- CompositeControl.cs
- SmtpFailedRecipientException.cs
- RtfToXamlLexer.cs
- mda.cs
- RealizedColumnsBlock.cs
- HierarchicalDataTemplate.cs
- Win32SafeHandles.cs
- WebRequestModulesSection.cs
- IndexedGlyphRun.cs
- StructuredCompositeActivityDesigner.cs
- wpf-etw.cs
- DrawingBrush.cs
- TypeConverterAttribute.cs
- SqlNotificationEventArgs.cs
- SafeHandles.cs
- RequestCachingSection.cs
- ReflectionUtil.cs
- ColorIndependentAnimationStorage.cs
- ArcSegment.cs
- JoinTreeSlot.cs
- LocalizationParserHooks.cs
- System.Data_BID.cs
- SplashScreenNativeMethods.cs
- DecoderFallback.cs
- XmlArrayItemAttribute.cs
- PrintingPermission.cs
- SQLMoneyStorage.cs
- Convert.cs
- storepermission.cs
- DetailsViewUpdateEventArgs.cs
- DefaultHttpHandler.cs
- _NestedSingleAsyncResult.cs
- TextRunProperties.cs
- BinaryObjectWriter.cs
- IPEndPoint.cs
- SQLBinaryStorage.cs
- HtmlInputHidden.cs
- StandardBindingCollectionElement.cs
- Section.cs
- CodeAssignStatement.cs
- ToolStripScrollButton.cs
- SplitterCancelEvent.cs
- MarkupExtensionParser.cs