Class PolicyUtils
java.lang.Object
org.opencastproject.urlsigning.utils.PolicyUtils
A Utility class to encode / decode Policy files from and to Base 64 and Json.
-
Method Summary
Modifier and TypeMethodDescriptionstatic Stringbase64Decode(String value) Decode aStringfrom Base 64 encodingstatic Stringbase64Encode(String value) Encode aStringinto Base 64 encodingstatic PolicyfromBase64EncodedPolicy(String encodedPolicy) Create aPolicyin Json format and Base 64 encoded.static PolicyGet aPolicyfrom JSON data.static StringgetPolicySignature(Policy policy, String encryptionKey) Get an encrypted version of aPolicyto use as a signature.static StringtoBase64EncodedPolicy(Policy policy) Create aPolicyin Json format and Base 64 encoded.static org.json.simple.JSONObjectRender aPolicyinto JSON.
-
Method Details
-
base64Encode
Encode aStringinto Base 64 encoding -
base64Decode
Decode aStringfrom Base 64 encoding -
fromJson
Get aPolicyfrom JSON data. -
toJson
Render aPolicyinto JSON. -
fromBase64EncodedPolicy
Create aPolicyin Json format and Base 64 encoded. -
toBase64EncodedPolicy
Create aPolicyin Json format and Base 64 encoded. -
getPolicySignature
Get an encrypted version of aPolicyto use as a signature.- Parameters:
policy-Policythat needs to be encrypted.encryptionKey- The key to use to encrypt thePolicy.- Returns:
- An encrypted version of the
Policythat is also Base64 encoded to make it safe to transmit as a query parameter. - Throws:
Exception- Thrown if there is a problem encrypting or encoding thePolicy
-