Package anbxj
Class AnBx_WireFormats
java.lang.Object
anbxj.AnBx_WireFormats
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).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classA language-agnostic representation of a sealed (encrypted) message.static final classA language-agnostic representation of a digitally signed message. -
Method Summary
Modifier and TypeMethodDescriptionstatic ObjectfromProtobufField(com.google.protobuf.ByteString bytes, Class<?> targetType, Crypto_EncryptionEngine engine) Reconstructs a Java object from a Protobuf field value (aByteString).static ObjectfromProtobufFieldToObject(com.google.protobuf.ByteString bytes, Class<?> targetType, Crypto_EncryptionEngine engine) Reconstructs an object that was serialised into a protobuf bytes field.static com.google.protobuf.ByteStringtoProtobufField(Object value) Converts a Java object to a ProtobufByteStringsuitable for use as a field value in a typed-Protobuf payload.
-
Method Details
-
toProtobufField
Converts a Java object to a ProtobufByteStringsuitable for use as a field value in a typed-Protobuf payload.- Parameters:
value- the object to convert- Returns:
- the
ByteStringrepresentation
-
fromProtobufField
public static Object fromProtobufField(com.google.protobuf.ByteString bytes, Class<?> targetType, Crypto_EncryptionEngine engine) Reconstructs a Java object from a Protobuf field value (aByteString).- Parameters:
bytes- the field value as aByteStringtargetType- the expected Java typeengine- 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 aByteStringtargetType- the expected type of the reconstructed objectengine- the cryptographic engine (unused for this operation)- Returns:
- the deserialised object
-