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
- ComplexLine.cs
- _FixedSizeReader.cs
- UserControlCodeDomTreeGenerator.cs
- log.cs
- InputScopeNameConverter.cs
- DataKeyPropertyAttribute.cs
- SqlReorderer.cs
- ItemAutomationPeer.cs
- SettingsProviderCollection.cs
- OleAutBinder.cs
- ZipIOCentralDirectoryFileHeader.cs
- DataGridViewButtonCell.cs
- DataListItem.cs
- SafeSystemMetrics.cs
- Composition.cs
- HttpHandlersSection.cs
- SafeEventLogWriteHandle.cs
- FunctionUpdateCommand.cs
- RequestQueue.cs
- PropertyPanel.cs
- EventDescriptor.cs
- MemberExpression.cs
- StrokeCollectionConverter.cs
- WinFormsSpinner.cs
- ToolStripComboBox.cs
- SystemTcpConnection.cs
- XmlAnyAttributeAttribute.cs
- ListContractAdapter.cs
- CqlLexer.cs
- WasEndpointConfigContainer.cs
- AggregateException.cs
- XhtmlConformanceSection.cs
- ToolStripDropTargetManager.cs
- OAVariantLib.cs
- HttpModuleAction.cs
- DescendantOverDescendantQuery.cs
- TemplateLookupAction.cs
- Image.cs
- SoapReflectionImporter.cs
- ThreadInterruptedException.cs
- DataGridRowEventArgs.cs
- QilList.cs
- StylusPointProperties.cs
- BitmapEffectGroup.cs
- TagMapCollection.cs
- DataGridTablesFactory.cs
- __FastResourceComparer.cs
- EntityContainer.cs
- PrimitiveXmlSerializers.cs
- SimpleTypeResolver.cs
- XmlUnspecifiedAttribute.cs
- ToRequest.cs
- QuadraticEase.cs
- PrinterResolution.cs
- CustomCredentialPolicy.cs
- CustomValidator.cs
- DynamicEntity.cs
- ISO2022Encoding.cs
- PartialList.cs
- SortAction.cs
- TaskHelper.cs
- UrlAuthorizationModule.cs
- ConsumerConnectionPoint.cs
- ReferenceConverter.cs
- ImageField.cs
- StrokeNodeOperations.cs
- IListConverters.cs
- IFlowDocumentViewer.cs
- SmtpFailedRecipientException.cs
- XmlNodeComparer.cs
- ToolStripScrollButton.cs
- HttpProtocolReflector.cs
- ComboBox.cs
- SqlRetyper.cs
- SecurityProtocolFactory.cs
- DbModificationClause.cs
- RelationalExpressions.cs
- SpecularMaterial.cs
- isolationinterop.cs
- XmlTextReaderImplHelpers.cs
- ValidationEventArgs.cs
- WindowsScrollBar.cs
- CfgSemanticTag.cs
- Matrix.cs
- OleDragDropHandler.cs
- Transactions.cs
- WindowsListViewGroup.cs
- QilPatternVisitor.cs
- DictionaryChange.cs
- ObjectDataSourceStatusEventArgs.cs
- Application.cs
- DefaultValueConverter.cs
- UseAttributeSetsAction.cs
- DropDownList.cs
- DataGridViewComboBoxColumnDesigner.cs
- DefaultHttpHandler.cs
- PageAsyncTaskManager.cs
- EdmScalarPropertyAttribute.cs
- LoginView.cs
- DrawTreeNodeEventArgs.cs