public static byte [ ] hmac ( SecurityAlgorithm securityAlgorithm , byte [ ] secretKey , ByteBuffer ... buffers ) throws UaException { String transformation = securityAlgorithm . getTransformation ( ) ; try { Mac mac = Mac . getInstance ( transformation ) ; mac . init ( new SecretKeySpec ( secretKey , transformation ) ) ; for ( ByteBuffer buffer : buffers ) { mac . update ( buffer ) ; } return mac . doFinal ( ) ; } catch ( GeneralSecurityException e ) { throw new UaException ( StatusCodes . Bad_SecurityChecksFailed , e ) ; } }
Compute the HMAC of the provided buffers .