@Test public void verifySaltedFromExternal() throws Exception { String encPassword = "b098017d584647e3fa1f3e0eb437648aefa84093c15e0d3efb752a4183cfdcf3666ac543"; assertTrue(ENCRYPTOR.verify(PASSWORD_VALUE, CipherAlgorithm.SSHA256, encPassword)); }
public boolean verify(final String value, final CipherAlgorithm cipherAlgorithm, final String encoded) { boolean verified = false; try { if (value != null) { if (cipherAlgorithm == null || cipherAlgorithm == CipherAlgorithm.AES) { verified = encode(value, cipherAlgorithm).equals(encoded); } else if (cipherAlgorithm == CipherAlgorithm.BCRYPT) { verified = BCrypt.checkpw(value, encoded); } else { verified = getDigester(cipherAlgorithm).matches(value, encoded); } } } catch (Exception e) { LOG.error("Could not verify encoded value", e); } return verified; }
Encryptor { public boolean verify(final String value, final CipherAlgorithm cipherAlgorithm, final String encoded) { boolean verified = false; try { if (value != null) { if (cipherAlgorithm == null || cipherAlgorithm == CipherAlgorithm.AES) { verified = encode(value, cipherAlgorithm).equals(encoded); } else if (cipherAlgorithm == CipherAlgorithm.BCRYPT) { verified = BCrypt.checkpw(value, encoded); } else { verified = getDigester(cipherAlgorithm).matches(value, encoded); } } } catch (Exception e) { LOG.error("Could not verify encoded value", e); } return verified; } }
Encryptor { public boolean verify(final String value, final CipherAlgorithm cipherAlgorithm, final String encoded) { boolean verified = false; try { if (value != null) { if (cipherAlgorithm == null || cipherAlgorithm == CipherAlgorithm.AES) { verified = encode(value, cipherAlgorithm).equals(encoded); } else if (cipherAlgorithm == CipherAlgorithm.BCRYPT) { verified = BCrypt.checkpw(value, encoded); } else { verified = getDigester(cipherAlgorithm).matches(value, encoded); } } } catch (Exception e) { LOG.error("Could not verify encoded value", e); } return verified; } private  Encryptor(final String secretKey); }
Encryptor { public boolean verify(final String value, final CipherAlgorithm cipherAlgorithm, final String encoded) { boolean verified = false; try { if (value != null) { if (cipherAlgorithm == null || cipherAlgorithm == CipherAlgorithm.AES) { verified = encode(value, cipherAlgorithm).equals(encoded); } else if (cipherAlgorithm == CipherAlgorithm.BCRYPT) { verified = BCrypt.checkpw(value, encoded); } else { verified = getDigester(cipherAlgorithm).matches(value, encoded); } } } catch (Exception e) { LOG.error("Could not verify encoded value", e); } return verified; } private  Encryptor(final String secretKey); static Encryptor getInstance(); static Encryptor getInstance(final String secretKey); String encode(final String value, final CipherAlgorithm cipherAlgorithm); boolean verify(final String value, final CipherAlgorithm cipherAlgorithm, final String encoded); String decode(final String encoded, final CipherAlgorithm cipherAlgorithm); }
Encryptor { public boolean verify(final String value, final CipherAlgorithm cipherAlgorithm, final String encoded) { boolean verified = false; try { if (value != null) { if (cipherAlgorithm == null || cipherAlgorithm == CipherAlgorithm.AES) { verified = encode(value, cipherAlgorithm).equals(encoded); } else if (cipherAlgorithm == CipherAlgorithm.BCRYPT) { verified = BCrypt.checkpw(value, encoded); } else { verified = getDigester(cipherAlgorithm).matches(value, encoded); } } } catch (Exception e) { LOG.error("Could not verify encoded value", e); } return verified; } private  Encryptor(final String secretKey); static Encryptor getInstance(); static Encryptor getInstance(final String secretKey); String encode(final String value, final CipherAlgorithm cipherAlgorithm); boolean verify(final String value, final CipherAlgorithm cipherAlgorithm, final String encoded); String decode(final String encoded, final CipherAlgorithm cipherAlgorithm);  }