| | |
| | | import cn.hutool.crypto.SecureUtil; |
| | | import cn.hutool.crypto.asymmetric.KeyType; |
| | | import cn.hutool.crypto.asymmetric.RSA; |
| | | import cn.hutool.crypto.asymmetric.Sign; |
| | | import cn.hutool.crypto.asymmetric.SignAlgorithm; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.junit.jupiter.api.Test; |
| | | import org.springframework.boot.test.context.SpringBootTest; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.security.KeyPair; |
| | | |
| | | /** |
| | |
| | | * @date 2020-05-12 |
| | | **/ |
| | | @Slf4j |
| | | @SpringBootTest |
| | | @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT) |
| | | public class RSATest { |
| | | |
| | | private String publicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCFU26floADA4PSEmE99u1YD30P3LAP6c7XYRASejCte+uOUfveSGHip2cgwpElu4y/r8PKAbclvs8j3y0g4MhjQbRjsiK8O2PKPaTWW+bHWPapPAhTuRHDMVFV6sajZ4dcg7mZ9+zPqG2RkvXi993v7kcTYq8hpE20/+Do7gwFowIDAQAB"; |
| | |
| | | byte[] decrypt = rsa.decrypt(aByte, KeyType.PrivateKey); |
| | | } |
| | | |
| | | @Test |
| | | public void md5Test() { |
| | | String md5str = SecureUtil.md5("123456"); |
| | | log.info("{}", md5str); |
| | | } |
| | | |
| | | @Test |
| | | public void bigdecimalTest() { |
| | | BigDecimal bigDecimal = new BigDecimal("123.12345678").setScale(4, BigDecimal.ROUND_DOWN); |
| | | log.info("--->{}", bigDecimal); |
| | | } |
| | | } |