Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Security / X509CertificateRecipientServiceCredential.cs / 1 / X509CertificateRecipientServiceCredential.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.ServiceModel.Security { using System.Collections.Generic; using System.ServiceModel; using System.IdentityModel.Selectors; using System.Runtime.Serialization; using System.Net; using System.ServiceModel.Channels; using System.Security.Principal; using System.ServiceModel.Security.Tokens; using System.Security.Cryptography.X509Certificates; using System.Web.Security; public sealed class X509CertificateRecipientServiceCredential { X509Certificate2 certificate; internal const StoreLocation DefaultStoreLocation = StoreLocation.LocalMachine; internal const StoreName DefaultStoreName = StoreName.My; internal const X509FindType DefaultFindType = X509FindType.FindBySubjectDistinguishedName; bool isReadOnly; internal X509CertificateRecipientServiceCredential() { } internal X509CertificateRecipientServiceCredential(X509CertificateRecipientServiceCredential other) { this.certificate = other.certificate; this.isReadOnly = other.isReadOnly; } public X509Certificate2 Certificate { get { return this.certificate; } set { ThrowIfImmutable(); this.certificate = value; } } public void SetCertificate(string subjectName) { this.SetCertificate(subjectName, DefaultStoreLocation, DefaultStoreName); } public void SetCertificate(string subjectName, StoreLocation storeLocation, StoreName storeName) { if (subjectName == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("subjectName"); } this.SetCertificate(storeLocation, storeName, DefaultFindType, subjectName); } public void SetCertificate(StoreLocation storeLocation, StoreName storeName, X509FindType findType, object findValue) { if (findValue == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("findValue"); } ThrowIfImmutable(); this.certificate = SecurityUtils.GetCertificateFromStore(storeName, storeLocation, findType, findValue, null); } internal void MakeReadOnly() { this.isReadOnly = true; } void ThrowIfImmutable() { if (this.isReadOnly) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.ObjectIsReadOnly))); } } } } // 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
- RunInstallerAttribute.cs
- ExpressionTable.cs
- Timer.cs
- SspiWrapper.cs
- UrlMappingsSection.cs
- GenericRootAutomationPeer.cs
- CachedFontFamily.cs
- VisualBasicSettingsHandler.cs
- InternalResources.cs
- SimplePropertyEntry.cs
- ArrayConverter.cs
- SafePEFileHandle.cs
- StringUtil.cs
- figurelengthconverter.cs
- JsonReaderDelegator.cs
- EditorZoneBase.cs
- CodeAttributeArgument.cs
- AttachedPropertyBrowsableForTypeAttribute.cs
- Rect3D.cs
- ToolBar.cs
- NetCodeGroup.cs
- XmlDataSourceView.cs
- IndependentAnimationStorage.cs
- Debug.cs
- VBIdentifierDesigner.xaml.cs
- CustomAttributeFormatException.cs
- ColorKeyFrameCollection.cs
- DrawingCollection.cs
- smtppermission.cs
- PriorityQueue.cs
- DataColumnPropertyDescriptor.cs
- SelectorAutomationPeer.cs
- DataGridViewCellStyle.cs
- ParsedAttributeCollection.cs
- DiagnosticEventProvider.cs
- FunctionImportMapping.cs
- HostedTransportConfigurationBase.cs
- Point4DValueSerializer.cs
- Console.cs
- VirtualPath.cs
- ReflectEventDescriptor.cs
- EntryWrittenEventArgs.cs
- QilScopedVisitor.cs
- CachedFontFace.cs
- IDictionary.cs
- EntityContainerEmitter.cs
- TreeNodeMouseHoverEvent.cs
- LinqDataSourceInsertEventArgs.cs
- CommandValueSerializer.cs
- DayRenderEvent.cs
- DbModificationCommandTree.cs
- DescriptionCreator.cs
- SByteStorage.cs
- TextCollapsingProperties.cs
- BackgroundWorker.cs
- StringValidator.cs
- EnvelopedPkcs7.cs
- DropShadowEffect.cs
- X509SecurityTokenProvider.cs
- TextElementEditingBehaviorAttribute.cs
- SiteMapPath.cs
- ControlCachePolicy.cs
- BamlRecordHelper.cs
- ObjectItemCollectionAssemblyCacheEntry.cs
- ColorTranslator.cs
- WsatProxy.cs
- XmlAnyAttributeAttribute.cs
- OrderByBuilder.cs
- JsonReader.cs
- LateBoundBitmapDecoder.cs
- XsdBuildProvider.cs
- SqlLiftIndependentRowExpressions.cs
- WithParamAction.cs
- TextEvent.cs
- PriorityChain.cs
- ControlPaint.cs
- ThicknessAnimation.cs
- TcpClientSocketManager.cs
- TextTreeRootTextBlock.cs
- NotSupportedException.cs
- RenderingBiasValidation.cs
- InvalidOleVariantTypeException.cs
- FixedTextView.cs
- RowBinding.cs
- PropertyTabAttribute.cs
- EdmComplexPropertyAttribute.cs
- OracleRowUpdatedEventArgs.cs
- XLinq.cs
- ServiceManager.cs
- SQLMembershipProvider.cs
- Expression.cs
- DynamicDataRouteHandler.cs
- TransformConverter.cs
- SafeNativeMethodsCLR.cs
- TypeConverterHelper.cs
- OciEnlistContext.cs
- UserNameSecurityToken.cs
- Condition.cs
- ThreadPool.cs
- VisualBasic.cs