Signature Verification

Go

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

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

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

REST API using curl

$ 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}
Was this article helpful?
0 out of 0 found this helpful