Package org.forgerock.json.crypto
Class JsonCrypto
java.lang.Object
org.forgerock.json.crypto.JsonCrypto
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 Summary
ConstructorDescriptionConstructs an empty JSON cryptographic object.JsonCrypto
(String type, JsonValue value) Constructs a new JSON cryptographic object, initializing with the specified type and cryptographic value.JsonCrypto
(JsonValue value) Constructs a new JSON cryptographic object, initializing from a JSON value. -
Method Summary
Modifier and TypeMethodDescriptionvoid
fromJsonValue
(JsonValue value) Initializes this object from the specified$crypto
JSON object value.getType()
Returns the type of JSON cryptographic representation.getValue()
Returns the JSON cryptographic value.static boolean
isJsonCrypto
(JsonValue value) Returnstrue
if the specified JSON value contains a valid$crypto
JSON object structure.void
Sets the type of JSON cryptographic representation.void
Sets the JSON cryptographic value.Returns this object as a$crypto
JSON object value.
-
Constructor Details
-
JsonCrypto
public JsonCrypto()Constructs an empty JSON cryptographic object. -
JsonCrypto
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
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
Returnstrue
if the specified JSON value contains a valid$crypto
JSON object structure.- Parameters:
value
- The JSON to check.- Returns:
- The result.
-
getType
Returns the type of JSON cryptographic representation.- Returns:
- The type.
-
setType
Sets the type of JSON cryptographic representation.- Parameters:
type
- the type of JSON cryptographic representation.
-
getValue
Returns the JSON cryptographic value.- Returns:
- The value.
-
setValue
Sets the JSON cryptographic value.- Parameters:
value
- the JSON cryptographic value.
-
fromJsonValue
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
Returns this object as a$crypto
JSON object value.- Returns:
- The value.
-