Package org.webpki.cbor
Class CBORSigner<T extends CBORSigner<?>>
java.lang.Object
org.webpki.cbor.CBORSigner<T>
- Direct Known Subclasses:
CBORAsymKeySigner,CBORHmacSigner,CBORX509Signer
Base class for signing data.
This implementation supports signatures using CSF (CBOR Signature Format) packaging, while algorithms are derived from COSE.
Note that signer objects may be used any number of times (assuming that the same parameters are valid). They are also thread-safe.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionsetCloneMode(boolean flag) Set clone mode.setIntercepter(CBORCryptoUtils.Intercepter intercepter) Set optional Intercepter.setKeyId(CBORObject keyId) Set signaturekeyId.setMultiSignatureMode(boolean flag) Set multiple signature mode.setProvider(String provider) Set cryptographic provider.sign(CBORObject objectToSign) Sign CBOR object.
-
Method Details
-
setIntercepter
Set optional Intercepter.- Parameters:
intercepter- An instance of Intercepter- Returns:
thisof subclass
-
setKeyId
Set signaturekeyId. In the case the public key is not provided in the signature object, the signature key may be tied to an identifier known by the relying party. How such an identifier is used to retrieve the proper public key is up to a convention between the parties using a specific message scheme. AkeyIdmay be a database index, a hash of the public key, a text string, or a URL pointing to a public key in PEM format.For HMAC-signatures, a
keyIdor implicit key are the only ways to retrieve the proper secret key.Note that a
keyIdargument ofnullis equivalent to the default (= nokeyId).- Parameters:
keyId- Key Id ornull- Returns:
thisof subclass
-
setProvider
Set cryptographic provider.- Parameters:
provider- Name of provider like "BC"- Returns:
thisof subclass
-
setCloneMode
Set clone mode.By default the
sign(CBORObject)method overwrites the inputmapobject.- Parameters:
flag- Iftrueinput data will be cloned- Returns:
thisof subclass
-
setMultiSignatureMode
Set multiple signature mode.By default the
sign(CBORObject)method assumes single signature mode.- Parameters:
flag- Iftruemultiple signature mode is assumed- Returns:
thisof subclass
-
sign
Sign CBOR object.Adds an embedded CSF object (signature) to a CBOR map.
Note that the map to be signed may be wrapped in a tag.Also see
setCloneMode(boolean).- Parameters:
objectToSign- CBOR map or tag(map) to be signed- Returns:
- Signed object
-