Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / IdentityModel / System / IdentityModel / Tokens / EncryptedKeyIdentifierClause.cs / 1 / 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- Environment.cs
- Group.cs
- ContentElement.cs
- DataFormats.cs
- SqlCommandBuilder.cs
- RTTypeWrapper.cs
- TemplateBindingExtension.cs
- Claim.cs
- ClientSettingsSection.cs
- RegexNode.cs
- ZipIORawDataFileBlock.cs
- ResourcePermissionBase.cs
- URL.cs
- Int32Storage.cs
- HebrewCalendar.cs
- Header.cs
- VariantWrapper.cs
- IgnoreFileBuildProvider.cs
- GenericUriParser.cs
- ControlEvent.cs
- ToolboxComponentsCreatingEventArgs.cs
- ContextMenu.cs
- ArrayExtension.cs
- WrappingXamlSchemaContext.cs
- AutoResetEvent.cs
- C14NUtil.cs
- PauseStoryboard.cs
- InstanceStoreQueryResult.cs
- SecurityException.cs
- WindowsGraphicsCacheManager.cs
- CurrencyManager.cs
- HttpApplicationStateBase.cs
- StrokeNode.cs
- InkPresenter.cs
- ProgressBar.cs
- Lazy.cs
- DataGridViewCellParsingEventArgs.cs
- DataGridViewToolTip.cs
- DetailsViewInsertEventArgs.cs
- SqlFormatter.cs
- PropertyRef.cs
- WebSysDescriptionAttribute.cs
- RectangleHotSpot.cs
- ValidationSummary.cs
- SQLString.cs
- SecurityContext.cs
- coordinator.cs
- LogLogRecord.cs
- Camera.cs
- EnumMember.cs
- RegexCapture.cs
- FillRuleValidation.cs
- OdbcTransaction.cs
- SrgsRulesCollection.cs
- SqlDataSourceCache.cs
- MetadataProperty.cs
- DataGridViewToolTip.cs
- Base64Decoder.cs
- PointLightBase.cs
- HistoryEventArgs.cs
- Polygon.cs
- PeerObject.cs
- ProxyAttribute.cs
- SerializerProvider.cs
- CodeMemberField.cs
- ScriptingRoleServiceSection.cs
- _SSPIWrapper.cs
- XXXOnTypeBuilderInstantiation.cs
- OleDbDataAdapter.cs
- XmlComplianceUtil.cs
- SqlTransaction.cs
- SizeConverter.cs
- Control.cs
- TypeDescriptorFilterService.cs
- LayoutEditorPart.cs
- OutOfMemoryException.cs
- PanelDesigner.cs
- Command.cs
- RuntimeVariablesExpression.cs
- PrivateFontCollection.cs
- PerformanceCounter.cs
- DbTypeMap.cs
- TableLayoutSettingsTypeConverter.cs
- GridToolTip.cs
- ListControlConvertEventArgs.cs
- DependsOnAttribute.cs
- HttpClientCertificate.cs
- Timer.cs
- RoleGroup.cs
- CommandConverter.cs
- SafeFileMappingHandle.cs
- HideDisabledControlAdapter.cs
- SortedList.cs
- ErrorHandler.cs
- Selection.cs
- TitleStyle.cs
- DataServiceClientException.cs
- SystemIPv6InterfaceProperties.cs
- MappingMetadataHelper.cs
- PropertyEmitterBase.cs