@Test public void testMac() throws InvalidKeyException, NoSuchAlgorithmException, IOException, ClassNotFoundException { String inputData = "This is the text we want to get the MAC for"; String hmac = Base64.getEncoder().encodeToString(buildMAC(inputData)); assertTrue(hmac.equals("kJ5sdJg8C490B16kmZhE+druaVTWTUXvEKwL643w6dI=")); }
public static byte[] buildMAC(String input) { return buildMAC(input, null); }
SensitiveDataCryptoUtils { public static byte[] buildMAC(String input) { return buildMAC(input, null); } }
SensitiveDataCryptoUtils { public static byte[] buildMAC(String input) { return buildMAC(input, null); } private  SensitiveDataCryptoUtils(); }
SensitiveDataCryptoUtils { public static byte[] buildMAC(String input) { return buildMAC(input, null); } private  SensitiveDataCryptoUtils(); static synchronized void configure(SensitiveDataCryptoUtilsConfiguration configuration); static SecretKey buildSecretKey(byte[] keyBytes, String algo); static SecretKey buildSecretKey(int lengthInBits, String algo); static String buildMACAsBase64String(String input); static String buildSaltedMACAsBase64String(String input); static byte[] buildMAC(String input); static byte[] buildMAC(String input, byte[] salt); static byte[] buildMAC(byte[] input, byte[] salt); static boolean verifyMAC(String message, String macAsBase64); static boolean verifySaltedMAC(String message, String macAndSaltAsBase64); static String encryptAsBase64String(Integer input); static String encryptAsBase64String(Long input); static String encryptAsBase64String(String input); static byte[] encrypt(String input); static byte[] encrypt(byte[] input); static Long decryptAsLong(String base64Input); static Long decryptAsLong(byte[] input); static String decryptAsString(String base64Input); static String decryptAsString(byte[] input); static byte[] decrypt(byte[] input); static byte[] sealObject(Serializable object); static Object unsealObject(byte[] encryptedObject); static String generateStrongPasswordHash(char[] password); static boolean validateStrongPasswordHash(char[] passwd, String storedHash); }
SensitiveDataCryptoUtils { public static byte[] buildMAC(String input) { return buildMAC(input, null); } private  SensitiveDataCryptoUtils(); static synchronized void configure(SensitiveDataCryptoUtilsConfiguration configuration); static SecretKey buildSecretKey(byte[] keyBytes, String algo); static SecretKey buildSecretKey(int lengthInBits, String algo); static String buildMACAsBase64String(String input); static String buildSaltedMACAsBase64String(String input); static byte[] buildMAC(String input); static byte[] buildMAC(String input, byte[] salt); static byte[] buildMAC(byte[] input, byte[] salt); static boolean verifyMAC(String message, String macAsBase64); static boolean verifySaltedMAC(String message, String macAndSaltAsBase64); static String encryptAsBase64String(Integer input); static String encryptAsBase64String(Long input); static String encryptAsBase64String(String input); static byte[] encrypt(String input); static byte[] encrypt(byte[] input); static Long decryptAsLong(String base64Input); static Long decryptAsLong(byte[] input); static String decryptAsString(String base64Input); static String decryptAsString(byte[] input); static byte[] decrypt(byte[] input); static byte[] sealObject(Serializable object); static Object unsealObject(byte[] encryptedObject); static String generateStrongPasswordHash(char[] password); static boolean validateStrongPasswordHash(char[] passwd, String storedHash); static final Charset ENCRYPTION_CHARSET; }