def _read_password_from_properties(properties, options): database_password = DEFAULT_PASSWORD password_file = get_value_from_properties(properties, JDBC_PASSWORD_PROPERTY, "") if password_file: if is_alias_string(password_file): database_password = decrypt_password_for_alias(properties, JDBC_RCA_PASSWORD_ALIAS, options) else: if os.path.isabs(password_file) and os.path.exists(password_file): with open(password_file, 'r') as file: database_password = file.read() return database_password
def _read_password_from_properties(properties): database_password = DEFAULT_PASSWORD password_file = get_value_from_properties(properties, JDBC_PASSWORD_PROPERTY, "") if password_file: if is_alias_string(password_file): database_password = decrypt_password_for_alias(properties, JDBC_RCA_PASSWORD_ALIAS) else: if os.path.isabs(password_file) and os.path.exists(password_file): with open(password_file, 'r') as file: database_password = file.read() return database_password
def get_truststore_password(properties): truststore_password = properties.get_property(SSL_TRUSTSTORE_PASSWORD_PROPERTY) isSecure = get_is_secure(properties) if truststore_password: if isSecure: truststore_password = decrypt_password_for_alias(properties, SSL_TRUSTSTORE_PASSWORD_ALIAS) else: truststore_password = read_password("", ".*", "Password for TrustStore:", "Invalid characters in password") if truststore_password: encrypted_password = get_encrypted_password(SSL_TRUSTSTORE_PASSWORD_ALIAS, truststore_password, properties) properties.process_pair(SSL_TRUSTSTORE_PASSWORD_PROPERTY, encrypted_password) return truststore_password
def get_and_persist_truststore_password(properties): truststore_password = properties.get_property(SSL_TRUSTSTORE_PASSWORD_PROPERTY) isSecure = get_is_secure(properties) if truststore_password: if isSecure: truststore_password = decrypt_password_for_alias(properties, SSL_TRUSTSTORE_PASSWORD_ALIAS) else: truststore_password = read_password("", ".*", "Password for TrustStore:", "Invalid characters in password") if truststore_password: encrypted_password = get_encrypted_password(SSL_TRUSTSTORE_PASSWORD_ALIAS, truststore_password, properties) properties.process_pair(SSL_TRUSTSTORE_PASSWORD_PROPERTY, encrypted_password) return truststore_password