Use PublicJsonWebKey instead of JsonWebKey

pull/17/merge
Richard Körber 2015-12-24 16:13:16 +01:00
parent f87dba266f
commit 34c7950c75
2 changed files with 4 additions and 3 deletions

View File

@ -33,7 +33,7 @@ import java.util.regex.Pattern;
import org.jose4j.base64url.Base64Url; import org.jose4j.base64url.Base64Url;
import org.jose4j.json.JsonUtil; import org.jose4j.json.JsonUtil;
import org.jose4j.jwk.JsonWebKey; import org.jose4j.jwk.PublicJsonWebKey;
import org.jose4j.jws.AlgorithmIdentifiers; import org.jose4j.jws.AlgorithmIdentifiers;
import org.jose4j.jws.JsonWebSignature; import org.jose4j.jws.JsonWebSignature;
import org.jose4j.lang.JoseException; import org.jose4j.lang.JoseException;
@ -140,7 +140,7 @@ public class DefaultConnection implements Connection {
conn.setRequestProperty("Content-Type", "application/json"); conn.setRequestProperty("Content-Type", "application/json");
conn.setDoOutput(true); conn.setDoOutput(true);
final JsonWebKey jwk = JsonWebKey.Factory.newJwk(keypair.getPublic()); final PublicJsonWebKey jwk = PublicJsonWebKey.Factory.newPublicJwk(keypair.getPublic());
JsonWebSignature jws = new JsonWebSignature(); JsonWebSignature jws = new JsonWebSignature();
jws.setPayload(claims.toString()); jws.setPayload(claims.toString());

View File

@ -22,6 +22,7 @@ import java.util.TreeMap;
import org.jose4j.base64url.Base64Url; import org.jose4j.base64url.Base64Url;
import org.jose4j.json.JsonUtil; import org.jose4j.json.JsonUtil;
import org.jose4j.jwk.JsonWebKey; import org.jose4j.jwk.JsonWebKey;
import org.jose4j.jwk.PublicJsonWebKey;
import org.jose4j.lang.JoseException; import org.jose4j.lang.JoseException;
import org.shredzone.acme4j.connector.Resource; import org.shredzone.acme4j.connector.Resource;
@ -122,7 +123,7 @@ public class ClaimBuilder {
} }
try { try {
final JsonWebKey jwk = JsonWebKey.Factory.newJwk(publickey); final PublicJsonWebKey jwk = PublicJsonWebKey.Factory.newPublicJwk(publickey);
Map<String, Object> jwkParams = jwk.toParams(JsonWebKey.OutputControlLevel.PUBLIC_ONLY); Map<String, Object> jwkParams = jwk.toParams(JsonWebKey.OutputControlLevel.PUBLIC_ONLY);
object(key).putAll(jwkParams); object(key).putAll(jwkParams);
return this; return this;