import com.ho.common.tools.util.RSAUtil;
import lombok.extern.slf4j.Slf4j;

/**
 * @author fancl
 * @desc: AES 加解密demo
 * @date 2022/11/15
 */
@Slf4j
public class RSATest {
    public static void main(String[] args) {
        String publicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCuG6ZABNgLQCI9iVPDuJEb7xb5zR9UGKyKXshLuJFZxyNtaEzfpjSMqsshUYA1QpwUvkmZE0lcRE4F4QtZO9rDnH2PoW1FWRbjgg0+MKWOmZr9hSPKM/BIE+knTtTaj4/0TK7QwDd9q/QAIduC1hIyxIIkxfWx0gFuTnxui0waCwIDAQAB";
        String privKey = "MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAK4bpkAE2AtAIj2JU8O4kRvvFvnNH1QYrIpeyEu4kVnHI21oTN+mNIyqyyFRgDVCnBS+SZkTSVxETgXhC1k72sOcfY+hbUVZFuOCDT4wpY6Zmv2FI8oz8EgT6SdO1NqPj/RMrtDAN32r9AAh24LWEjLEgiTF9bHSAW5OfG6LTBoLAgMBAAECgYA614NfXYO6galQzMmvewAnxa0pLYbqABDIDvJ4jN8qzV+OyVI5v81AwTQ3hXjkBygC5rCu+FKxyS/pUr5oIQ90vbKvy+kozg9l0qWHfa8XrfC+E36CVuDrZYdZzl0C6J6BoNB9osJJ6HCnMA7kWLRRwU5VJBsK8CmgcJlfHNH60QJBAPz4rZgqgor69SonHG4xjRz+u4QkXIP8I+lorBSFEuUF03u22Kcxz7mcOq63m8K+oc22ql0g8QNrq6YPrEgpAPMCQQCwMUQcdZLWJrRbHp1ZA3jbt4vYg7xb1LklAM6Qmz1R9xVY0itDMtFRSTlVnrbTPZ+rldrkLUOzLJwKLHniIQiJAkEAmfeBMKwu6Af2T8GePDNMf+lKmBLJfEtqUBW1JogYB+yT2yhelORsWbwMu2plExKTyHD1H9l812ghAOFpKkJKoQJBAJ7lz2dbIXHAtib3FTCR0Q1WGujI5bZrwg19DM2dM1AYZUgVQq73xY5pWyu8V2VqzfUQ0Le3mracJJ2IPuOQpwECQF/b7Tv3auIHRaO9AD7xWIOCMYGlKhqeheMZb/mDRHedsdRvigiojDaaFbtnkvXlRbWlkOu5P5GNDpv7EuPbUs8=";


        String aesKeyEnc = "oOk2Ib+ow/K105g8jGBkXZ3EYH1zmBO+keqM2m2nMpWeQEM838/brxS5LX8Knh3oxhkO/7Nv1Q3t8z8eCoYTNjYkxDevqfz7ZV4Mau5rJVMyfG5i3A9GHp4XjuFVnZYcO69rmFqiY7btZJ17NQG/tF3RJF0RgkEWi0bbpFBLNug=";
        String ivEnc = "H8La8vX9louUX2B5RciVrvn2VTBLQAbmUKv++1mvwp+eF0MnQcFC7lI3GzIFGHDEEWlCjOEiIvGaeNmU80AL//Tnn2Rti5MgPwe0lHRMsBjLDtaL3H/GYtKeCYvluPeQDHHOwZWvjucEhQ9k/GWMQNZCVmL/Ve1zKxAANCf43yw=";
        log.info("aesKeyEnc: {}" ,aesKeyEnc );
        log.info("ivEnc:{}", ivEnc );

        //解密
        //对密钥解密
        String aesKeyPlain = RSAUtil.decode(aesKeyEnc, privKey);
        String ivPlain = RSAUtil.decode(ivEnc, privKey);
        log.info("解密后: aesKeyPlain:{}" ,aesKeyPlain);
        log.info("解密后: ivPlain:{}" ,ivPlain);



    }

 }
