code: private static String createSignature(String     stringToSign,
                                            String     awsSecretKey,
                                            String     algorithm)
              throws SignatureException {
  
          assert stringToSign != null;
          assert awsSecretKey != null;
          assert algorithm != null;
  
          String signature;
  
          try {
              byte[] secretyKeyBytes = awsSecretKey.getBytes(UTF8_CHARSET);
              SecretKeySpec secretKeySpec = new SecretKeySpec(secretyKeyBytes,
                                                              algorithm);
              Mac mac = Mac.getInstance(algorithm);
              mac.init(secretKeySpec);
  
              byte[] data = stringToSign.getBytes(UTF8_CHARSET);
  
              byte[] rawHmac = mac.doFinal(data);
              signature = rfc3986Conformance(new String(Codec.base64Encode(rawHmac)));
          } catch (Exception e) {
              throw new SignatureException("Failed to generate HMAC : " +
                                                                 e.getMessage());
          }
  
          return signature;
      }
docs: ------------------------- Private Methods -----------------------------