java.io.Serializablepublic class Token
extends java.lang.Object
implements java.io.Serializable
| Constructor | Description |
|---|---|
Token(byte[] token) |
Create a token from a byte array.
|
Token(java.lang.String token,
int fallbackLength) |
Generate a token from a string of hexadecimal values.
|
| Modifier and Type | Method | Description |
|---|---|---|
boolean |
checkToken() |
|
byte[] |
decrypt(byte[] msg) |
Decrypt a message with this token.
|
byte[] |
encrypt(byte[] msg) |
Encrypt a message with this token.
|
boolean |
equals(java.lang.Object o) |
|
byte[] |
getIv() |
|
byte[] |
getMd5() |
|
byte[] |
getToken() |
Get the token as a byte array.
|
int |
hashCode() |
|
java.lang.String |
toString() |
public Token(byte[] token)
token - The byte array to use.public Token(java.lang.String token,
int fallbackLength)
token - The value tho convert.fallbackLength - If the conversion fails a token of 0s with this length will be generated.public byte[] getToken()
public boolean checkToken()
public byte[] getMd5()
throws java.security.NoSuchAlgorithmException
java.security.NoSuchAlgorithmException - When the platform doesn't support the md5 algorithm.public byte[] getIv()
throws java.security.NoSuchAlgorithmException
java.security.NoSuchAlgorithmException - When the platform doesn't support the md5 algorithm.public boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic byte[] encrypt(byte[] msg)
msg - The message to encrypt.public byte[] decrypt(byte[] msg)
msg - The message to decrypt.Copyright © 2018. All rights reserved.