Class CBOREncrypter<T extends CBOREncrypter<T>>

java.lang.Object
org.webpki.cbor.CBOREncrypter<T>
Direct Known Subclasses:
CBORAsymKeyEncrypter, CBORSymKeyEncrypter, CBORX509Encrypter

public abstract class CBOREncrypter<T extends CBOREncrypter<T>> extends Object
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 Details

    • setIntercepter

      public T setIntercepter(CBORCryptoUtils.Intercepter intercepter)
      Set optional Intercepter.
      Parameters:
      intercepter - An instance of Intercepter
      Returns:
      this of subclass
    • setKeyId

      public T setKeyId(CBORObject keyId)
      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 of null is equivalent to the default (= no keyId).

      Parameters:
      keyId - Key Id or null
      Returns:
      this of substack
    • encrypt

      public CBORObject encrypt(byte[] dataToEncrypt)
      Encrypt data.
      Parameters:
      dataToEncrypt - The data to encrypt
      Returns:
      CBOR encryption object