Class JsonCrypto

java.lang.Object
org.forgerock.json.crypto.JsonCrypto

public class JsonCrypto extends Object
Represents a JSON $crypto object. For example:
 "$crypto":{
     "value":{
         "data":"wfoQJXXXXTa551pKTMjZ/Q==",
         "cipher":"AES/CBC/PKCS5Padding",
         "iv":"OXHdtVBURv6fAuRa88CDnA==",
         "key":"openidm-sym-default"
     },
     "type":"x-simple-encryption"
 }
 
See Also:
  • Constructor Details

    • JsonCrypto

      public JsonCrypto()
      Constructs an empty JSON cryptographic object.
    • JsonCrypto

      public JsonCrypto(JsonValue value) throws JsonValueException
      Constructs a new JSON cryptographic object, initializing from a JSON value.
      Parameters:
      value - a JSON value containing a $crypto JSON object value.
      Throws:
      JsonValueException - if the specified value is malformed.
    • JsonCrypto

      public JsonCrypto(String type, JsonValue value)
      Constructs a new JSON cryptographic object, initializing with the specified type and cryptographic value.
      Parameters:
      type - the type of JSON cryptographic representation.
      value - the JSON cryptographic value.
  • Method Details

    • isJsonCrypto

      public static boolean isJsonCrypto(JsonValue value)
      Returns true if the specified JSON value contains a valid $crypto JSON object structure.
      Parameters:
      value - The JSON to check.
      Returns:
      The result.
    • getType

      public String getType()
      Returns the type of JSON cryptographic representation.
      Returns:
      The type.
    • setType

      public void setType(String type)
      Sets the type of JSON cryptographic representation.
      Parameters:
      type - the type of JSON cryptographic representation.
    • getValue

      public JsonValue getValue()
      Returns the JSON cryptographic value.
      Returns:
      The value.
    • setValue

      public void setValue(JsonValue value)
      Sets the JSON cryptographic value.
      Parameters:
      value - the JSON cryptographic value.
    • fromJsonValue

      public void fromJsonValue(JsonValue value) throws JsonValueException
      Initializes this object from the specified $crypto JSON object value.
      Parameters:
      value - a JSON value containing a $crypto JSON object value.
      Throws:
      JsonValueException - if the specified value is malformed.
    • toJsonValue

      public JsonValue toJsonValue()
      Returns this object as a $crypto JSON object value.
      Returns:
      The value.