protected void initCipherDecryptProvider() {
    if (decryptionProvider != null) return;
    Properties properties = SecureVaultUtil.loadProperties();
    StringBuffer sb = new StringBuffer();
    // sb.append(id);
    sb.append(DOT);
    sb.append(LOCATION);

    StringBuffer sbTwo = new StringBuffer();
    // sbTwo.append(id);
    sbTwo.append(DOT);
    sbTwo.append(ALGORITHM);
    // Load algorithm
    String algorithm =
        MiscellaneousUtil.getProperty(properties, sbTwo.toString(), DEFAULT_ALGORITHM);
    StringBuffer buffer = new StringBuffer();
    buffer.append(DOT);
    buffer.append(KEY_STORE);

    // Load keyStore
    String keyStore = MiscellaneousUtil.getProperty(properties, buffer.toString(), null);

    KeyStoreWrapper keyStoreWrapper;

    if (TRUSTED.equals(keyStore)) {
      keyStoreWrapper = trustKeyStoreWrapper;

    } else {
      keyStoreWrapper = identityKeyStoreWrapper;
    }

    CipherInformation cipherInformation = new CipherInformation();
    cipherInformation.setAlgorithm(algorithm);
    cipherInformation.setCipherOperationMode(CipherOperationMode.DECRYPT);
    cipherInformation.setInType(EncodingType.BASE64); // TODO
    decryptionProvider = CipherFactory.createCipher(cipherInformation, keyStoreWrapper);
  }
  private boolean init() {

    Properties properties = SecureVaultUtil.loadProperties(); // loadProperties();

    if (properties == null) {
      log.error("KeyStore configuration properties cannot be found");
      return false;
    }

    String configurationFile =
        MiscellaneousUtil.getProperty(
            properties,
            SecureVaultConstants.PROP_SECRET_MANAGER_CONF,
            SecureVaultConstants.PROP_DEFAULT_CONF_LOCATION);

    Properties configurationProperties = MiscellaneousUtil.loadProperties(configurationFile);
    if (configurationProperties == null || configurationProperties.isEmpty()) {
      if (log.isDebugEnabled()) {
        log.debug(
            "Configuration properties can not be loaded form : "
                + configurationFile
                + " Will use synapse properties");
      }
      configurationProperties = properties;
    }

    globalSecretProvider =
        MiscellaneousUtil.getProperty(
            configurationProperties, SecureVaultConstants.PROP_SECRET_PROVIDER, null);
    if (globalSecretProvider == null || "".equals(globalSecretProvider)) {
      if (log.isDebugEnabled()) {
        log.debug("No global secret provider is configured.");
      }
    }

    String repositoriesString =
        MiscellaneousUtil.getProperty(
            configurationProperties, SecureVaultConstants.PROP_SECRET_REPOSITORIES, null);
    if (repositoriesString == null || "".equals(repositoriesString)) {
      log.error("No secret repositories have been configured");
      return false;
    }

    String[] repositories = repositoriesString.split(",");
    if (repositories == null || repositories.length == 0) {
      log.error("No secret repositories have been configured");
      return false;
    }

    // Create a KeyStore Information for private key entry KeyStore
    IdentityKeyStoreInformation identityInformation =
        KeyStoreInformationFactory.createIdentityKeyStoreInformation(properties);

    // Create a KeyStore Information for trusted certificate KeyStore
    TrustKeyStoreInformation trustInformation =
        KeyStoreInformationFactory.createTrustKeyStoreInformation(properties);

    String identityKeyPass = null;
    String identityStorePass = null;
    String trustStorePass = null;
    if (identityInformation != null) {
      identityKeyPass = identityInformation.getKeyPasswordProvider().getResolvedSecret();
      identityStorePass = identityInformation.getKeyStorePasswordProvider().getResolvedSecret();
    }

    if (trustInformation != null) {
      trustStorePass = trustInformation.getKeyStorePasswordProvider().getResolvedSecret();
    }

    if (!validatePasswords(identityStorePass, identityKeyPass, trustStorePass)) {

      log.error(
          "Either Identity or Trust keystore password is mandatory"
              + " in order to initialized secret manager.");
      return false;
    }

    identityKeyStoreWrapper = new IdentityKeyStoreWrapper();
    identityKeyStoreWrapper.init(identityInformation, identityKeyPass);

    trustKeyStoreWrapper = new TrustKeyStoreWrapper();
    if (trustInformation != null) {
      trustKeyStoreWrapper.init(trustInformation);
    }

    SecretRepository currentParent = null;
    for (String secretRepo : repositories) {

      StringBuffer sb = new StringBuffer();
      sb.append(SecureVaultConstants.PROP_SECRET_REPOSITORIES);
      sb.append(SecureVaultConstants.DOT);
      sb.append(secretRepo);
      String id = sb.toString();
      sb.append(SecureVaultConstants.DOT);
      sb.append(SecureVaultConstants.PROP_PROVIDER);

      String provider = MiscellaneousUtil.getProperty(configurationProperties, sb.toString(), null);
      if (provider == null || "".equals(provider)) {
        handleException("Repository provider cannot be null ");
      }

      if (log.isDebugEnabled()) {
        log.debug("Initiating a File Based Secret Repository");
      }
    }
    return true;
  }