左晓为主开发手持机充值管理机
zuoxiao
2023-12-11 526138394ee77759e98764153b851acfe6c929af
app/src/main/java/com/dayu/recharge/tools/BaseNFCHelper.java
@@ -20,9 +20,18 @@
 */
public class BaseNFCHelper {
    /**
     * 默认密码
     * 默认密码(白卡密码)
     */
    public byte[] bytes;
    public byte[] defauleKey;
    /**
     * 公司密码
     */
    public byte[] companyKey;
    String companyKeyA;
    String companyKeyB;
    public BaseNFCHelper() {
        // 解密字符串
@@ -33,7 +42,17 @@
            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) {