java/src/main/java/com/genexus/security/web/jose/jwt/JWTSigner.java
/**
     * Sign an input string using HMAC and return the encrypted bytes
     */
Sign an input string using HMAC and return the encrypted bytes
Sign an input string using HMAC and return the encrypted bytes
private static byte[] signHmac(final Algorithm algorithm, final String msg, final byte[] secret) throws NoSuchAlgorithmException, InvalidKeyException {
        final Mac mac = Mac.getInstance(algorithm.getValue());
        mac.init(new SecretKeySpec(secret, algorithm.getValue()));
        return mac.doFinal(msg.getBytes());
    }
private static byte [ ] signHmac ( final Algorithm algorithm , final String msg , final byte [ ] secret ) throws NoSuchAlgorithmException , InvalidKeyException { final Mac mac = Mac . getInstance ( algorithm . getValue ( ) ) ; mac . init ( new SecretKeySpec ( secret , algorithm . getValue ( ) ) ) ; return mac . doFinal ( msg . getBytes ( ) ) ; }
Sign an input string using HMAC and return the encrypted bytes
Sign an input string using HMAC and return the encrypted bytes