Share via


MessageContractMemberAttribute.ProtectionLevel 속성

정의

멤버를 현재 상태로 전송할지, 서명한 상태로 전송할지, 서명하고 암호화한 상태로 전송할지를 지정합니다.

public:
 property System::Net::Security::ProtectionLevel ProtectionLevel { System::Net::Security::ProtectionLevel get(); void set(System::Net::Security::ProtectionLevel value); };
public System.Net.Security.ProtectionLevel ProtectionLevel { get; set; }
member this.ProtectionLevel : System.Net.Security.ProtectionLevel with get, set
Public Property ProtectionLevel As ProtectionLevel

속성 값

ProtectionLevel

ProtectionLevel 값 중 하나입니다. 기본값은 None입니다.

설명

속성 또는 MessageBodyMemberAttribute 특성에서 ProtectionLevel MessageHeaderAttribute 속성을 사용하려면 바인딩 및 동작을 올바르게 구성해야 합니다. 이러한 보안 기능을 적절한 구성 없이 사용하는 경우(예: 보안 자격 증명을 제공하지 않고 메시지 파트 사용 ProtectionLevel.Sign ) 런타임에 예외가 throw됩니다.

또한 각 헤더에 대한 보호 수준이 개별적으로 결정됩니다. 그러나 SOAP 본문에는 신체 부위 수에 관계없이 하나의 보호 수준만 있습니다. 본문의 보호 수준은 모든 본문 부분의 가장 ProtectionLevel 높은 속성 값에 의해 결정됩니다. 예를 들어 다음 클래스를 예로 들어 볼 수 있습니다.

[MessageContract]  
public class PatientRecord  
{  
   [MessageHeader(ProtectionLevel=None)] public int recordID;  
   [MessageHeader(ProtectionLevel=Sign)] public string patientName;  
   [MessageHeader(ProtectionLevel=EncryptAndSign)] public string SSN;  
   [MessageBody(ProtectionLevel=None)] public string comments;  
   [MessageBody(ProtectionLevel=Sign)] public string diagnosis;  
   [MessageBody(ProtectionLevel=EncryptAndSign)] public string medicalHistory;  
}  

이 예제에서는 헤더가 recordID 보호되지 않고, patientName 서명되고 SSN , 암호화되고 서명됩니다. 본문 부분과 본문 부분이 medicalHistoryProtectionLevel.EncryptAndSign 더 낮은 보호 수준을 지정하더라도 comments diagnosis 전체 메시지 본문이 암호화되고 서명되는 본문 부분이 하나 이상 있습니다.

런타임 시 보호 동작은 다음 속성에 설정된 보호 수준 값의 조합입니다. 이러한 속성에는 계층 구조가 있습니다. 가장 바깥쪽 값을 설정하면 더 좁은 범위에 대해 다른 값이 명시적으로 설정되지 않는 한 모든 좁은 범위에 대한 기본 설정이 설정됩니다. 이 경우 외부 값은 특별히 설정된 것을 제외하고 모든 좁은 범위의 기본값으로 유지됩니다.

예를 들어 설정 ProtectionLevel.EncryptAndSign 되고 다른 좁은 범위에 보호 수준 설정이 없는 경우 ServiceContractAttribute.ProtectionLevel 작업 계약의 모든 메시지가 암호화되고 서명됩니다. 그러나 이러한 작업 중 하나에 설정된 ProtectionLevel.Sign경우 해당 작업에 OperationContractAttribute 대한 메시지는 서명되지만 계약의 다른 모든 메시지는 암호화되고 서명됩니다.

보호 수준 및 해당 가정 및 범위에 대한 자세한 내용은 보호 수준 이해를 참조하세요.

이러한 값이 설정된 범위는 다음과 같습니다.

ServiceContractAttribute.ProtectionLevel

OperationContractAttribute.ProtectionLevel

FaultContractAttribute.ProtectionLevel

MessageContractAttribute.ProtectionLevel

의 속성System.ServiceModel.MessageHeaderAttribute입니다MessageContractMemberAttribute.ProtectionLevel.

의 속성System.ServiceModel.MessageBodyMemberAttribute입니다MessageContractMemberAttribute.ProtectionLevel.

계약에 명시적으로 지정된 보호 수준이 없고 기본 바인딩이 보안(전송 또는 메시지 수준)을 지원하는 경우 전체 계약에 대한 효과적인 보호 수준이 됩니다 ProtectionLevel.EncryptAndSign. 바인딩이 보안(예: BasicHttpBinding)을 지원하지 않는 경우 유효 System.Net.Security.ProtectionLevelProtectionLevel.None 전체 계약에 대한 것입니다. 결과적으로 엔드포인트 바인딩에 따라 계약이 지정한 경우에도 클라이언트에서 다른 메시지 또는 전송 수준 보안 보호가 필요할 수 있습니다 ProtectionLevel.None.

적용 대상