Class VortexMessage
- All Implemented Interfaces:
Serializable,Block,Dumpable
The main class representing the main message object.
This part is specified as vortexMessage in the file asn.1/messageBlocks.asn1
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final longFields inherited from class net.messagevortex.asn1.AbstractBlock
CRLF -
Constructor Summary
ConstructorsConstructorDescriptionVortexMessage(byte[] b, AsymmetricKey dk) Parses a byte array to a VortexMessage.VortexMessage(InputStream is, AsymmetricKey dk) Parses a byte array to a VortexMessage.VortexMessage(PrefixBlock pre, InnerMessageBlock im) Creates a new message block. -
Method Summary
Modifier and TypeMethodDescriptiondumpValueNotation(String prefix) Dumps an ASN.1 value notation of a vortexMessage (PUBLIC_ONLY dump type).dumpValueNotation(String prefix, DumpType dt) Dumps a ASN.1 value notation of a vortexMessage.booleanstatic longgetBytesAsLong(byte[] b) Converts a number of bytes into a long representation (LSB).final AsymmetricKeySet the currently set encryption/decryption decryptionKey (asymmetric).final InnerMessageBlockgets the embedded inner message block.static byte[]getLongAsBytes(long i) Converts an unsigned long value into a 32 bit byte array representation (LSB).static byte[]getLongAsBytes(long i, int num) converts an unsigned long value into a byte array representation (LSB).final PrefixBlockGets the embedded prefix block.inthashCode()protected final voidparse(byte[] p) protected voidparse(InputStream is) protected voidparse(org.bouncycastle.asn1.ASN1Encodable p) final AsymmetricKeySet the encryption/decryption decryptionKey.final InnerMessageBlockSetter for the inner message block.final PrefixBlocksetPrefix(PrefixBlock pre) Sets the embedded prefix block.org.bouncycastle.asn1.ASN1ObjecttoAsn1Object(DumpType dt) Dumps the object a ASN1Object.byte[]Build the binary represenattion for a vortexMessage.Methods inherited from class net.messagevortex.asn1.AbstractBlock
fromBase64, fromHex, prepareDump, toBase64, toBitString, toBytes, toDer, toHex
-
Field Details
-
serialVersionUID
public static final long serialVersionUID- See Also:
-
PREFIX_PLAIN
public static final int PREFIX_PLAIN- See Also:
-
PREFIX_ENCRYPTED
public static final int PREFIX_ENCRYPTED- See Also:
-
INNER_MESSAGE_PLAIN
public static final int INNER_MESSAGE_PLAIN- See Also:
-
INNER_MESSAGE_ENCRYPTED
public static final int INNER_MESSAGE_ENCRYPTED- See Also:
-
-
Constructor Details
-
VortexMessage
Parses a byte array to a VortexMessage.
- Parameters:
is- the input stream to be parseddk- the decryptionKey required to decrypt the prefix- Throws:
IOException- if there was a problem parsing or decrypting the object
-
VortexMessage
Parses a byte array to a VortexMessage.
- Parameters:
b- the byte array to be parseddk- the decryptionKey required to decrypt the prefix- Throws:
IOException- if there was a problem parsing or decrypting the object
-
VortexMessage
Creates a new message block.
- Parameters:
pre- the prefix block to useim- the inner message block to use- Throws:
IOException- if there was an error generating the kay
-
-
Method Details
-
getInnerMessage
gets the embedded inner message block.
- Returns:
- the message block
-
setInnerMessage
Setter for the inner message block.
- Parameters:
im- the new inner message block- Returns:
- the previously set inner message block
-
getPrefix
Gets the embedded prefix block.
- Returns:
- the prefix block
-
setPrefix
Sets the embedded prefix block.
- Parameters:
pre- the new prefix block- Returns:
- the prefix block which was set prior to the operation
-
getDecryptionKey
Set the currently set encryption/decryption decryptionKey (asymmetric).
- Returns:
- the decryptionKey or null if not set
-
setDecryptionKey
Set the encryption/decryption decryptionKey.
- Parameters:
dk- sets the decryption key- Returns:
- the decryptionKey which has been set previously or null if the decryptionKey ha not been set
- Throws:
IOException- if setting fails
-
parse
- Overrides:
parsein classAbstractBlock- Throws:
IOException
-
parse
- Throws:
IOException
-
parse
- Specified by:
parsein classAbstractBlock- Throws:
IOException
-
toAsn1Object
Dumps the object a ASN1Object.
This method is mainly useful for diagnostic purposes.
- Specified by:
toAsn1Objectin interfaceDumpable- Parameters:
dt- the dumpType to apply- Returns:
- the requested object as ASN1Object
- Throws:
IOException- if any object or subobject can not be dumped
-
dumpValueNotation
Dumps an ASN.1 value notation of a vortexMessage (PUBLIC_ONLY dump type).
- Parameters:
prefix- the line prefix to be used (typically "")- Returns:
- an ASN.1 representation of the vortexMessage
- Throws:
IOException- if message i not encodable due to an incomplete/invalid object state
-
dumpValueNotation
Dumps a ASN.1 value notation of a vortexMessage.
- Specified by:
dumpValueNotationin interfaceBlock- Parameters:
prefix- the line prefix to be used (typically "")dt- specifies the type of dump.- Returns:
- an ASN.1 representation of the vortexMessage
- Throws:
IOException- if message i not encodable due to an incomplete/invalid object state
-
toBinary
Build the binary represenattion for a vortexMessage.
This method returns the binary (length prefixed) representation of a vortex message.
- Parameters:
dt- specifies the type of dump. for sending use PUBLIC_ONLY- Returns:
- the binary representation of the vortexMessage
- Throws:
IOException- if dumping fails
-
getLongAsBytes
public static byte[] getLongAsBytes(long i, int num) converts an unsigned long value into a byte array representation (LSB).
- Parameters:
i- the long value to be convertednum- the number of bytes to be returned- Returns:
- the unsigned byte array representation
-
getLongAsBytes
public static byte[] getLongAsBytes(long i) Converts an unsigned long value into a 32 bit byte array representation (LSB).
- Parameters:
i- the long value to be converted- Returns:
- the unsigned byte array of length 4 representation
-
getBytesAsLong
public static long getBytesAsLong(byte[] b) Converts a number of bytes into a long representation (LSB).
- Parameters:
b- the byte array to be converted to long- Returns:
- the long representation of the byte array
-
equals
-
hashCode
public int hashCode()
-