I'm trying to play with jose4j and for example I tried to verify JsonWebSignature without setting the first part of CompactSerialization (as we use unprotected header).
It returns me
org.jose4j.lang.JoseException: Parsing error: org.jose4j.json.internal.json_simple.parser.ParseException: Unexpected character (�) at position 0.
Do you have any idea to permit that?
Thanks
Edit
Code is:
JsonWebSignature jws = new JsonWebSignature();
LicenseKeystore lk = new LicenseKeystore();
jws.setAlgorithmConstraints(new AlgorithmConstraints(ConstraintType.PERMIT, lk.KS_ALG));
JsonCanonicalizer jc = new JsonCanonicalizer(jsonSigned);
jws.setCompactSerialization(new Base64Url().base64UrlEncodeUtf8ByteRepresentation(null) + "." +
new Base64Url().base64UrlEncodeUtf8ByteRepresentation(jc.getEncodedString()) + "." +
cs.getSignature());
jws.setKey(lk.getPublicKey());
try {
return jws.verifySignature();
} catch (InvalidAlgorithmException e) {
return false;
}
JWS is in the type of .[payload].[signature]