Package anbxj

Class Crypto_SealedObject

java.lang.Object
anbxj.Crypto_SealedObject
All Implemented Interfaces:
Serializable

public class Crypto_SealedObject extends Object implements Serializable
Universal sealed (encrypted) container that replaces Crypto_SealedPair in generated code.

Internally the encrypted key, encrypted message and cipher scheme are stored as raw byte arrays - the natural format for Protocol Buffers. Custom Java serialisation guarantees that the wire format is identical to Crypto_SealedPair, making the class compatible with older AnBxJ versions.

See Also:
  • Constructor Details

    • Crypto_SealedObject

      public Crypto_SealedObject(Crypto_SealedPair pair)
      Constructs a new Crypto_SealedObject from an existing Crypto_SealedPair (JavaSer compatibility).

      The sealed key and sealed message inside the pair are serialised to byte arrays so that the object can be stored in a mode-independent way. The original pair is not retained; instead its fields are extracted into the raw byte representation that all serialisers can work with.

      Parameters:
      pair - the old-style sealed pair (must not be null)
      Throws:
      AnBx_LibraryException - if serialisation of the pair's fields fails
    • Crypto_SealedObject

      public Crypto_SealedObject(byte[] encryptedKey, byte[] encryptedMessage, String cipherScheme)
      Constructs a new Crypto_SealedObject from raw fields. This constructor is used when the object is created directly from protobuf fields (e.g. in ProtoBufNew or the new ProtoBuf serialiser).
      Parameters:
      encryptedKey - the encrypted symmetric key (may be null if no key transport is used)
      encryptedMessage - the encrypted message payload
      cipherScheme - the cipher scheme used (e.g. "AES/GCM/NoPadding")
  • Method Details