liujie
2026-09-21 20051550f01227ecebbe0bf064e188dd242f58f2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package com.ruoyi.system.utils;
 
/**
 * 仅用于联调阶段生成或验证门禁设备密码密文,不输出明文。
 */
public final class DoorCredentialProbe {
 
    private DoorCredentialProbe() {
    }
 
    public static void main(String[] args) {
        String password = System.getenv("DAHUA_PROBE_PASSWORD");
        if (password == null || password.length() == 0) {
            throw new IllegalArgumentException("缺少 DAHUA_PROBE_PASSWORD");
        }
        if (args.length == 0) {
            System.out.print(DoorDeviceCredentialCrypto.encrypt(password));
            return;
        }
        if (args.length == 1) {
            System.out.print(password.equals(DoorDeviceCredentialCrypto.decrypt(args[0])));
            return;
        }
        throw new IllegalArgumentException("参数数量无效");
    }
}