com.ironcorelabs.WrapResponse Maven / Gradle / Ivy
The newest version!
package com.ironcorelabs;
import com.google.api.client.util.Key;
import java.util.Base64;
/**
* Represents the JSON response object from the document/wrap endpoint which
* includes a new DEK and it's encrypted form (EDEK) both in Base64 format.
*/
public class WrapResponse {
@Key
private String dek;
@Key
private String edek;
public byte[] getDEKBytes() {
try {
return Base64.getDecoder().decode(this.dek);
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException("Wrap DEK response from CMK server was not valid base64.");
}
}
public String getEDEK() {
return this.edek;
}
}