Reputation: 534
I am trying to import a file which is in the jar file. I have used many versions of the jar file but i cannot able to figure out which version of the jar will support that import statement.
This is the statement that i am trying to import
import com.google.appengine.repackaged.com.google.common.util.Base64;
and this is the jar file link that i have downloaded and added to my eclipse project classpath
http://www.java2s.com/Code/Jar/a/Downloadappengineapi120jar.htm
Please help in importing the above statement with a suitable jar file. Thanks in advance
public void String signPolicyDocument(String policyDocument, String secret) {
try {
Mac mac = Mac.getInstance("HmacSHA1");
byte[] secretBytes = secret.getBytes("UTF8");
SecretKeySpec signingKey =
new SecretKeySpec(secretBytes, "HmacSHA1");
mac.init(signingKey);
byte[] signedSecretBytes =
mac.doFinal(policyDocument.getBytes("UTF8"));
String signature = Base64.encode(signedSecretBytes);
return signature;
} catch (InvalidKeyException e) {
throw new RuntimeException(e);
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
}
Upvotes: 1
Views: 175