Package org.webpki.jose.jws
Class JWSSigner
java.lang.Object
org.webpki.jose.jws.JWSSigner
- Direct Known Subclasses:
JWSAsymKeySigner
,JWSHmacSigner
JWS encoder base class
-
Method Summary
Modifier and TypeMethodDescriptionaddHeaderItems
(JSONObjectReader items) Add header elements.Adds "kid" to the JWS header.setProvider
(String provider) Set cryptographic provider.sign
(byte[] jwsPayload, boolean detached) Create compact mode JWS object.sign
(JSONObjectWriter objectToBeSigned, String signatureProperty) Create JWS/CT object.
-
Method Details
-
setProvider
Set cryptographic provider.- Parameters:
provider
- Name of provider like "BC"- Returns:
- JwsSigner
-
setKeyId
Adds "kid" to the JWS header.- Parameters:
keyId
- The key identifier to be included.- Returns:
- JwsSigner
-
addHeaderItems
Add header elements.- Parameters:
items
- A set of JSON tokens- Returns:
- JwsSigner
-
sign
Create JWS/CT object.- Parameters:
objectToBeSigned
- The JSON object to be signedsignatureProperty
- Name of property holding the "detached" JWS- Returns:
- The now signed
objectToBeSigned
-
sign
Create compact mode JWS object. Note that the detached mode follows the specification described in https://tools.ietf.org/html/rfc7515#appendix-F.- Parameters:
jwsPayload
- Binary payloaddetached
- True if payload is not to be supplied in the JWS string- Returns:
- JWS compact (string)
-