Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Security / X509CertificateInitiatorServiceCredential.cs / 1 / X509CertificateInitiatorServiceCredential.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.Security.Principal; using System.ServiceModel.Security.Tokens; using System.Security.Cryptography.X509Certificates; using System.Web.Security; public sealed class X509CertificateInitiatorServiceCredential { internal const StoreLocation DefaultStoreLocation = StoreLocation.LocalMachine; internal const StoreName DefaultStoreName = StoreName.My; internal const X509FindType DefaultFindType = X509FindType.FindBySubjectDistinguishedName; X509Certificate2 certificate; X509ClientCertificateAuthentication authentication; bool isReadOnly; internal X509CertificateInitiatorServiceCredential() { this.authentication = new X509ClientCertificateAuthentication(); } internal X509CertificateInitiatorServiceCredential(X509CertificateInitiatorServiceCredential other) { this.certificate = other.certificate; this.authentication = new X509ClientCertificateAuthentication(other.authentication); this.isReadOnly = other.isReadOnly; } public X509Certificate2 Certificate { get { return this.certificate; } set { ThrowIfImmutable(); this.certificate = value; } } public X509ClientCertificateAuthentication Authentication { get { return this.authentication; } } 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; this.Authentication.MakeReadOnly(); } 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
- HtmlInputHidden.cs
- _DigestClient.cs
- VersionedStream.cs
- WebBrowserNavigatingEventHandler.cs
- SignatureToken.cs
- PageOutputQuality.cs
- VirtualPathUtility.cs
- CompositeScriptReferenceEventArgs.cs
- ConnectionStringsExpressionBuilder.cs
- CodeLabeledStatement.cs
- LightweightEntityWrapper.cs
- RoleManagerModule.cs
- RoleManagerModule.cs
- MetadataPropertyCollection.cs
- KerberosSecurityTokenProvider.cs
- StylusButtonEventArgs.cs
- Interlocked.cs
- InfoCardRSAPKCS1SignatureFormatter.cs
- TimeSpanSecondsConverter.cs
- ThreadExceptionDialog.cs
- PolicyException.cs
- TemplateKeyConverter.cs
- QilSortKey.cs
- AutoCompleteStringCollection.cs
- DesignConnectionCollection.cs
- MenuCommand.cs
- WindowsRebar.cs
- ObjectStateEntryOriginalDbUpdatableDataRecord.cs
- CodeGroup.cs
- RegexTree.cs
- XhtmlTextWriter.cs
- D3DImage.cs
- CircleHotSpot.cs
- BitmapEffectCollection.cs
- LineUtil.cs
- XmlAttributeCache.cs
- WindowsListBox.cs
- DllHostedComPlusServiceHost.cs
- FixedSOMPage.cs
- DbgCompiler.cs
- TdsParserStaticMethods.cs
- BoundsDrawingContextWalker.cs
- SafeThreadHandle.cs
- counter.cs
- HttpCacheVary.cs
- PreparingEnlistment.cs
- ControlUtil.cs
- DataSourceViewSchemaConverter.cs
- XmlEncodedRawTextWriter.cs
- WindowsUserNameCachingSecurityTokenAuthenticator.cs
- DataServiceProcessingPipeline.cs
- EpmContentDeSerializerBase.cs
- CodeSubDirectoriesCollection.cs
- VectorCollection.cs
- XmlAnyAttributeAttribute.cs
- UnmanagedHandle.cs
- SynchronizationScope.cs
- ColumnResult.cs
- EmbeddedMailObjectsCollection.cs
- AuthorizationSection.cs
- TypeResolvingOptions.cs
- GeneralTransform3DGroup.cs
- ConfigurationErrorsException.cs
- LifetimeServices.cs
- DataReceivedEventArgs.cs
- ObjectSecurity.cs
- SoapReflector.cs
- FileDataSourceCache.cs
- DeclarativeExpressionConditionDeclaration.cs
- RadioButtonAutomationPeer.cs
- StringWriter.cs
- StateMachineSubscriptionManager.cs
- XmlSchemas.cs
- ValidationErrorInfo.cs
- DrawingAttributeSerializer.cs
- XpsColorContext.cs
- ToolStripHighContrastRenderer.cs
- ZipIOFileItemStream.cs
- Script.cs
- DiffuseMaterial.cs
- ExpressionWriter.cs
- CompilerHelpers.cs
- StatusBarItemAutomationPeer.cs
- MouseCaptureWithinProperty.cs
- TableLayoutSettings.cs
- TextRenderer.cs
- JavaScriptSerializer.cs
- EncodingTable.cs
- CharacterBuffer.cs
- RTLAwareMessageBox.cs
- EntityProviderFactory.cs
- DynamicFilter.cs
- SetterTriggerConditionValueConverter.cs
- FollowerQueueCreator.cs
- SizeConverter.cs
- ToolStripRenderEventArgs.cs
- PlanCompiler.cs
- AssemblyAssociatedContentFileAttribute.cs
- ExpressionBindingsDialog.cs
- TripleDESCryptoServiceProvider.cs