Package anbxj

Class AnBx_WireFormats

java.lang.Object
anbxj.AnBx_WireFormats

public final class AnBx_WireFormats extends Object
Container for wire-format wrapper classes used in typed Protobuf mode.

These classes replace Java-specific types (@link javax.crypto.SignedObject}, PublicKey, SealedObject) with pure byte-based representations that are language-agnostic. They are used exclusively when the compiler flag jserializer is set to ProtoBuf (typed Protobuf mode). For Java serialisation modes (JavaSer, JavaFramed, ProtoBufOpaque), the traditional Java crypto classes are still used.

All classes in this container implement Serializable so they can also be used with Java serialisation (e.g. during testing or fallback).

  • Method Details

    • toProtobufField

      public static com.google.protobuf.ByteString toProtobufField(Object value)
      Converts a Java object to a Protobuf ByteString suitable for use as a field value in a typed-Protobuf payload.
      Parameters:
      value - the object to convert
      Returns:
      the ByteString representation
    • fromProtobufField

      public static Object fromProtobufField(com.google.protobuf.ByteString bytes, Class<?> targetType, Crypto_EncryptionEngine engine)
      Reconstructs a Java object from a Protobuf field value (a ByteString).
      Parameters:
      bytes - the field value as a ByteString
      targetType - the expected Java type
      engine - the cryptographic engine (used to guess key algorithms)
      Returns:
      the reconstructed object
    • fromProtobufFieldToObject

      public static Object fromProtobufFieldToObject(com.google.protobuf.ByteString bytes, Class<?> targetType, Crypto_EncryptionEngine engine)
      Reconstructs an object that was serialised into a protobuf bytes field.

      The bytes are first extracted as a Crypto_ByteArray, then deserialised back to the original Java object using Java serialisation.

      Parameters:
      bytes - the protobuf field value as a ByteString
      targetType - the expected type of the reconstructed object
      engine - the cryptographic engine (unused for this operation)
      Returns:
      the deserialised object