You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jclouds.apache.org by Andrew Phillips <no...@github.com> on 2013/12/09 21:53:21 UTC

[jclouds] JCLOUDS-32: Using less magic in route53 signature (#222)

See [JCLOUDS-32](https://issues.apache.org/jira/browse/JCLOUDS-32)
You can merge this Pull Request by running:

  git pull https://github.com/jclouds/jclouds jclouds-32

Or you can view, comment on it, or merge it online at:

  https://github.com/jclouds/jclouds/pull/222

-- Commit Summary --

  * JCLOUDS-32: Using less magic in route53 signature

-- File Changes --

    M apis/route53/src/main/java/org/jclouds/route53/filters/RestAuthentication.java (33)

-- Patch Links --

https://github.com/jclouds/jclouds/pull/222.patch
https://github.com/jclouds/jclouds/pull/222.diff

Re: [jclouds] JCLOUDS-32: Using less magic in route53 signature (#222)

Posted by Andrew Phillips <no...@github.com>.
Committed to [master](https://git-wip-us.apache.org/repos/asf?p=jclouds.git;a=commit;h=acde2beff1d04301af69a68ce598d7d3a96a92f0). Any fixes we want to make to avoid potential OOMEs can be added in a separate PR, I think.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/222#issuecomment-30187633

Re: [jclouds] JCLOUDS-32: Using less magic in route53 signature (#222)

Posted by Andrew Phillips <no...@github.com>.
>     @Override
>     public String sign(String toSign) {
>        try {
> -         ByteProcessor<byte[]> hmacSHA256 = asByteProcessor(crypto.hmacSHA256(creds.get().credential.getBytes(UTF_8)));
> -         return base64().encode(readBytes(toInputStream(toSign), hmacSHA256));
> +         SecretKeySpec keySpec = new SecretKeySpec(creds.get().credential.getBytes(UTF_8), "HmacSHA256");
> +         Mac mac = Mac.getInstance("HmacSHA256");
> +         mac.init(keySpec);
> +         byte[] result = mac.doFinal(toSign.getBytes(UTF_8));

This is all happening in memory - how big could the input be here?

@adriancole: risk of OOMs here? I guess no bigger than it was before, though...

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/222/files#r8213869

Re: [jclouds] JCLOUDS-32: Using less magic in route53 signature (#222)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-java-7-pull-requests #899](https://jclouds.ci.cloudbees.com/job/jclouds-java-7-pull-requests/899/) SUCCESS
This pull request looks good

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/222#issuecomment-30176760

Re: [jclouds] JCLOUDS-32: Using less magic in route53 signature (#222)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-pull-requests #436](https://jclouds.ci.cloudbees.com/job/jclouds-pull-requests/436/) SUCCESS
This pull request looks good

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/222#issuecomment-30176665