CryptographicEngine.VerifySignature 메서드

정의

메시지 서명을 확인합니다.

public:
 static bool VerifySignature(CryptographicKey ^ key, IBuffer ^ data, IBuffer ^ signature);
 static bool VerifySignature(CryptographicKey const& key, IBuffer const& data, IBuffer const& signature);
public static bool VerifySignature(CryptographicKey key, IBuffer data, IBuffer signature);
function verifySignature(key, data, signature)
Public Shared Function VerifySignature (key As CryptographicKey, data As IBuffer, signature As IBuffer) As Boolean

매개 변수

key
CryptographicKey

확인에 사용되는 키입니다. 이 키는 이전에 메시지에 서명하는 데 사용한 것과 동일한 키여야 합니다.

data
IBuffer

확인할 메시지입니다.

signature
IBuffer

이전에 확인할 메시지를 통해 계산된 서명입니다.

반환

Boolean

bool

메시지가 확인되면 true입니다.

예제

public void SampleVerifyHMAC(
    IBuffer buffMsg,
    CryptographicKey hmacKey,
    IBuffer buffHMAC)
{
    // The input key must be securely shared between the sender of the HMAC and 
    // the recipient. The recipient uses the CryptographicEngine.VerifySignature() 
    // method as follows to verify that the message has not been altered in transit.
    Boolean IsAuthenticated = CryptographicEngine.VerifySignature(hmacKey, buffMsg, buffHMAC);
    if (!IsAuthenticated)
    {
        throw new Exception("The message cannot be verified.");
    }
}

설명

콘텐츠에 서명하기 위해 보낸 사람은 일반적으로 메시지에 해시를 만들고 해시를 서명(암호화)한 다음 서명과 암호화되지 않은 메시지를 모두 보냅니다. 받는 사람은 동일한 키와 알고리즘을 사용하여 메시지에 대한 해시를 계산하고, 서명의 암호를 해독하고, 암호 해독된 서명을 해시 값과 비교합니다. 그 둘이 일치하면 수신자는 발신자가 보낸 메시지가 전송 중에 변경되지 않았음을 확신할 수 있습니다. 자세한 내용은 MAC, 해시 및 서명을 참조하세요.

적용 대상