TaleLin / lin-cms-spring-boot

🔨 基于SpringBoot的CMS/DMS/管理系统开发框架
http://doc.cms.talelin.com/
MIT License
904 stars 253 forks source link

验证码接口返回服务器错误 #295

Closed huanglingz closed 2 years ago

huanglingz commented 2 years ago

Using 'application/json', given [/] and supported [application/json, application/+json, application/json, application/+json] Writing [UnifyResponseVO(code=9999, message=服务器未知错误, request=POST /cms/user/captcha)] Resolved [java.lang.NullPointerException]

问题定位到这里 public static String aesEncode(String secret, String iv, String content) throws GeneralSecurityException { SecretKey secretKey = new SecretKeySpec(secret.getBytes(), AES); Cipher cipher = Cipher.getInstance(CIPHER_ALGORITHM); cipher.init(Cipher.ENCRYPT_MODE, secretKey, new IvParameterSpec(iv.getBytes(StandardCharsets.US_ASCII))); 这里异常

xxxycl commented 2 years ago

发现 #265 已解决这个问题。 猜测,你yml配置可能没配。具体是secret和iv需要配一下。 个人觉得,如果数位不够没关系,反正它自动生成正确的:)

login-captcha: enabled: false secret: "Ds0G43os5QiOHKgDpcUhxIU0YdgsO8JD" iv: "wJYbmnQqtj8dwaKR"

huanglingz commented 2 years ago

确实是没有iv这个配置,拉下来就是没有这个配置,debug发现了这个空指针的问题。