Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Configuration / X509ServiceCertificateAuthenticationElement.cs / 1 / X509ServiceCertificateAuthenticationElement.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.ServiceModel.Configuration { using System; using System.ServiceModel; using System.Configuration; using System.ServiceModel.Channels; using System.ServiceModel.Security; using System.Xml; using System.Security.Cryptography.X509Certificates; using System.IdentityModel.Selectors; public sealed partial class X509ServiceCertificateAuthenticationElement : ConfigurationElement { public X509ServiceCertificateAuthenticationElement() { } [ConfigurationProperty(ConfigurationStrings.CustomCertificateValidatorType, DefaultValue = "")] [StringValidator(MinLength = 0)] public string CustomCertificateValidatorType { get { return (string)base[ConfigurationStrings.CustomCertificateValidatorType]; } set { if (String.IsNullOrEmpty(value)) { value = String.Empty; } base[ConfigurationStrings.CustomCertificateValidatorType] = value; } } [ConfigurationProperty(ConfigurationStrings.CertificateValidationMode, DefaultValue = X509ServiceCertificateAuthentication.DefaultCertificateValidationMode)] [ServiceModelEnumValidator(typeof(X509CertificateValidationModeHelper))] public X509CertificateValidationMode CertificateValidationMode { get { return (X509CertificateValidationMode)base[ConfigurationStrings.CertificateValidationMode]; } set { base[ConfigurationStrings.CertificateValidationMode] = value; } } [ConfigurationProperty(ConfigurationStrings.RevocationMode, DefaultValue = X509ServiceCertificateAuthentication.DefaultRevocationMode)] [StandardRuntimeEnumValidator(typeof(X509RevocationMode))] public X509RevocationMode RevocationMode { get { return (X509RevocationMode)base[ConfigurationStrings.RevocationMode]; } set { base[ConfigurationStrings.RevocationMode] = value; } } [ConfigurationProperty(ConfigurationStrings.TrustedStoreLocation, DefaultValue = X509ServiceCertificateAuthentication.DefaultTrustedStoreLocation)] [StandardRuntimeEnumValidator(typeof(StoreLocation))] public StoreLocation TrustedStoreLocation { get { return (StoreLocation)base[ConfigurationStrings.TrustedStoreLocation]; } set { base[ConfigurationStrings.TrustedStoreLocation] = value; } } public void Copy(X509ServiceCertificateAuthenticationElement from) { if (this.IsReadOnly()) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ConfigurationErrorsException(SR.GetString(SR.ConfigReadOnly))); } if (null == from) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("from"); } this.CertificateValidationMode = from.CertificateValidationMode; this.RevocationMode = from.RevocationMode; this.TrustedStoreLocation = from.TrustedStoreLocation; this.CustomCertificateValidatorType = from.CustomCertificateValidatorType; } internal void ApplyConfiguration(X509ServiceCertificateAuthentication cert) { if (cert == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("cert"); } cert.CertificateValidationMode = this.CertificateValidationMode; cert.RevocationMode = this.RevocationMode; cert.TrustedStoreLocation = this.TrustedStoreLocation; if (!string.IsNullOrEmpty(this.CustomCertificateValidatorType)) { Type validatorType = System.Type.GetType(this.CustomCertificateValidatorType, true); if (!typeof(X509CertificateValidator).IsAssignableFrom(validatorType)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ConfigurationErrorsException( SR.GetString(SR.ConfigInvalidCertificateValidatorType, this.CustomCertificateValidatorType, typeof(X509CertificateValidator).ToString()))); } cert.CustomCertificateValidator = (X509CertificateValidator)Activator.CreateInstance(validatorType); } } } } // 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
- InternalException.cs
- DbMetaDataFactory.cs
- ClientFormsAuthenticationMembershipProvider.cs
- UInt16.cs
- GridSplitterAutomationPeer.cs
- ToolStripItemClickedEventArgs.cs
- EmptyEnumerator.cs
- Merger.cs
- ResourceKey.cs
- FontFamilyIdentifier.cs
- CompressEmulationStream.cs
- EncryptionUtility.cs
- DesignerProperties.cs
- Pointer.cs
- AdapterUtil.cs
- CustomErrorCollection.cs
- XpsResourceDictionary.cs
- ClientUtils.cs
- PipelineComponent.cs
- WebHostUnsafeNativeMethods.cs
- SQlBooleanStorage.cs
- ProcessHostServerConfig.cs
- ElapsedEventArgs.cs
- EditingMode.cs
- DocumentViewerHelper.cs
- DbDataRecord.cs
- NonBatchDirectoryCompiler.cs
- Roles.cs
- BufferedReadStream.cs
- X509ClientCertificateAuthenticationElement.cs
- UrlAuthFailureHandler.cs
- entityreference_tresulttype.cs
- TimelineGroup.cs
- CodeAttributeArgumentCollection.cs
- counter.cs
- ToolStripMenuItemDesigner.cs
- DataGridViewCellValidatingEventArgs.cs
- XslTransform.cs
- IriParsingElement.cs
- DataTransferEventArgs.cs
- ButtonBase.cs
- DataRelationCollection.cs
- FixedPageAutomationPeer.cs
- AlphaSortedEnumConverter.cs
- DataGridItemEventArgs.cs
- WebHttpEndpointElement.cs
- BitmapEffectDrawingContextState.cs
- BoundPropertyEntry.cs
- PackageStore.cs
- SQLBinaryStorage.cs
- Token.cs
- WindowsGraphicsCacheManager.cs
- ScrollItemPattern.cs
- ExtendedProtectionPolicyTypeConverter.cs
- SID.cs
- RegexCapture.cs
- DoubleLinkListEnumerator.cs
- CodeTypeDelegate.cs
- ScrollData.cs
- ExplicitDiscriminatorMap.cs
- TagPrefixAttribute.cs
- ClassData.cs
- GridViewRowEventArgs.cs
- FormatConvertedBitmap.cs
- TextPointerBase.cs
- KeyValueConfigurationCollection.cs
- StylusShape.cs
- ExpressionParser.cs
- NativeMethods.cs
- Button.cs
- ECDiffieHellmanCngPublicKey.cs
- Matrix3DConverter.cs
- SchemaImporterExtension.cs
- TraceInternal.cs
- VisualStyleInformation.cs
- XmlNamespaceMapping.cs
- GroupQuery.cs
- SequentialOutput.cs
- WindowClosedEventArgs.cs
- SQLDateTime.cs
- DbModificationClause.cs
- Helpers.cs
- WebBrowser.cs
- ContentControl.cs
- ProgressBarHighlightConverter.cs
- TextTabProperties.cs
- ConfigurationCollectionAttribute.cs
- SignatureHelper.cs
- HierarchicalDataBoundControl.cs
- DupHandleConnectionReader.cs
- NameValueCollection.cs
- LongValidatorAttribute.cs
- DataFormat.cs
- Emitter.cs
- PageBorderless.cs
- DocumentStream.cs
- WebRequestModuleElement.cs
- XmlCDATASection.cs
- WindowsPen.cs
- NumberAction.cs