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
- cookie.cs
- HierarchicalDataSourceControl.cs
- FormattedTextSymbols.cs
- ContainerActivationHelper.cs
- DataControlFieldTypeEditor.cs
- StylusPointPropertyId.cs
- ScriptServiceAttribute.cs
- MimeBasePart.cs
- BehaviorEditorPart.cs
- WebEventCodes.cs
- DataGridViewTextBoxColumn.cs
- ExpressionWriter.cs
- HttpMethodConstraint.cs
- BStrWrapper.cs
- AffineTransform3D.cs
- SmtpLoginAuthenticationModule.cs
- XmlSchemaSimpleContentExtension.cs
- ServiceElementCollection.cs
- BamlRecordHelper.cs
- TranslateTransform.cs
- EventArgs.cs
- Fx.cs
- EmptyQuery.cs
- DesignerOptions.cs
- XmlArrayItemAttribute.cs
- BitmapScalingModeValidation.cs
- SortedSetDebugView.cs
- Keywords.cs
- DataException.cs
- StyleConverter.cs
- BaseValidator.cs
- NonParentingControl.cs
- IntersectQueryOperator.cs
- PipelineModuleStepContainer.cs
- XpsInterleavingPolicy.cs
- TextServicesPropertyRanges.cs
- SiteMapNode.cs
- Exception.cs
- WebServiceParameterData.cs
- RtfToken.cs
- ExpressionBuilder.cs
- MergeExecutor.cs
- TextTreeRootNode.cs
- CodeDelegateCreateExpression.cs
- InheritedPropertyChangedEventArgs.cs
- BinaryObjectInfo.cs
- EntityDesignerDataSourceView.cs
- HostedImpersonationContext.cs
- ExtentJoinTreeNode.cs
- Marshal.cs
- UIElementHelper.cs
- RecognitionEventArgs.cs
- CompModSwitches.cs
- Rotation3D.cs
- HttpInputStream.cs
- ListDataBindEventArgs.cs
- TemplateNameScope.cs
- CompareValidator.cs
- RequestQueryProcessor.cs
- CompilationSection.cs
- Brush.cs
- CroppedBitmap.cs
- CancelRequestedRecord.cs
- SqlAliaser.cs
- DataControlLinkButton.cs
- SwitchElementsCollection.cs
- FontSizeConverter.cs
- TypeSystemProvider.cs
- HtmlInputPassword.cs
- CurrentChangingEventArgs.cs
- ReadContentAsBinaryHelper.cs
- HttpCachePolicyElement.cs
- Pkcs7Signer.cs
- TextEditorParagraphs.cs
- AssemblyBuilderData.cs
- ToolStripOverflow.cs
- XmlSchemaInclude.cs
- PtsHost.cs
- Delegate.cs
- SemanticResultValue.cs
- InkCollectionBehavior.cs
- Win32.cs
- EntityDataSourceChangedEventArgs.cs
- RangeValidator.cs
- AppearanceEditorPart.cs
- StrokeRenderer.cs
- DataRecordInternal.cs
- TableMethodGenerator.cs
- SelectionItemPattern.cs
- DynamicActivityProperty.cs
- mediaeventshelper.cs
- Message.cs
- DbParameterCollectionHelper.cs
- SafeRightsManagementSessionHandle.cs
- HtmlGenericControl.cs
- EventProviderBase.cs
- TableCellCollection.cs
- StyleBamlTreeBuilder.cs
- ArraySegment.cs
- RegexNode.cs