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
- XamlToRtfWriter.cs
- BulletedListEventArgs.cs
- TitleStyle.cs
- DynamicFilter.cs
- GB18030Encoding.cs
- DesigntimeLicenseContextSerializer.cs
- GenericUriParser.cs
- RunInstallerAttribute.cs
- QuestionEventArgs.cs
- OptimisticConcurrencyException.cs
- DataQuery.cs
- TraceListeners.cs
- coordinatorfactory.cs
- _LocalDataStore.cs
- QuaternionAnimationUsingKeyFrames.cs
- DataGridViewRow.cs
- TimeIntervalCollection.cs
- NullableConverter.cs
- EntityContainerEntitySet.cs
- WebCategoryAttribute.cs
- Point3DKeyFrameCollection.cs
- XslTransform.cs
- StrokeNode.cs
- LocalizedNameDescriptionPair.cs
- MessageQueueAccessControlEntry.cs
- AssemblyName.cs
- _AutoWebProxyScriptWrapper.cs
- SingleSelectRootGridEntry.cs
- EventData.cs
- ObjectListShowCommandsEventArgs.cs
- UnknownBitmapDecoder.cs
- XmlDocumentFieldSchema.cs
- TypeElement.cs
- Tuple.cs
- ArraySubsetEnumerator.cs
- OSFeature.cs
- SqlUtils.cs
- WinEventTracker.cs
- OutputCacheSettingsSection.cs
- ListViewItem.cs
- BrowserCapabilitiesFactoryBase.cs
- Token.cs
- SHA512CryptoServiceProvider.cs
- AssemblySettingAttributes.cs
- WMIInterop.cs
- DynamicResourceExtension.cs
- _HTTPDateParse.cs
- RequiredAttributeAttribute.cs
- QueryAccessibilityHelpEvent.cs
- TraceContextRecord.cs
- ImageMapEventArgs.cs
- ResponseStream.cs
- ParameterCollectionEditor.cs
- MemberAccessException.cs
- XmlObjectSerializerContext.cs
- PathFigureCollection.cs
- FreezableDefaultValueFactory.cs
- CompoundFileDeflateTransform.cs
- TypedServiceOperationListItem.cs
- APCustomTypeDescriptor.cs
- BuilderInfo.cs
- XmlNavigatorStack.cs
- ProgressiveCrcCalculatingStream.cs
- HttpServerUtilityBase.cs
- NotCondition.cs
- ViewStateException.cs
- RefreshEventArgs.cs
- NamespaceCollection.cs
- InputEventArgs.cs
- IMembershipProvider.cs
- FrameworkContentElementAutomationPeer.cs
- FileVersionInfo.cs
- WebPartMenuStyle.cs
- Drawing.cs
- EnvironmentPermission.cs
- UInt64Storage.cs
- ConsumerConnectionPoint.cs
- CompilerScope.cs
- Single.cs
- UnmanagedMarshal.cs
- Label.cs
- SystemPens.cs
- CircleHotSpot.cs
- NGCSerializationManagerAsync.cs
- ConsoleTraceListener.cs
- CommandPlan.cs
- CategoriesDocument.cs
- FileCodeGroup.cs
- Command.cs
- ServiceRouteHandler.cs
- DataReceivedEventArgs.cs
- PackageRelationship.cs
- SineEase.cs
- MasterPageParser.cs
- SimpleMailWebEventProvider.cs
- serverconfig.cs
- _FtpDataStream.cs
- BinaryFormatter.cs
- ArgumentException.cs
- Compiler.cs