Package org.webpki.cbor
Class CBORValidator
java.lang.Object
org.webpki.cbor.CBORValidator
- Direct Known Subclasses:
CBORAsymKeyValidator
,CBORHmacValidator
,CBORX509Validator
Base class for validating signatures.
Also see CBORSigner
.
Note that validator objects may be used any number of times (assuming that the same parameters are valid). They are also thread-safe.
-
Method Summary
Modifier and TypeMethodDescriptionsetCustomDataPolicy
(CBORCryptoUtils.POLICY customDataPolicy, CBORCryptoUtils.Collector customDataCollector) Sets custom data policy.setTagPolicy
(CBORCryptoUtils.POLICY tagPolicy, CBORCryptoUtils.Collector tagCollector) Sets tag wrapping policy.validate
(CBORObject key, CBORObject signedObject) Validates signed CBOR object.
-
Method Details
-
setCustomDataPolicy
public CBORValidator setCustomDataPolicy(CBORCryptoUtils.POLICY customDataPolicy, CBORCryptoUtils.Collector customDataCollector) Sets custom data policy.By default custom data elements (
CBORCryptoConstants.CUSTOM_DATA_LABEL
) are rejected (CBORCryptoUtils.POLICY.FORBIDDEN
).Also see crypto options.
- Parameters:
customDataPolicy
- Define level of supportcustomDataCollector
- Interface for reading custom data- Returns:
this
-
setTagPolicy
public CBORValidator setTagPolicy(CBORCryptoUtils.POLICY tagPolicy, CBORCryptoUtils.Collector tagCollector) Sets tag wrapping policy.By default tagged CSF containers are rejected (
CBORCryptoUtils.POLICY.FORBIDDEN
).Also see crypto options.
- Parameters:
tagPolicy
- Define level of supporttagCollector
- Interface for reading tag- Returns:
this
-
validate
Validates signed CBOR object.This method presumes that
signedObject
holds an enveloped signature according to CSF.- Parameters:
key
- Key in map holding signaturesignedObject
- Signed CBOR object- Returns:
- The original
signedObject
-