前端对密码加密:

  const user = encryption({
        data: userInfo,
        key: 'love',
        param: ['password']
      })

后端对密码进行解密:

	private static final String KEY_ALGORITHM = "AES";
	private String final key = "love";

	private static String decryptAES(String data, String key) {
		AES aes = new AES(Mode.CBC, Padding.NoPadding,
			new SecretKeySpec(pass.getBytes(), KEY_ALGORITHM),
			new IvParameterSpec(pass.getBytes()));
		byte[] result = aes.decrypt(Base64.decode(data.getBytes(StandardCharsets.UTF_8)));
		return new String(result, StandardCharsets.UTF_8);
	}

  public static void main(String[] args) {
	   String test=	decryptAES("LFEt60GoMTj5/mQQ7HjJeA==", "love");
	   System.out.println(test);
	}

 

Logo

前往低代码交流专区

更多推荐