package com.unis.common.util;

import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;

@Slf4j
class CommonCryptogramUtilTest {

    /**
     * 加密方法（Sm2 的专门针对前后端分离，非对称秘钥对的方式，暴露出去的公钥，对传输过程中的密码加个密）
     *
     * @className CommonCryptogramUtilTest
     * @author ybw
     * @date 2024/4/1
     * @version V1.0
     **/
    @Test
    void doSm2Encrypt() {
        String password = "123456";
        String p = CommonCryptogramUtil.doSm2Encrypt(password);
        log.info("{}", p);
    }

    /**
     * 解密方法
     *
     * @methodName: doSm2Decrypt
     * @return: void
     * @author: ybw
     * @date: 2024/4/1
     **/
    @Test
    void doSm2Decrypt() {
        String password = "bba5c9758d57433317f664dd15b968112e261e187f98c583aed94fb2f2a7c985d13d3c3a6931ace7534ffbd861f09c7d3e5e1c0fd1369cf359c7bded397907b49ae2bcb96d608536233aaf012b1589a9807ba538e10c0fc78ce1c73288c4c8edf7f91a9a3715";
        String p = CommonCryptogramUtil.doSm2Decrypt(password);
        log.info("{}", p);
    }
}