Skip to content

Commit e728835

Browse files
author
Stephane Landelle
committed
Backport fix for encoding issue, close AsyncHttpClient#255
1 parent 4b2886e commit e728835

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/main/java/com/ning/http/client/oauth/ThreadSafeHMAC.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package com.ning.http.client.oauth;
1818

1919
import com.ning.http.util.UTF8Codec;
20+
import com.ning.http.util.UTF8UrlEncoder;
2021

2122
import javax.crypto.Mac;
2223
import javax.crypto.spec.SecretKeySpec;
@@ -36,7 +37,7 @@ public class ThreadSafeHMAC {
3637
private final Mac mac;
3738

3839
public ThreadSafeHMAC(ConsumerKey consumerAuth, RequestToken userAuth) {
39-
byte[] keyBytes = UTF8Codec.toUTF8(consumerAuth.getSecret() + "&" + userAuth.getSecret());
40+
byte[] keyBytes = UTF8Codec.toUTF8(UTF8UrlEncoder.encode(consumerAuth.getSecret()) + "&" + UTF8UrlEncoder.encode(userAuth.getSecret()));
4041
SecretKeySpec signingKey = new SecretKeySpec(keyBytes, HMAC_SHA1_ALGORITHM);
4142

4243
// Get an hmac_sha1 instance and initialize with the signing key

0 commit comments

Comments
 (0)