paascloud/paascloud-master · error · UacBizException
UAC10011031
UAC10011031
Error message
UAC10011031
What it means
EmailServiceImpl.decryptEmail throws UacBizException(UAC10011031) when HttpAesUtil.decrypt(email, KEY_STR, false, IV_STR) throws while decrypting the AES-encrypted email parameter. The private helper (called by sendEmailCode and checkEmailCode) logs the failure with the ciphertext and rethrows, so malformed or tampered encrypted email input is rejected before any lookup.
Solutions
- Encrypt the email on the client with the same KEY_STR/IV_STR the server uses (same AES mode/padding)
- Test decryption locally: HttpAesUtil.decrypt(sampleCiphertext, KEY_STR, false, IV_STR)
- Ensure the ciphertext survives transport intact (URL-encode when in query strings)
- Align key config across environments — check the encryption key property in config center vs frontend build
Example fix
// before
POST /email/code?email=test@example.com // plaintext, not AES-encrypted
// after
String cipher = HttpAesUtil.encrypt("test@example.com", KEY_STR, false, IV_STR);
POST /email/code?email=" + URLEncoder.encode(cipher, "UTF-8"); Defensive patterns
Strategy: validation
Validate before calling
boolean decodable;
try { HttpAesUtil.decrypt(emailParam, KEY_STR, false, IV_STR); decodable = true; } catch (Exception e) { decodable = false; }
if (!decodable) { /* re-encrypt with the correct key before calling the API */ } Try / catch
try { emailService.sendEmailCode(loginName, encryptedEmail); } catch (UacBizException e) { if (ErrorCodeEnum.UAC10011031.getCode().equals(e.getCode())) { reEncryptAndRetry(); } throw e; } Prevention
- Share KEY_STR/IV_STR through config center and the frontend build from one source
- URL-encode AES ciphertext in query strings to protect +, /, = characters
- Add an integration test that encrypts on the client path and decrypts via decryptEmail
- Version the encryption scheme so old clients can be handled during key rotation
When it happens
Trigger: Calling sendEmailCode or checkEmailCode with an email value that is not valid AES ciphertext for the configured KEY_STR/IV_STR — e.g. plaintext email passed in, wrong padding, or encrypted with a different key.
Common situations: Frontend encryption key/config (KEY_STR, IV_STR) mismatched between client and server; client sending the email already URL-decoded or as plaintext; older app versions encrypting with a legacy key; manual API testing with a raw email string.
Related errors
AI-assisted analysis of paascloud/paascloud-master@781281a950 (2026-09-10).
Data as JSON: /api/errors/db985413a5d95899.
Report an issue: GitHub.
Appendix: source
Thrown at paascloud-provider/paascloud-provider-uac/src/main/java/com/paascloud/provider/service/impl/EmailServiceImpl.java:151
Preconditions.checkArgument(StringUtils.isNotEmpty(email), ErrorCodeEnum.UAC10011018.msg());
Preconditions.checkArgument(StringUtils.isNotEmpty(emailCode), "验证码不能为空");
// 解密用户名密码
email = decryptEmail(loginName, email);
String key = RedisKeyUtil.getSendEmailCodeKey(loginName, email);
String emailCodeRedis = redisService.getKey(key);
Preconditions.checkArgument(StringUtils.isNotEmpty(emailCodeRedis), "验证码已过期");
Preconditions.checkArgument(StringUtils.equals(emailCode, emailCodeRedis), "验证码错误");
}
private String decryptEmail(final String loginName, String email) {
try {
email = HttpAesUtil.decrypt(email, KEY_STR, false, IV_STR);
log.info("发送短信 解密loginName={}", loginName);
log.info("发送短信 解密email={}", email);
} catch (Exception ex) {
log.info("发送短信 解密手机号码失败 密文loginName={}, email={}", loginName, email);
throw new UacBizException(ErrorCodeEnum.UAC10011031);
}
return email;
}
}
View on GitHub (pinned to 781281a950)