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
- ScrollChrome.cs
- ImageField.cs
- SafeTokenHandle.cs
- BamlRecordHelper.cs
- DBDataPermissionAttribute.cs
- SQLGuidStorage.cs
- ObjectDataSourceStatusEventArgs.cs
- DataGridGeneralPage.cs
- StandardBindingImporter.cs
- Vector3DAnimation.cs
- ProxyWebPartManager.cs
- EnumerableRowCollection.cs
- AddInDeploymentState.cs
- ObjectItemCollection.cs
- QilCloneVisitor.cs
- LongValidatorAttribute.cs
- MultilineStringConverter.cs
- OdbcConnectionHandle.cs
- NameSpaceEvent.cs
- FileIOPermission.cs
- ContentOperations.cs
- ToolStripStatusLabel.cs
- KeyTime.cs
- PopupRootAutomationPeer.cs
- TdsParserStaticMethods.cs
- FailedToStartupUIException.cs
- ElementProxy.cs
- FormCollection.cs
- CategoriesDocument.cs
- ArrayConverter.cs
- ProfileModule.cs
- PointCollection.cs
- MatrixConverter.cs
- ByteAnimationUsingKeyFrames.cs
- HttpModulesSection.cs
- NavigationHelper.cs
- CapabilitiesPattern.cs
- SamlSubject.cs
- NegationPusher.cs
- LinqDataSource.cs
- XmlSchemaSet.cs
- ObfuscateAssemblyAttribute.cs
- MachineSettingsSection.cs
- BoundingRectTracker.cs
- PropertyMapper.cs
- DetailsViewInsertEventArgs.cs
- StatusBarDrawItemEvent.cs
- XmlBoundElement.cs
- OperationFormatUse.cs
- DrawingVisualDrawingContext.cs
- Model3D.cs
- LocationSectionRecord.cs
- GroupBox.cs
- DataSourceProvider.cs
- Oci.cs
- DecimalStorage.cs
- SystemColors.cs
- DataGridViewCellPaintingEventArgs.cs
- TileBrush.cs
- DecimalConverter.cs
- HttpValueCollection.cs
- StrongNameUtility.cs
- DesignerForm.cs
- Overlapped.cs
- WebPartTransformer.cs
- TableTextElementCollectionInternal.cs
- FormatControl.cs
- MarkupCompilePass2.cs
- ToggleButton.cs
- SequenceDesigner.cs
- CSharpCodeProvider.cs
- Security.cs
- recordstatefactory.cs
- IsolatedStorageException.cs
- LinqDataSourceStatusEventArgs.cs
- ADRole.cs
- ToggleButton.cs
- TraceUtils.cs
- ALinqExpressionVisitor.cs
- _KerberosClient.cs
- WebBodyFormatMessageProperty.cs
- TypeDependencyAttribute.cs
- PropertyGeneratedEventArgs.cs
- UserControlCodeDomTreeGenerator.cs
- ListViewTableCell.cs
- GridViewRowPresenterBase.cs
- ChildDocumentBlock.cs
- FastEncoderWindow.cs
- UnicodeEncoding.cs
- InternalBufferManager.cs
- Rectangle.cs
- EntityViewGenerationAttribute.cs
- XmlSchemaValidator.cs
- StretchValidation.cs
- BackStopAuthenticationModule.cs
- cookieexception.cs
- WebPartConnectionsConfigureVerb.cs
- mediaeventargs.cs
- DataSourceCacheDurationConverter.cs
- ReadOnlyHierarchicalDataSourceView.cs