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("参数数量无效");
|
}
|
}
|