Hi all,

I am trying to generate the signature with HmacSHA256 algorithm for SQS
request authentication.
I have used the code used in the developer guide as it is.

In developer guide, HMAC-SHA1 signature is used.
But in SQS SDK client, HmacSHA256 is used.

I have used the following code to calculate signature. But calculated
signature is different from the sqs client request.

           private static final String HMAC_SHA1_ALGORITHM = "HmacSHA256";
           // get an hmac_sha1 key from the raw key bytes
            SecretKeySpec signingKey = new SecretKeySpec(key.getBytes(),
HMAC_SHA1_ALGORITHM);
            // get an hmac_sha1 Mac instance and initialize with the signing
key
            Mac mac = Mac.getInstance(HMAC_SHA1_ALGORITHM);
            mac.init(signingKey);
            // compute the hmac on input data bytes
            byte[] rawHmac = mac.doFinal(data.getBytes());
            // base64-encode the hmac
            result = Base64Utils.encode(rawHmac);

Is there anything wrong with above signature calculating code(this is same
as in developer guide except algorithm) ?

Thank you.
-- 
Manjula Rathnayaka
Software Engineer
WSO2, Inc.
Mobile:+94 77 743 1987
_______________________________________________
Carbon-dev mailing list
[email protected]
http://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev

Reply via email to