直接上代码,是在springboot下直接test的
import org.apache.commons.codec.binary.Base64;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import javax.crypto.Cipher;
import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec;
import java.security.SecureRandom;
import java.text.SimpleDateFormat;
import java.util.Date;
@RunWith(SpringRunner.class)
@SpringBootTest
public class RestapiApplicationTests {
// 加密
public static String Encrypt(String sSrc, String sKey)

该博客分享了如何在Java中使用AES加密算法进行128位、192位和256位的ECB加密模式操作。内容主要以SpringBoot测试代码的形式展示,适用于理解AES加密的基本用法。
2万+

被折叠的 条评论
为什么被折叠?



