| | |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | RSA rsa = new RSA(null, AppContants.PUBLIC_KEY); |
| | | String token = rsa.encryptBase64("45" + "_" + System.currentTimeMillis(), KeyType.PublicKey); |
| | | System.out.println(token); |
| | | // RSA rsa = new RSA(null, AppContants.PUBLIC_KEY); |
| | | // String token = rsa.encryptBase64("45" + "_" + System.currentTimeMillis(), KeyType.PublicKey); |
| | | // System.out.println(token); |
| | | |
| | | String token = "kbswT3NAxqcXWcW9gVR6c/hXIFVWRIfaMq99HAiZ/IKPkoHaTlFBbLtFMTMmvUdbm45VtjOnubAMHFhQTz8GoyjhjB7bdDGWFfpe4DcGCKEMf6bWuRqopOeVF8Pst6UTwTZCvPDnbka5wbGggqNvwcSQQT2okjRe+nfU+A5EAfY="; |
| | | |
| | | |
| | | RSA rsas = new RSA(AppContants.PRIVATE_KEY, null); |
| | | String[] tokens = StrUtil.split(rsas.decryptStr(token, KeyType.PrivateKey), "_"); |
| | | |
| | | System.out.println(tokens); |
| | | |
| | | |
| | | System.out.println(tokens[0]); |
| | | System.out.println(tokens[1]); |
| | | long currentTime = System.currentTimeMillis(); |
| | | boolean b = currentTime - Long.parseLong(tokens[1]) <= 10000; |
| | | System.out.println(b); |
| | | } |
| | | |
| | | private Boolean verifyTokenExpired(Long time) { |