package chat.user;
|
|
import chat.security.DES;
|
|
public class Token {
|
|
private static String KEY = "testim";
|
private String value;
|
private String fullValue;
|
|
public Token(String userId, String secret) throws Exception {
|
generateValue(userId, secret);
|
}
|
|
private void generateValue(String userId, String secret) throws Exception {
|
String text = KEY + "|" + (System.currentTimeMillis()) + "|" + userId;
|
value = DES.encryptDES(text);
|
fullValue = value + "|" + secret + "|" + secret;
|
}
|
|
public String getValue() {
|
return value;
|
}
|
|
public byte[] getFullValue() {
|
return fullValue.getBytes();
|
}
|
|
public static void setKey(String key) {
|
KEY = key;
|
}
|
|
}
|