Package org.webpki.cbor
Class CBOREncrypter<T extends CBOREncrypter<T>>
java.lang.Object
org.webpki.cbor.CBOREncrypter<T>
- Direct Known Subclasses:
CBORAsymKeyEncrypter
,CBORSymKeyEncrypter
,CBORX509Encrypter
Base class for encrypting data.
This implementation supports encryptions using CEF (CBOR Encryption Format) packaging, while algorithms are derived from COSE.
Note that encrypter 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 TypeMethodDescriptionencrypt
(byte[] dataToEncrypt) Encrypt data.setIntercepter
(CBORCryptoUtils.Intercepter intercepter) Set optional Intercepter.setKeyId
(CBORObject keyId) Set optional key Id.
-
Method Details
-
setIntercepter
Set optional Intercepter.- Parameters:
intercepter
- An instance of Intercepter- Returns:
this
of subclass
-
setKeyId
Set optional key Id. In the case the public key is not provided in the object, the encryption key may be tied to an identifier known by the recipient. How such an identifier is used to retrieve the proper private key is up to a convention between the parties using a specific message scheme. A keyId may be a database index, a hash of the public key, or a text string.For symmetric key-algorithms, a keyId or implicit key are the only ways to retrieve the proper secret key.
Note that a
keyId
argument ofnull
is equivalent to the default (= nokeyId
).- Parameters:
keyId
- Key Id ornull
- Returns:
this
of substack
-
encrypt
Encrypt data.- Parameters:
dataToEncrypt
- The data to encrypt- Returns:
- CBOR encryption object
-