System\ServiceModel\Channels\SecurityBindingElementImporter.cs (17)
129void ValidateExistingOrSetNewProtectionLevel(MessagePartDescription part, MessageDescription message, OperationDescription operation, ContractDescription contract, ProtectionLevel newProtectionLevel)
131ProtectionLevel existingProtectionLevel;
202ProtectionLevel uniformProtectionLevel;
204public ContractProtectionLevel(bool hasProtectionRequirements, bool hasUniformProtectionLevel, ProtectionLevel uniformProtectionLevel)
213public ProtectionLevel UniformProtectionLevel { get { return this.uniformProtectionLevel; } }
224ProtectionLevel contractProtectionLevel = ProtectionLevel.None;
264ProtectionLevel protectionLevel = ProtectionLevel.None;
275ProtectionLevel newProtectionLevel = GetProtectionLevel(messageSignedParts.IsBodyIncluded, messageEncryptedParts.IsBodyIncluded, message.Action);
369ProtectionLevel newProtectionLevel = GetProtectionLevel(messageSignedParts.IsBodyIncluded, messageEncryptedParts.IsBodyIncluded, fault.Action);
407if (hasContractProtectionLevel && isContractProtectionLevelUniform && contractProtectionLevel == ProtectionLevel.EncryptAndSign)
445static ProtectionLevel GetProtectionLevel(bool signed, bool encrypted, string action)
447ProtectionLevel result;
453result = ProtectionLevel.EncryptAndSign;
462result = ProtectionLevel.Sign;
466result = ProtectionLevel.None;
System\ServiceModel\Configuration\Properties.cs (15)
144properties.Add(new ConfigurationProperty("protectionLevel", typeof(System.Net.Security.ProtectionLevel), System.Net.Security.ProtectionLevel.Sign, null, new System.ServiceModel.Configuration.ServiceModelEnumValidator(typeof(System.ServiceModel.Security.ProtectionLevelHelper)), System.Configuration.ConfigurationPropertyOptions.None));
171properties.Add(new ConfigurationProperty("contextProtectionLevel", typeof(System.Net.Security.ProtectionLevel), System.Net.Security.ProtectionLevel.Sign, null, new System.ServiceModel.Configuration.ServiceModelEnumValidator(typeof(System.ServiceModel.Security.ProtectionLevelHelper)), System.Configuration.ConfigurationPropertyOptions.None));
197properties.Add(new ConfigurationProperty("contextProtectionLevel", typeof(System.Net.Security.ProtectionLevel), System.Net.Security.ProtectionLevel.Sign, null, new System.ServiceModel.Configuration.ServiceModelEnumValidator(typeof(System.ServiceModel.Security.ProtectionLevelHelper)), System.Configuration.ConfigurationPropertyOptions.None));
1979properties.Add(new ConfigurationProperty("msmqProtectionLevel", typeof(System.Net.Security.ProtectionLevel), System.Net.Security.ProtectionLevel.Sign, null, new System.ServiceModel.Configuration.ServiceModelEnumValidator(typeof(System.ServiceModel.Security.ProtectionLevelHelper)), System.Configuration.ConfigurationPropertyOptions.None));
2108properties.Add(new ConfigurationProperty("protectionLevel", typeof(System.Net.Security.ProtectionLevel), System.Net.Security.ProtectionLevel.EncryptAndSign, null, new System.ServiceModel.Configuration.ServiceModelEnumValidator(typeof(System.ServiceModel.Security.ProtectionLevelHelper)), System.Configuration.ConfigurationPropertyOptions.None));
3528properties.Add(new ConfigurationProperty("protectionLevel", typeof(System.Net.Security.ProtectionLevel), System.Net.Security.ProtectionLevel.EncryptAndSign, null, new System.ServiceModel.Configuration.ServiceModelEnumValidator(typeof(System.ServiceModel.Security.ProtectionLevelHelper)), System.Configuration.ConfigurationPropertyOptions.None));
3735properties.Add(new ConfigurationProperty("protectionLevel", typeof(System.Net.Security.ProtectionLevel), System.Net.Security.ProtectionLevel.EncryptAndSign, null, new System.ServiceModel.Configuration.StandardRuntimeEnumValidator(typeof(System.Net.Security.ProtectionLevel)), System.Configuration.ConfigurationPropertyOptions.None));
System\ServiceModel\Dispatcher\SecurityValidationBehavior.cs (42)
409ValidateContract(binding, contract, ProtectionLevel.None, ProtectionLevel.None);
414ValidateContract(binding, contract, ProtectionLevel.None, ProtectionLevel.None);
417static void ValidateContract(Binding binding, ContractDescription contract, ProtectionLevel defaultRequestProtectionLevel, ProtectionLevel defaultResponseProtectionLevel)
422ProtectionLevel contractScopeDefaultRequestProtectionLevel;
423ProtectionLevel contractScopeDefaultResponseProtectionLevel;
437ProtectionLevel operationScopeDefaultRequestProtectionLevel;
438ProtectionLevel operationScopeDefaultResponseProtectionLevel;
451ProtectionLevel messageScopeDefaultProtectionLevel;
467ProtectionLevel headerScopeDefaultProtectionLevel;
479if (header.IsUnknownHeaderCollection && headerScopeDefaultProtectionLevel != ProtectionLevel.None)
496ValidateContract(binding, contract, ProtectionLevel.None, ProtectionLevel.None);
501ValidateContract(binding, contract, ProtectionLevel.None, ProtectionLevel.None);
504static void ValidateContract(Binding binding, ContractDescription contract, ProtectionLevel defaultRequestProtectionLevel, ProtectionLevel defaultResponseProtectionLevel)
506ProtectionLevel requestProtectionLevel;
507ProtectionLevel responseProtectionLevel;
512static internal void GetRequiredProtectionLevels(ContractDescription contract, ProtectionLevel defaultRequestProtectionLevel, ProtectionLevel defaultResponseProtectionLevel, out ProtectionLevel request, out ProtectionLevel response)
518request = ProtectionLevel.None;
522request = ProtectionLevel.Sign;
526request = ProtectionLevel.EncryptAndSign;
531response = ProtectionLevel.None;
535response = ProtectionLevel.Sign;
539response = ProtectionLevel.EncryptAndSign;
543static void ValidateBindingProtectionCapability(Binding binding, ContractDescription contract, ProtectionLevel request, ProtectionLevel response)
545bool requestValidated = request == ProtectionLevel.None;
546bool responseValidated = response == ProtectionLevel.None;
658&& bootstrapSecurityCapabilities.SupportedRequestProtectionLevel == ProtectionLevel.EncryptAndSign
659&& bootstrapSecurityCapabilities.SupportedResponseProtectionLevel == ProtectionLevel.EncryptAndSign)
704&& transportCapabilities.SupportedRequestProtectionLevel == ProtectionLevel.EncryptAndSign
705&& transportCapabilities.SupportedResponseProtectionLevel == ProtectionLevel.EncryptAndSign)
947ProtectionLevel requestProtectionLevel;
948ProtectionLevel responseProtectionLevel;
952if (responseProtectionLevel == ProtectionLevel.EncryptAndSign)
System\ServiceModel\Security\ChannelProtectionRequirements.cs (26)
49internal ChannelProtectionRequirements(ChannelProtectionRequirements other, ProtectionLevel newBodyProtectionLevel)
54this.incomingSignatureParts = new ScopedMessagePartSpecification(other.incomingSignatureParts, newBodyProtectionLevel != ProtectionLevel.None);
55this.incomingEncryptionParts = new ScopedMessagePartSpecification(other.incomingEncryptionParts, newBodyProtectionLevel == ProtectionLevel.EncryptAndSign);
56this.outgoingSignatureParts = new ScopedMessagePartSpecification(other.outgoingSignatureParts, newBodyProtectionLevel != ProtectionLevel.None);
57this.outgoingEncryptionParts = new ScopedMessagePartSpecification(other.outgoingEncryptionParts, newBodyProtectionLevel == ProtectionLevel.EncryptAndSign);
206internal static ChannelProtectionRequirements CreateFromContract(ContractDescription contract, ProtectionLevel defaultRequestProtectionLevel, ProtectionLevel defaultResponseProtectionLevel, bool isForClient)
213ProtectionLevel contractScopeDefaultRequestProtectionLevel;
214ProtectionLevel contractScopeDefaultResponseProtectionLevel;
228ProtectionLevel operationScopeDefaultRequestProtectionLevel;
229ProtectionLevel operationScopeDefaultResponseProtectionLevel;
242ProtectionLevel messageScopeDefaultProtectionLevel;
266ProtectionLevel bodyProtectionLevel;
271bodyProtectionLevel = ProtectionLevel.None;
293ProtectionLevel partProtectionLevel = body.HasProtectionLevel ? body.ProtectionLevel : messageScopeDefaultProtectionLevel;
295if (bodyProtectionLevel == ProtectionLevel.EncryptAndSign)
299if (bodyProtectionLevel != ProtectionLevel.None)
302if (bodyProtectionLevel == ProtectionLevel.EncryptAndSign)
335MessagePartSpecification encryptedParts, ProtectionLevel defaultProtectionLevel)
337ProtectionLevel p = header.HasProtectionLevel ? header.ProtectionLevel : defaultProtectionLevel;
338if (p != ProtectionLevel.None)
342if (p == ProtectionLevel.EncryptAndSign)
347static void AddFaultProtectionRequirements(FaultDescriptionCollection faults, ChannelProtectionRequirements requirements, ProtectionLevel defaultProtectionLevel, bool addToIncoming)
358ProtectionLevel p = fault.HasProtectionLevel ? fault.ProtectionLevel : defaultProtectionLevel;
359if (p != ProtectionLevel.None)
362if (p == ProtectionLevel.EncryptAndSign)