我有一个问题,当我在签名后提出索赔时,我得到的密钥是无效的,无法得到原因。
*code:*
OctetSequenceJsonWebKey key = OctJwkGenerator.generateJwk(2048);
JsonWebSignature jws = new JsonWebSignature();
jws.setKey(key.getKey());
jws.setPayload(claims.toJson());
jws.setAlgorithmHeaderValue(AlgorithmIdentifiers.HMAC_SHA256);
signedJWT = jws.getCompactSerialization();
return signedJWT;发布于 2016-06-12 05:12:27
对于Hmac算法,您应该使用一个八进制密钥。从您的代码中,我可以看到您正在加载一个RSA密钥(RsaJsonWebKey)。
https://stackoverflow.com/questions/37745788
复制相似问题