static byte [ ] hmacSha1 ( StringBuilder message , String key ) { try { Mac mac = Mac . getInstance ( "HmacSHA1" ) ; mac . init ( new SecretKeySpec ( key . getBytes ( ) , "HmacSHA1" ) ) ; return mac . doFinal ( message . toString ( ) . getBytes ( ) ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } }
Encrypt a string with HMAC - SHA1 using the specified key .