FRCoreContext源码:
public
class
FRCoreContext
{
public
static
final
ThreadLocal TMAP =
new
ThreadLocal();
private
static
byte
[] lic_bytes =
null
;
private
static
byte
[] lock_bytes =
null
;
private
static
final
long
ONE_YEAR_MILLISECOND = 31536000000L;
private
static
final
int
MAX_DIGIT =
255
;
private
static
boolean
onlinePassed =
true
;
private
static
String;
private
static
final
String uuid = UUID.randomUUID().toString();
private
static
final
long
ONLINE_CHECK_TIME_DELAY = 0L;
private
static
final
long
ONLINE_CHECK_TIME_PERIOD = 10800000L;
private
static
Timer ONLINE_CHECK_TIMER;
private
static
int
failCount;
private
static
boolean
shouldFireLicChange =
false
;
private
static
final
int
MAX_FAIL_COUNT =
8
;
private
static
final
BigInteger N =
new
BigInteger(
"61103299352066102812915201580370346997919089893149305765565972348630053713717591736527153881172892494135635969333391530396986735629281282430026953431657619628355730192943385620088393498664105803897708601718035436482482749378713844253725606147581454234307387984660050507963063894825237808748868429675256901161"
);
private
static
final
BigInteger D =
new
BigInteger(
"65537"
);
……
private
static
String byte2hex(
byte
[] paramArrayOfByte)
{
StringBuffer localStringBuffer =
new
StringBuffer();
String str =
""
;
for
(
int
i =
0
; i < paramArrayOfByte.length; i++)
{
str = Integer.toHexString(paramArrayOfByte[i] &
0xFF
);
if
(str.length() ==
1
) {
localStringBuffer.append(
'0'
);
}
localStringBuffer.append(str);
}
return
localStringBuffer.toString().toUpperCase();
}
private
static
void
decode(String paramString, OutputStream paramOutputStream)
{
String[] arrayOfString = paramString.split(byte2hex(N.toByteArray()));
try
{
for
(
int
i =
0
; i < arrayOfString.length; i++) {
paramOutputStream.write(tinyDecode(hex2byte(arrayOfString[i])));
}
}
catch
(IOException localIOException)
{
FRContext.getLogger().error(localIOException.getMessage(), localIOException);
}
}
……
private
static
byte
[] hex2byte(String paramString)
{
if
(paramString ==
null
) {
return
null
;
}
int
i = paramString.length();
if
(i %
2
==
1
) {
return
null
;
}
byte
[] arrayOfByte =
new
byte
[i /
2
];
for
(
int
j =
0
; j != i /
2
; j++) {
arrayOfByte[j] = ((
byte
)Integer.parseInt(paramString.substring(j *
2
, j *
2
+
2
),
16
));
}
return
arrayOfByte;
}
private
static
byte
[] tinyDecode(
byte
[] paramArrayOfByte)
{
paramArrayOfByte =
new
BigInteger(paramArrayOfByte).modPow(D, N).toByteArray();
return
ArrayUtils.subarray(paramArrayOfByte,
1
, paramArrayOfByte.length);
}
}