| | |
| | | */ |
| | | public class BaseNFCHelper { |
| | | /** |
| | | * 默认密码 |
| | | * 默认密码(白卡密码) |
| | | */ |
| | | public byte[] bytes; |
| | | public byte[] defauleKey; |
| | | |
| | | /** |
| | | * 公司密码 |
| | | */ |
| | | public byte[] companyKey; |
| | | |
| | | String companyKeyA; |
| | | String companyKeyB; |
| | | |
| | | |
| | | public BaseNFCHelper() { |
| | | // 解密字符串 |
| | |
| | | cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(encodedKey, "AES")); |
| | | byte[] decryptedBytes = cipher.doFinal(encryptedBytes); |
| | | String decryptedText = new String(decryptedBytes, StandardCharsets.UTF_8); |
| | | bytes = HexUtil.hexToByteArray(decryptedText); |
| | | defauleKey = HexUtil.hexToByteArray(decryptedText); |
| | | |
| | | byte[] encryptedBytes2 = Base64.decode("aYC9feYEOFOQHuzflLIXSw==", Base64.DEFAULT); |
| | | byte[] decryptedBytes2 = cipher.doFinal(encryptedBytes2); |
| | | companyKeyA = new String(decryptedBytes2, StandardCharsets.UTF_8); |
| | | companyKey = HexUtil.hexToByteArray(companyKeyA); |
| | | |
| | | byte[] encryptedBytes3 = Base64.decode("n+SSZFb4DHsreVav/Z5ftg==", Base64.DEFAULT); |
| | | byte[] decryptedBytes3 = cipher.doFinal(encryptedBytes3); |
| | | companyKeyB = new String(decryptedBytes3, StandardCharsets.UTF_8); |
| | | |
| | | } catch (NoSuchAlgorithmException e) { |
| | | throw new RuntimeException(e); |
| | | } catch (NoSuchPaddingException e) { |