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
- BindingManagerDataErrorEventArgs.cs
- NativeMethodsCLR.cs
- WeakHashtable.cs
- CodeNamespaceImportCollection.cs
- MimeFormatter.cs
- SelectionWordBreaker.cs
- FontResourceCache.cs
- sqlmetadatafactory.cs
- ConfigUtil.cs
- WebServiceBindingAttribute.cs
- _ScatterGatherBuffers.cs
- UserControlAutomationPeer.cs
- Point4DValueSerializer.cs
- HtmlInputButton.cs
- Quad.cs
- ActiveXSite.cs
- uribuilder.cs
- SqlLiftWhereClauses.cs
- APCustomTypeDescriptor.cs
- AnonymousIdentificationModule.cs
- dbdatarecord.cs
- HebrewNumber.cs
- UnicastIPAddressInformationCollection.cs
- SQLInt16Storage.cs
- XmlUtil.cs
- XmlSerializerAssemblyAttribute.cs
- ScaleTransform.cs
- NetSectionGroup.cs
- SqlServices.cs
- TextServicesCompartmentContext.cs
- Common.cs
- FrameworkElementFactoryMarkupObject.cs
- SerializationFieldInfo.cs
- XmlSchemas.cs
- SiteMapNode.cs
- ConfigurationManagerInternal.cs
- DatePickerTextBox.cs
- RoleGroupCollectionEditor.cs
- RightNameExpirationInfoPair.cs
- ChineseLunisolarCalendar.cs
- ToolStripDropDown.cs
- SqlMetaData.cs
- ByteConverter.cs
- IncomingWebRequestContext.cs
- MessageRpc.cs
- ConfigurationSchemaErrors.cs
- ConstructorBuilder.cs
- TraceInternal.cs
- PropertyIDSet.cs
- CollectionBase.cs
- BaseTemplateBuildProvider.cs
- DependencyObject.cs
- MemoryMappedView.cs
- KnownBoxes.cs
- MetaType.cs
- DataGridViewColumnStateChangedEventArgs.cs
- LinqMaximalSubtreeNominator.cs
- CompilerParameters.cs
- ComponentResourceKeyConverter.cs
- ProviderMetadata.cs
- XmlSchemas.cs
- MemberPath.cs
- SmtpException.cs
- SmiContext.cs
- NamedPipeTransportSecurityElement.cs
- CodeIndexerExpression.cs
- COM2FontConverter.cs
- TextServicesLoader.cs
- UnsafePeerToPeerMethods.cs
- FindCompletedEventArgs.cs
- MediaPlayer.cs
- AppDomainManager.cs
- RoleGroupCollection.cs
- DbgUtil.cs
- DocumentViewer.cs
- DescendentsWalkerBase.cs
- ListChangedEventArgs.cs
- HttpListenerRequest.cs
- WindowsStartMenu.cs
- PasswordPropertyTextAttribute.cs
- FontClient.cs
- OleDbSchemaGuid.cs
- DomainUpDown.cs
- XmlSchemaSet.cs
- SerialErrors.cs
- MetadataItemCollectionFactory.cs
- CounterSampleCalculator.cs
- PackagePart.cs
- OdbcReferenceCollection.cs
- SecurityDescriptor.cs
- QilInvokeLateBound.cs
- SignatureToken.cs
- HttpPostProtocolImporter.cs
- ExceptionHelpers.cs
- BindingBase.cs
- ElementHostAutomationPeer.cs
- ObjectDataSourceMethodEventArgs.cs
- PerfCounters.cs
- KeyMatchBuilder.cs
- ServiceObjectContainer.cs