package com.ruoyi.system.utils; public class DoorDeviceCredentialCryptoTest { public static void main(String[] args) { System.setProperty("door.device.credential.key", "test-door-device-credential-key-32chars"); try { String cipherText = DoorDeviceCredentialCrypto.encrypt("device-password"); if (cipherText.contains("device-password")) { throw new AssertionError("密文不应包含明文密码"); } if (!"device-password".equals(DoorDeviceCredentialCrypto.decrypt(cipherText))) { throw new AssertionError("设备密码加解密结果不一致"); } } finally { System.clearProperty("door.device.credential.key"); } } }