public class VortexMessage extends AbstractBlock implements Serializable
The main class representing the main message object.
This part is specified as vortexMessage in the file asn.1/messageBlocks.asn1
Modifier and Type | Field and Description |
---|---|
static int |
INNER_MESSAGE_ENCRYPTED |
static int |
INNER_MESSAGE_PLAIN |
static int |
PREFIX_ENCRYPTED |
static int |
PREFIX_PLAIN |
static long |
serialVersionUID |
CRLF
Constructor and Description |
---|
VortexMessage(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.
|
Modifier and Type | Method and Description |
---|---|
String |
dumpValueNotation(String prefix)
Dumps an ASN.1 value notation of a vortexMessage (PUBLIC_ONLY dump type).
|
String |
dumpValueNotation(String prefix,
DumpType dt)
Dumps a ASN.1 value notation of a vortexMessage.
|
boolean |
equals(Object o) |
static long |
getBytesAsLong(byte[] b)
Converts a number of bytes into a long representation (LSB).
|
AsymmetricKey |
getDecryptionKey()
Set the currently set encryption/decryption decryptionKey (asymmetric).
|
InnerMessageBlock |
getInnerMessage()
gets 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).
|
PrefixBlock |
getPrefix()
Gets the embedded prefix block.
|
int |
hashCode() |
protected void |
parse(org.bouncycastle.asn1.ASN1Encodable p) |
protected void |
parse(byte[] p) |
protected void |
parse(InputStream is) |
AsymmetricKey |
setDecryptionKey(AsymmetricKey dk)
Set the encryption/decryption decryptionKey.
|
InnerMessageBlock |
setInnerMessage(InnerMessageBlock im)
Setter for the inner message block.
|
PrefixBlock |
setPrefix(PrefixBlock pre)
Sets the embedded prefix block.
|
org.bouncycastle.asn1.ASN1Object |
toAsn1Object(DumpType dt)
Dumps the object a ASN1Object.
|
byte[] |
toBinary(DumpType dt)
Build the binary represenattion for a vortexMessage.
|
fromBase64, fromHex, prepareDump, toBase64, toBitString, toBytes, toDer, toHex
public static final long serialVersionUID
public static final int PREFIX_PLAIN
public static final int PREFIX_ENCRYPTED
public static final int INNER_MESSAGE_PLAIN
public static final int INNER_MESSAGE_ENCRYPTED
public VortexMessage(InputStream is, AsymmetricKey dk) throws IOException
Parses a byte array to a VortexMessage.
is
- the input stream to be parseddk
- the decryptionKey required to decrypt the prefixIOException
- if there was a problem parsing or decrypting the objectpublic VortexMessage(byte[] b, AsymmetricKey dk) throws IOException
Parses a byte array to a VortexMessage.
b
- the byte array to be parseddk
- the decryptionKey required to decrypt the prefixIOException
- if there was a problem parsing or decrypting the objectpublic VortexMessage(PrefixBlock pre, InnerMessageBlock im) throws IOException
Creates a new message block.
pre
- the prefix block to useim
- the inner message block to useIOException
- if there was an error generating the kaypublic final InnerMessageBlock getInnerMessage()
gets the embedded inner message block.
public final InnerMessageBlock setInnerMessage(InnerMessageBlock im)
Setter for the inner message block.
im
- the new inner message blockpublic final PrefixBlock getPrefix()
Gets the embedded prefix block.
public final PrefixBlock setPrefix(PrefixBlock pre)
Sets the embedded prefix block.
pre
- the new prefix blockpublic final AsymmetricKey getDecryptionKey()
Set the currently set encryption/decryption decryptionKey (asymmetric).
public final AsymmetricKey setDecryptionKey(AsymmetricKey dk) throws IOException
Set the encryption/decryption decryptionKey.
dk
- sets the decryption keyIOException
- if setting failsprotected final void parse(byte[] p) throws IOException
parse
in class AbstractBlock
IOException
protected void parse(InputStream is) throws IOException
IOException
protected void parse(org.bouncycastle.asn1.ASN1Encodable p) throws IOException
parse
in class AbstractBlock
IOException
public org.bouncycastle.asn1.ASN1Object toAsn1Object(DumpType dt) throws IOException
Dumps the object a ASN1Object.
This method is mainly useful for diagnostic purposes.
toAsn1Object
in interface Dumpable
dt
- the dumpType to applyIOException
- if any object or subobject can not be dumpedpublic String dumpValueNotation(String prefix) throws IOException
Dumps an ASN.1 value notation of a vortexMessage (PUBLIC_ONLY dump type).
prefix
- the line prefix to be used (typically "")IOException
- if message i not encodable due to an incomplete/invalid object statepublic String dumpValueNotation(String prefix, DumpType dt) throws IOException
Dumps a ASN.1 value notation of a vortexMessage.
dumpValueNotation
in interface Block
prefix
- the line prefix to be used (typically "")dt
- specifies the type of dump.IOException
- if message i not encodable due to an incomplete/invalid object statepublic byte[] toBinary(DumpType dt) throws IOException
Build the binary represenattion for a vortexMessage.
This method returns the binary (length prefixed) representation of a vortex message.
dt
- specifies the type of dump. for sending use PUBLIC_ONLYIOException
- if dumping failspublic static byte[] getLongAsBytes(long i, int num)
converts an unsigned long value into a byte array representation (LSB).
i
- the long value to be convertednum
- the number of bytes to be returnedpublic static byte[] getLongAsBytes(long i)
Converts an unsigned long value into a 32 bit byte array representation (LSB).
i
- the long value to be convertedpublic static long getBytesAsLong(byte[] b)
Converts a number of bytes into a long representation (LSB).
b
- the byte array to be converted to longCopyright © 2023. All rights reserved.