Class SecureVaultUtil

java.lang.Object
org.wso2.carbon.mediation.security.vault.util.SecureVaultUtil

public class SecureVaultUtil extends Object
  • Constructor Details

    • SecureVaultUtil

      public SecureVaultUtil()
  • Method Details

    • loadProperties

      public static Properties loadProperties()
    • getJsonObject

      public static com.google.gson.JsonObject getJsonObject(String encryptedText)
      Decodes a Base64-encoded string into a JSON object.
      Parameters:
      encryptedText - Base64-encoded JSON string.
      Returns:
      Parsed JsonObject.
      Throws:
      org.wso2.securevault.SecureVaultException - If decoding or JSON parsing fails.
    • getValueFromJson

      public static String getValueFromJson(com.google.gson.JsonObject jsonObject, String value)
      Retrieves a string value from a given JsonObject.
      Parameters:
      jsonObject - The JSON object containing the value.
      value - The key whose associated value should be returned.
      Returns:
      The string value mapped to the given key.
      Throws:
      org.wso2.securevault.SecureVaultException - If the key is not present in the JSON object.
    • createSelfContainedCiphertextWithGCMMode

      public static String createSelfContainedCiphertextWithGCMMode(String ciphertext, byte[] iv)
      Creates a self-contained ciphertext with GCM mode.
      Parameters:
      ciphertext - Original ciphertext to be included in the JSON object.
      iv - Initialization vector.
      Returns:
      Base64 encoded JSON object containing the ciphertext and IV.