public class TOMUtil
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
RR_DELIVERED |
static int |
RR_REPLY |
static int |
RR_REQUEST |
static int |
SM_ASK_INITIAL |
static int |
SM_REPLY |
static int |
SM_REPLY_INITIAL |
static int |
SM_REQUEST |
static int |
STOP |
static int |
STOPDATA |
static int |
SYNC |
static int |
TRIGGER_LC_LOCALLY |
static int |
TRIGGER_SM_LOCALLY |
Constructor and Description |
---|
TOMUtil() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
byteArrayToString(byte[] b) |
static byte[] |
computeHash(byte[] data) |
static boolean |
equalsHash(byte[] h1,
byte[] h2) |
static byte[] |
getBytes(java.lang.Object o) |
static java.lang.Object |
getObject(byte[] b) |
static int |
getSignatureSize(ViewController controller) |
static byte[] |
signMessage(java.security.PrivateKey key,
byte[] message)
Sign a message.
|
static boolean |
verifySignature(java.security.PublicKey key,
byte[] message,
byte[] signature)
Verify the signature of a message.
|
static boolean |
verifySignature(java.security.Signature initializedSignatureEngine,
byte[] message,
byte[] signature)
Verify the signature of a message.
|
public static final int RR_REQUEST
public static final int RR_REPLY
public static final int RR_DELIVERED
public static final int STOP
public static final int STOPDATA
public static final int SYNC
public static final int SM_REQUEST
public static final int SM_REPLY
public static final int SM_ASK_INITIAL
public static final int SM_REPLY_INITIAL
public static final int TRIGGER_LC_LOCALLY
public static final int TRIGGER_SM_LOCALLY
public static int getSignatureSize(ViewController controller)
public static byte[] getBytes(java.lang.Object o)
public static java.lang.Object getObject(byte[] b)
public static byte[] signMessage(java.security.PrivateKey key, byte[] message)
key
- the private key to be used to generate the signaturemessage
- the message to be signedpublic static boolean verifySignature(java.security.PublicKey key, byte[] message, byte[] signature)
key
- the public key to be used to verify the signaturemessage
- the signed messagesignature
- the signature to be verifiedpublic static boolean verifySignature(java.security.Signature initializedSignatureEngine, byte[] message, byte[] signature) throws java.security.SignatureException
initializedSignatureEngine
- a signature engine already initialized
for verificationmessage
- the signed messagesignature
- the signature to be verifiedjava.security.SignatureException
public static java.lang.String byteArrayToString(byte[] b)
public static boolean equalsHash(byte[] h1, byte[] h2)
public static final byte[] computeHash(byte[] data)