应用身份管理服务 OneAccess-签名验签说明:明文加密过程

时间:2025-01-26 10:36:38

明文加密过程

  1. 拼接明文字符串。明文字符串由16个字节的随机字符串、明文msg拼接组成,中间使用&进行连接。以下为Java语言示例:
    String dataStr = RandomStringUtils.random(16, true, false) + "&" + data;
  2. 对拼接后的明文字符串使用AESkey加密后,再进行Base64编码,获得密文encrypt_msg。以下为Java语言示例:
    Cipher cipher = Cipher.getInstance("AES/GCM/NoPadding"); SecretKeySpec secretKey = new SecretKeySpec(加密密钥.getBytes(StandardCharsets.UTF_8), "AES"); cipher.init(1, secretKey); byte[] bytes = dataStr.getBytes(StandardCharsets.UTF_8); String ecnryptStr = Base64.getEncoder().encodeToString(cipher.doFinal(bytes));
support.huaweicloud.com/devg-oneaccess/oneaccess_06_0122.html