微信小程序登录以及获取手机号,java

本文旨在用最小的篇幅,较简单的方式梳理出小程序登录

前置工作

一.创建一个实体类或者说只需要前端传一个code

微信小程序登录以及获取手机号,java_第1张图片

 
  

二.密文破解配置类

package com.hengaikj.mini.util;

import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import javax.xml.transform.Result;
import java.security.*;

public class AESUtils {

    public static boolean initialized = false;
    /**
     * AES解密
     * @param content 密文
     * @return
     * @throws InvalidAlgorithmParameterException
     * @throws NoSuchProviderException
     */
    public byte[] decrypt(byte[] content, byte[] keyByte, byte[] ivByte) throws InvalidAlgorithmParameterException {
        initialize();
        try {
            Cipher cipher = Cipher.get

你可能感兴趣的:(微信小程序,java,小程序)