@Override public String decrypt(final String cipheredText, final String passphrase) { try { final String jsonStr = Crypto.decode(cipheredText); final JsonNode json = MAPPER.readTree(jsonStr); return newEncryptor(passphrase).decrypt(json.get(CIPHERED_TEXT_KEY).asText()); } catch (final Exception e) { throw new RuntimeException(e); } }
@Override public String decrypt(final String cipheredText, final String passphrase) { try { final JsonNode json = MAPPER.readTree(Crypto.decode(cipheredText)); return newEncryptor(passphrase).decrypt(json.get(CIPHERED_TEXT_KEY).asText()); } catch (final Exception e) { throw new RuntimeException(e); } }
public boolean isPasswordValid(String encPass, String rawPass, Object salt) { this.checkInitialization(); String decPassword = null; if (this.useTextEncryptor) { decPassword = this.textEncryptor.decrypt(encPass); } else { decPassword = this.pbeStringEncryptor.decrypt(encPass); } if (decPassword != null && rawPass != null) { return decPassword.equals(rawPass); } else { return decPassword == rawPass; } }
public static String decodeData(String encodedData, String key) { if (encryptor == null) { initialize(key); } return encryptor.decrypt(encodedData); }
/** {@inheritDoc} */ @Override public String decrypt(String cryptotet) { return this.encryptor.decrypt(cryptotet); } }
@Override public String decryptForInternalUse(String stringToDecrypt) { return internalEncryptor.decrypt(stringToDecrypt); }
/** * {@inheritDoc} */ @Override public String decrypt(final String encryptedString) { return stringEncryptor.decrypt(encryptedString); }
/** {@inheritDoc} */ @Override public String decrypt(String cryptotet) { return this.encryptor.decrypt(cryptotet); } }
@Override @Deprecated public String decryptForLegacyExternalUse(String stringToDecrypt) { return legacyExternalEncryptor.decrypt(stringToDecrypt); }
@Override public String decryptForExternalUse(String stringToDecrypt) { try { return externalEncryptor.decrypt(stringToDecrypt); } catch (EncryptionOperationNotPossibleException e) { return decryptForLegacyExternalUse(stringToDecrypt); } }
public static String decodeData(final String encodedData, final String key) { if (encryptor == null) { initialize(key); } return encryptor.decrypt(encodedData); }
@Override public Object nullSafeGet( ResultSet rs, String[] names, SharedSessionContractImplementor session, Object owner ) throws HibernateException, SQLException { ensureEncryptorInit(); String value = rs.getString( names[0] ); return rs.wasNull() ? null : encryptor.decrypt( value ); }
/** * Decypts a message, delegating to wrapped encryptor * * @param encryptedMessage the message to be decrypted. * @return the result of decryption. */ public String decrypt(final String encryptedMessage) { if (this.encryptor == null) { throw new EncryptionInitializationException( "Encryptor has not been set into Hibernate wrapper"); } return this.encryptor.decrypt(encryptedMessage); }
public Object nullSafeGet(final ResultSet rs, final String[] names, final SessionImplementor session, final Object owner) throws HibernateException, SQLException { checkInitialization(); final String message = rs.getString(names[0]); return rs.wasNull() ? null : convertToObject(this.encryptor.decrypt(message)); }
@Override public String resolve(FabricService fabricService, Map<String, Map<String, String>> configs, String pid, String key, String value) { if (key != null && key.contains(",")) { LOG.error("Encrypted property key {} may not contain commas ',' ", key); throw new InvalidParameterException("Encrypted property keys may not contain commas ',' "); } if (encryptor == null) { encryptor = getEncryptor(fabricService); } String decrypted = encryptor.decrypt(value.substring(RESOLVER_SCHEME.length() + 1)); if (configs != null) { // ENTESB-5392: let's keep encrypted value too Map<String, String> pidConfiguration = configs.get(pid); if (!pidConfiguration.containsKey("fabric.zookeeper.encrypted.values")) { pidConfiguration.put("fabric.zookeeper.encrypted.values", ""); } String encryptedValues = pidConfiguration.get("fabric.zookeeper.encrypted.values"); if (!encryptedValues.isEmpty()) { encryptedValues += ", "; } encryptedValues += key; pidConfiguration.put("fabric.zookeeper.encrypted.values", encryptedValues); pidConfiguration.put(key + ".encrypted", value); } return decrypted; }
log.debug("value before decryption=" + value); this.value = this.encryptor.decrypt(this.value) ; if (debug) { log.debug("value after decryption=" + this.value);
private Object deSerializeValue(String value, String type, boolean secured) throws IllegalClassException { if (value == null || type == null) { return null; } String string; if (secured) { // sanity check should be Base64 encoded if (Base64.isBase64(value)) { string = textEncryptor.decrypt(value); } else { log.warn("Invalid value found attempting to decrypt a secured property, check your secured properties"); string = value; } } else { string = value; } Object obj; if (ServerConfigurationService.TYPE_STRING.equals(type)) { obj = string; } else if (ServerConfigurationService.TYPE_INT.equals(type)) { obj = Integer.valueOf(string); } else if (ServerConfigurationService.TYPE_BOOLEAN.equals(type)) { obj = Boolean.valueOf(string); } else if (ServerConfigurationService.TYPE_ARRAY.equals(type)) { obj = string.split(HibernateConfigItem.ARRAY_SEPARATOR); } else { throw new IllegalClassException("deSerializeValue() invalid TYPE, while deserializing"); } return obj; }
/** * Checks a password's validity. This implementation completely ignores * salt, as jasypt's <tt>TextEncryptor</tt> and <tt>PBEStringEncryptor</tt> * normally use a random one. Thus, it can be safely passed as <tt>null</tt>. * * @param encPass The encrypted password against which to check. * @param rawPass The password to be checked. * @param salt The salt, which will be ignored. It can be null. */ public boolean isPasswordValid(final String encPass, final String rawPass, final Object salt) { checkInitialization(); String decPassword = null; if (this.useTextEncryptor.booleanValue()) { decPassword = this.textEncryptor.decrypt(encPass); } else { decPassword = this.pbeStringEncryptor.decrypt(encPass); } if ((decPassword == null) || (rawPass == null)) { return (decPassword == rawPass); } return decPassword.equals(rawPass); }
/** * Checks a password's validity. This implementation completely ignores * salt, as jasypt's <tt>TextEncryptor</tt> and <tt>PBEStringEncryptor</tt> * normally use a random one. Thus, it can be safely passed as <tt>null</tt>. * * @param encPass The encrypted password against which to check. * @param rawPass The password to be checked. * @param salt The salt, which will be ignored. It can be null. */ public boolean isPasswordValid(final String encPass, final String rawPass, final Object salt) { checkInitialization(); String decPassword = null; if (this.useTextEncryptor.booleanValue()) { decPassword = this.textEncryptor.decrypt(encPass); } else { decPassword = this.pbeStringEncryptor.decrypt(encPass); } if ((decPassword == null) || (rawPass == null)) { return (decPassword == rawPass); } return decPassword.equals(rawPass); }
String decryptedValue = this.encryptor.decrypt(strValue); if (!originalValue.equals(decryptedValue)) { StringBuilder logMessageBuilder = new StringBuilder("original value={");