WrappedCertificate response = new WrappedCertificate();
response.certificate = new Certificate();
Auth auth = getAuth();
User user = auth.getUser();
if (user == null) {
throw new WebApplicationException(Status.UNAUTHORIZED);
}
X500Principal subject = new X500Principal("CN=" + "user-" + user.getId());
CertificateAndKey certificateAndKey = createSelfSigned(subject, 2048);
response.certificate.privateKey = Hex.toHex(certificateAndKey.getPrivateKey().getEncoded());
response.certificate.data = Hex.toHex(certificateAndKey.getPublicKey().getEncoded());