Hi all, I could find the way it has been done in SQS client, I will proceed with that. And the getHmac() method in IdentityUtil is same. The only difference was encoding the parameters.
Thank you. On Wed, Feb 23, 2011 at 7:14 PM, Manjula Rathnayake <[email protected]>wrote: > > > On Wed, Feb 23, 2011 at 5:46 PM, Prabath Siriwardana <[email protected]>wrote: > >> Please have a look at the getHmac() method in IdentityUtil >> [components/identity/org.wso2.carbon.identity.core] > > > Thanks, I will look at this method and try to get verify signatures. > >> >> Thanks & regards, >> -Prabath >> >> On Wed, Feb 23, 2011 at 2:50 PM, Manjula Rathnayake <[email protected]>wrote: >> >>> 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: <%2B94%2077%20743%201987>+94 77 743 1987 >>> >>> _______________________________________________ >>> Carbon-dev mailing list >>> [email protected] >>> http://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev >>> >>> >> >> >> -- >> Thanks & Regards, >> Prabath >> >> http://blog.facilelogin.com >> http://RampartFAQ.com >> > > Thank you. > > -- > Manjula Rathnayaka > Software Engineer > WSO2, Inc. > Mobile:+94 77 743 1987 > -- 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
