| | | 1 | | // Licensed to the .NET Foundation under one or more agreements. |
| | | 2 | | // The .NET Foundation licenses this file to you under the MIT license. |
| | | 3 | | |
| | | 4 | | using System; |
| | | 5 | | using System.ComponentModel; |
| | | 6 | | using System.Net.Security; |
| | | 7 | | using System.Runtime.Versioning; |
| | | 8 | | using CoreWCF.Channels; |
| | | 9 | | using CoreWCF.Security; |
| | | 10 | | |
| | | 11 | | namespace CoreWCF |
| | | 12 | | { |
| | | 13 | | [SupportedOSPlatform("windows")] |
| | | 14 | | public sealed class NamedPipeTransportSecurity |
| | | 15 | | { |
| | | 16 | | internal const ProtectionLevel DefaultProtectionLevel = ProtectionLevel.EncryptAndSign; |
| | | 17 | | private ProtectionLevel _protectionLevel; |
| | | 18 | | |
| | 0 | 19 | | public NamedPipeTransportSecurity() |
| | | 20 | | { |
| | 0 | 21 | | _protectionLevel = DefaultProtectionLevel; |
| | 0 | 22 | | } |
| | | 23 | | |
| | | 24 | | [DefaultValue(ConnectionOrientedTransportDefaults.ProtectionLevel)] |
| | | 25 | | public ProtectionLevel ProtectionLevel |
| | | 26 | | { |
| | 0 | 27 | | get { return _protectionLevel; } |
| | | 28 | | set |
| | | 29 | | { |
| | 0 | 30 | | if (!ProtectionLevelHelper.IsDefined(value)) |
| | | 31 | | { |
| | 0 | 32 | | throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof(val |
| | | 33 | | } |
| | 0 | 34 | | _protectionLevel = value; |
| | 0 | 35 | | } |
| | | 36 | | } |
| | | 37 | | |
| | | 38 | | internal WindowsStreamSecurityBindingElement CreateTransportProtectionAndAuthentication() |
| | | 39 | | { |
| | 0 | 40 | | WindowsStreamSecurityBindingElement result = new WindowsStreamSecurityBindingElement(); |
| | 0 | 41 | | result.ProtectionLevel = _protectionLevel; |
| | 0 | 42 | | return result; |
| | | 43 | | } |
| | | 44 | | } |
| | | 45 | | } |