public static String goEasyOTP(String secretKey) {
try {
String otp = "000" + System.currentTimeMillis();
SecretKeySpec key = new SecretKeySpec(secretKey.getBytes(), "AES");
Cipher cipher = Cipher.getInstance("AES/ECB/NoPadding");
byte[] otpBytes = otp.getBytes();
cipher.init(Cipher.ENCRYPT_MODE, key);
byte[] encryptedOTP = cipher.doFinal(otpBytes);
otp = new BASE64Encoder().encode(encryptedOTP);
return otp;
} catch (Exception e) {
throw new IllegalStateException("Failed to generate GoEasy-OTP.", e);
}
}
secret key:86726e4356dce2d3
系统毫秒数:1490325990593
GoEasy-otp:+rOKqbTZioistsdMrhon0A==