- 云商店介绍
-
商家指南
- 商家入驻
- 商品发布
- 商品交易
- 商家结算
- 店铺运营
- 政策与权益
-
商家常见问题
- 入驻前需要准备哪些企业证件
- 商家退出后,是否还能申请入驻
- 如何加入云商店合作伙伴
- 提交入驻申请后,审核需要多久
- 如何在云商店发布产品
- 商品发布申请提交后,审核需要多久
- 商品如何下架
- 订单出账后,什么时间能收到回款
- 如何判断订单是否符合开票条件?我的订单是否可开具发票?我可以开票了吗?
- 产品技术支持是卖家还是华为云提供
- 云商店商品上架的使用有效期
- 如何发起服务监管申诉
- 个人是否能成为云商店的seller
- 入驻云商店可以享受哪些利好
- 入驻云商店收取保证金吗
- 如何修改公司名称
- 订单为什么没出账?出账的前提是什么?
- 如何查看商品的分成比例
- 如何发布SaaS类商品试用规格
- 云商店镜像资产无法选择到已创建私人镜像的原因
- 经销商指南
- 用户指南
- 接入指南
- 通用参考
展开导读
链接复制成功!
ISV Server解密手机号和邮箱
代码调用如下图所示。
/** * * 解密手机号码或邮箱 * @param key 秘钥 * @param str 密文 * @param encryptLength 加密长度 * @return 解密结果 */ public static String decryptMobilePhoneOrEMail(String key, String str, int encryptLength) { if(null != str && str.length() > 16) { String iv = str.substring(0, 16); String encryptStr = str.substring(16); String result = null; try { result = decryptAESCBCEncode(encryptStr, key, iv, encryptLength); } catch (InvalidKeyException | NoSuchAlgorithmException | NoSuchPaddingException | InvalidAlgorithmParameterException | IllegalBlockSizeException | BadPaddingException e) { //TODO:异常处理 } return result; } return null; } |
/** * 解密AES CBC * @param content 原文 * @param key 秘钥 * @param iv 盐值 * @return 解密结果 * @throws BadPaddingException * @throws IllegalBlockSizeException * @throws InvalidAlgorithmParameterException * @throws NoSuchPaddingException * @throws NoSuchAlgorithmException * @throws InvalidKeyException */ public static String decryptAESCBCEncode(String content, String key, String iv, int encryptType) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException { if (StringUtils.isEmpty(content) || StringUtils.isEmpty(key) || StringUtils.isEmpty(iv)) { return null; } return new String(decryptAESCBC(Base64.decodeBase64(content.getBytes()), key.getBytes(), iv.getBytes(),encryptType)); } public static byte[] decryptAESCBC(byte[] content, byte[] keyBytes, byte[] iv, int encryptType) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException { KeyGenerator keyGenerator = KeyGenerator.getInstance("AES"); SecureRandom secureRandom = SecureRandom.getInstance("SHA1PRNG"); secureRandom.setSeed(keyBytes); keyGenerator.init(encryptType, secureRandom); SecretKey key = keyGenerator.generateKey(); Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); cipher.init(Cipher.DECRYPT_MODE, key, new IvParameterSpec(iv)); byte[] result = cipher.doFinal(content); return result; } |