---
title: "Signature Verification"
slug: "dsm-example-code-signature-verification"
updated: 2024-12-10T18:06:08Z
published: 2024-12-10T18:06:08Z
canonical: "support.fortanix.com/dsm-example-code-signature-verification"
---

> ## Documentation Index
> Fetch the complete documentation index at: https://support.fortanix.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Signature Verification

> [!NOTE]
> NOTE
> 
> Data and Hash should be base64 encoded.

- [Go](/docs/dsm-example-code-signature-verification#tabs-1)
- [Java](/docs/dsm-example-code-signature-verification#tabs-2)
- [Python](/docs/dsm-example-code-signature-verification#tabs-3)
- [REST API using curl](/docs/dsm-example-code-signature-verification#tabs-4)

### Go

```bash
data := byte[]("Hello World!")
keyId := <Key UUID>
verifyReq := sdkms.VerifyRequest{
            Signature: byte[](<signature in bytes>),
            Key: sdkms.SobjectById(keyId),
            HashAlg: sdkms.DigestAlgorithmSha256,
            Data: &data,
}
verifyResp, err := client.Verify(ctx, verifyReq)
verifyResp.Result #true or false for verification
```

### Java

```bash
String data = "Hello World!";
VerifyRequest verifyRequest = new VerifyRequest()
          .hashAlg(DigestAlgorithm.SHA256)
          .data(data.getBytes())
          .signature(<signature as bytes>; 
VerifyResponse verifyResponse = SignAndVerifyApi().verify(<Key UUID>, verifyRequest);
verifyResponse.result; // true or false for verification
```

### Python

```bash
api_instance = sdkms.v1.SignAndVerifyApi (api_client=client)
String data = "Hello World!"
request = sdkms.v1.VerifyRequest(
     (hash_alg= DigestAlgorithm.SHA256, data=data.encode(), signature=)
verify_response = api_instance.verify(kid, request)
verify_response.result # true or false for verification
```

### REST API using curl

```bash
$ echo "Hello World!" | base64
SGVsbG8gV29ybGQhCg==

$ curl <Endpoint URL>/crypto/v1/verify -H 'Authorization: Bearer YhXwwa-6C...ig5g' -d '{"key": {"kid": "Key-UUID"}, "hash_alg": "SHA256", "data": "SGVsbG8gV29ybGQhCg==", "signature": "Y25lYm4gdmVidm...llamJ2ZWlqYgo=="}}'

{"result": true}
```

## Related

- [Signature Generation](/dsm-example-code-signature-generation.md)
- [Key Operations](/fortanix-dsm-key-operations.md)
- [Add Quorum Approval Policy](/dsm-example-code-add-quorum-approval-policy.md)
- [Log out](/dsm-example-code-log-out.md)
