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
- EventMappingSettings.cs
- X509CertificateCollection.cs
- StyleBamlTreeBuilder.cs
- DataGridViewComboBoxEditingControl.cs
- LogSwitch.cs
- DocumentXPathNavigator.cs
- Odbc32.cs
- UrlMappingsSection.cs
- Query.cs
- TypeExtensionConverter.cs
- HostProtectionException.cs
- Wildcard.cs
- MailFileEditor.cs
- ClockController.cs
- mediaeventargs.cs
- ListenerElementsCollection.cs
- KerberosTokenFactoryCredential.cs
- DocumentGridContextMenu.cs
- NavigationPropertyEmitter.cs
- RangeValueProviderWrapper.cs
- MetadataArtifactLoaderFile.cs
- NameService.cs
- Baml6ConstructorInfo.cs
- EpmCustomContentDeSerializer.cs
- PageFunction.cs
- DirectoryNotFoundException.cs
- DefaultBinder.cs
- CapabilitiesRule.cs
- WebOperationContext.cs
- ButtonStandardAdapter.cs
- QilTargetType.cs
- ThreadStartException.cs
- ThicknessAnimationUsingKeyFrames.cs
- MappedMetaModel.cs
- ImageKeyConverter.cs
- X509CertificateValidator.cs
- SrgsGrammar.cs
- MatrixTransform.cs
- PostBackOptions.cs
- DriveNotFoundException.cs
- SqlBinder.cs
- PermissionAttributes.cs
- DirectionalLight.cs
- HostedTcpTransportManager.cs
- ContainerActivationHelper.cs
- ValidationErrorInfo.cs
- PermissionToken.cs
- DataObject.cs
- ImportedNamespaceContextItem.cs
- ApplicationSettingsBase.cs
- TablePatternIdentifiers.cs
- RequestBringIntoViewEventArgs.cs
- SqlProviderManifest.cs
- UnrecognizedAssertionsBindingElement.cs
- NotFiniteNumberException.cs
- BrowserCapabilitiesCompiler.cs
- CompensatableTransactionScopeActivity.cs
- ClientOptions.cs
- Variable.cs
- WebPartMenuStyle.cs
- ApplicationCommands.cs
- TreeNodeEventArgs.cs
- CompilationSection.cs
- AbandonedMutexException.cs
- InkCanvasSelection.cs
- TextHidden.cs
- LocalValueEnumerator.cs
- TreeNode.cs
- Vector.cs
- RepeatInfo.cs
- SafeWaitHandle.cs
- PenThreadWorker.cs
- MultiPageTextView.cs
- ZipIOExtraFieldElement.cs
- XmlNamespaceManager.cs
- TypedAsyncResult.cs
- BuiltInExpr.cs
- SiteMapNodeCollection.cs
- DataGridViewRowHeaderCell.cs
- TableItemPattern.cs
- MetadataPropertyvalue.cs
- MultipartContentParser.cs
- XmlStreamNodeWriter.cs
- NavigationPropertyEmitter.cs
- ViewStateChangedEventArgs.cs
- WorkflowInstanceTerminatedRecord.cs
- SettingsPropertyIsReadOnlyException.cs
- SpotLight.cs
- Stroke.cs
- ErrorProvider.cs
- HtmlHead.cs
- XPathMultyIterator.cs
- webbrowsersite.cs
- CompositeDataBoundControl.cs
- SafeCryptHandles.cs
- RuntimeHandles.cs
- DataContractSerializerOperationFormatter.cs
- SwitchLevelAttribute.cs
- UiaCoreProviderApi.cs
- DataGridViewLinkColumn.cs