Tagged and Custom Container Data

The CBOR library contains support for wrapping CSF and CEF containers in a CBORTag as well as including a customData element.

In both cases the added information becomes a part of the authenticated (signed) data.

Note that these options represent extensions that in order to be accepted during validation respectively decryption, must be preceded by setting a for the application suitable policy (CBORCryptoUtils.POLICY).

Creating Tagged Containers

Creating a tagged CSF or CEF container is performed by calling CBORSigner.setIntercepter(CBORCryptoUtils.Intercepter) and CBOREncrypter.setIntercepter(CBORCryptoUtils.Intercepter) respectively, where CBORCryptoUtils.Intercepter.wrap(CBORMap) is supposed to do the actual wrapping.

Decoding Tagged Containers

Decoding the tag of a tagged CSF or CEF container is performed by calling CBORValidator.setTagPolicy(CBORCryptoUtils.POLICY,CBORCryptoUtils.Collector) and CBORDecrypter.setTagPolicy(CBORCryptoUtils.POLICY,CBORCryptoUtils.Collector) respectively, where CBORCryptoUtils.Collector.foundData(CBORObject) returns the actual tag object or null if the container is not tagged.

Creating Custom Data

Adding custom data to CSF or CEF containers is performed by calling CBORSigner.setIntercepter(CBORCryptoUtils.Intercepter) and CBOREncrypter.setIntercepter(CBORCryptoUtils.Intercepter) respectively, where CBORCryptoUtils.Intercepter.getCustomData() is supposed to provide the actual data.

Decoding Custom Data

Decoding custom data in a CSF or CEF container is performed by calling CBORValidator.setCustomDataPolicy(CBORCryptoUtils.POLICY,CBORCryptoUtils.Collector) and CBORDecrypter.setCustomDataPolicy(CBORCryptoUtils.POLICY,CBORCryptoUtils.Collector) respectively, where CBORCryptoUtils.Collector.foundData(CBORObject) returns the actual data or null if the container does not contain such data.