class="java"> Mac sha256_HMAC = null; BASE64Decoder decoder = null; BASE64Encoder encoder = null; try { decoder = new sun.misc.BASE64Decoder(); SecretKey secret_key = new SecretKeySpec(decoder.decodeBuffer(sAccessKey), "HmacSHA256"); sha256_HMAC = Mac.getInstance(secret_key.getAlgorithm()); sha256_HMAC.init(secret_key); byte[] digest = sha256_HMAC.doFinal(sStringToSign.getBytes("UTF-8")); encoder = new sun.misc.BASE64Encoder(); sToken = encoder.encode(digest); } catch (NoSuchAlgorithmException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (InvalidKeyException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalStateException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); }