Class SecureVaultUtil
java.lang.Object
org.wso2.carbon.mediation.security.vault.util.SecureVaultUtil
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringcreateSelfContainedCiphertextWithGCMMode(String ciphertext, byte[] iv) Creates a self-contained ciphertext with GCM mode.static com.google.gson.JsonObjectgetJsonObject(String encryptedText) Decodes a Base64-encoded string into a JSON object.static StringgetValueFromJson(com.google.gson.JsonObject jsonObject, String value) Retrieves a string value from a givenJsonObject.static Properties
-
Constructor Details
-
SecureVaultUtil
public SecureVaultUtil()
-
-
Method Details
-
loadProperties
-
getJsonObject
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
Retrieves a string value from a givenJsonObject.- 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
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.
-