Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Configuration / X509PeerCertificateAuthenticationElement.cs / 1 / X509PeerCertificateAuthenticationElement.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 X509PeerCertificateAuthenticationElement : ConfigurationElement { public X509PeerCertificateAuthenticationElement() { } [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 = X509PeerCertificateAuthentication.DefaultCertificateValidationMode)] [ServiceModelEnumValidator(typeof(X509CertificateValidationModeHelper))] public X509CertificateValidationMode CertificateValidationMode { get { return (X509CertificateValidationMode)base[ConfigurationStrings.CertificateValidationMode]; } set { base[ConfigurationStrings.CertificateValidationMode] = value; } } [ConfigurationProperty(ConfigurationStrings.RevocationMode, DefaultValue = X509PeerCertificateAuthentication.DefaultRevocationMode)] [StandardRuntimeEnumValidator(typeof(X509RevocationMode))] public X509RevocationMode RevocationMode { get { return (X509RevocationMode)base[ConfigurationStrings.RevocationMode]; } set { base[ConfigurationStrings.RevocationMode] = value; } } [ConfigurationProperty(ConfigurationStrings.TrustedStoreLocation, DefaultValue = X509PeerCertificateAuthentication.DefaultTrustedStoreLocation)] [StandardRuntimeEnumValidator(typeof(StoreLocation))] public StoreLocation TrustedStoreLocation { get { return (StoreLocation)base[ConfigurationStrings.TrustedStoreLocation]; } set { base[ConfigurationStrings.TrustedStoreLocation] = value; } } public void Copy(X509PeerCertificateAuthenticationElement 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(X509PeerCertificateAuthentication 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
- WebPartManager.cs
- ResourcePermissionBase.cs
- Int64Storage.cs
- DbConvert.cs
- AssociationTypeEmitter.cs
- BufferedStream.cs
- DllNotFoundException.cs
- AppSettingsExpressionBuilder.cs
- PointLight.cs
- ClientData.cs
- DefinitionBase.cs
- EmptyReadOnlyDictionaryInternal.cs
- DeviceSpecificChoiceCollection.cs
- Int64Storage.cs
- ApplicationFileParser.cs
- PowerModeChangedEventArgs.cs
- DetailsViewRow.cs
- GeneralTransform3DCollection.cs
- DiscoveryInnerClientAdhoc11.cs
- PaperSource.cs
- DataGridColumnDropSeparator.cs
- AssemblyResourceLoader.cs
- HttpServerProtocol.cs
- MessagePartDescription.cs
- ToolStripOverflowButton.cs
- BinHexDecoder.cs
- AspCompat.cs
- WebReferencesBuildProvider.cs
- RepeatButton.cs
- PeerNameResolver.cs
- EventWaitHandleSecurity.cs
- DefaultAuthorizationContext.cs
- ClaimSet.cs
- Panel.cs
- GeometryHitTestResult.cs
- WebServiceMethodData.cs
- ProcessingInstructionAction.cs
- RijndaelManaged.cs
- OverlappedAsyncResult.cs
- ComAwareEventInfo.cs
- ReadOnlyKeyedCollection.cs
- XslException.cs
- Exceptions.cs
- SByte.cs
- UiaCoreTypesApi.cs
- FrugalMap.cs
- DataExchangeServiceBinder.cs
- ColumnBinding.cs
- EngineSiteSapi.cs
- XmlNode.cs
- JsonFaultDetail.cs
- SchemaCollectionPreprocessor.cs
- DefaultSection.cs
- StringValueConverter.cs
- NameValueFileSectionHandler.cs
- TemplateBindingExtension.cs
- OleDbConnectionInternal.cs
- PermissionSetTriple.cs
- SendActivityEventArgs.cs
- Random.cs
- TextHidden.cs
- XmlParserContext.cs
- X500Name.cs
- ExpressionParser.cs
- WebPart.cs
- errorpatternmatcher.cs
- WebPartDisplayMode.cs
- DPTypeDescriptorContext.cs
- UDPClient.cs
- GlobalizationSection.cs
- ComponentConverter.cs
- ClientRolePrincipal.cs
- PolygonHotSpot.cs
- XmlNodeChangedEventArgs.cs
- GradientStopCollection.cs
- EmptyImpersonationContext.cs
- DataServiceQueryOfT.cs
- BlurBitmapEffect.cs
- DirectoryNotFoundException.cs
- PromptStyle.cs
- DefaultCompensation.cs
- StatusBarItem.cs
- SystemColors.cs
- AnnouncementEndpointElement.cs
- DictionaryBase.cs
- MailAddressCollection.cs
- DataBindingCollectionConverter.cs
- OrderedDictionary.cs
- WebPartConnectionsCancelEventArgs.cs
- TableProviderWrapper.cs
- NativeMethods.cs
- ConfigurationManagerHelperFactory.cs
- Thumb.cs
- KeyFrames.cs
- XmlSchemaCompilationSettings.cs
- ToolStripOverflow.cs
- WebPartsPersonalizationAuthorization.cs
- MenuItem.cs
- Parser.cs
- CacheDependency.cs