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
ConstructorsConstructorDescriptionConstructs 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 TypeMethodDescriptionvoidfromJsonValue(JsonValue value) Initializes this object from the specified$cryptoJSON object value.getType()Returns the type of JSON cryptographic representation.getValue()Returns the JSON cryptographic value.static booleanisJsonCrypto(JsonValue value) Returnstrueif the specified JSON value contains a valid$cryptoJSON object structure.voidSets the type of JSON cryptographic representation.voidSets the JSON cryptographic value.Returns this object as a$cryptoJSON 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$cryptoJSON 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
Returnstrueif the specified JSON value contains a valid$cryptoJSON 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$cryptoJSON object value.- Parameters:
value- a JSON value containing a$cryptoJSON object value.- Throws:
JsonValueException- if the specified value is malformed.
-
toJsonValue
Returns this object as a$cryptoJSON object value.- Returns:
- The value.
-