bug
jiangqs
2023-08-25 156e141e55a8abf486157d1fa89d25e23f4a06a3
ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/util/Certificate.java
@@ -1,25 +1,8 @@
package com.ruoyi.shop.util;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.shop.util.dto.CertificateItem;
import com.ruoyi.shop.util.dto.EncryptedCertificateItem;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.binary.Base64;
import org.apache.http.Header;
import org.apache.http.HttpEntity;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.List;
/**
 * @date 2020-03-18 15:06
@@ -41,7 +24,7 @@
     * @param savePath
     * @return
     */
    public static List<X509Certificate> getCertByAPI(String merchantId, int timeout, String serialNo, String mchPrivateKeyPath, String wechatPubKeyPath, String APIv3Key, String savePath) {
    /*public static List<X509Certificate> getCertByAPI(String merchantId, int timeout, String serialNo, String mchPrivateKeyPath, String wechatPubKeyPath, String APIv3Key, String savePath) {
        String result = "";
        //创建http请求
        HttpGet httpGet = new HttpGet("https://api.mch.weixin.qq.com/v3/certificates");
@@ -105,11 +88,11 @@
                        }
                        logger.info("证书List:" + certList);
                        /*List<PlainCertificateItem> plainList = decrypt(certList, APIv3Key);
                        *//*List<PlainCertificateItem> plainList = decrypt(certList, APIv3Key);
                        if (CollectionUtils.isNotEmpty(plainList)) {
                            logger.info("平台证书开始保存");
                            x509Certs = saveCertificate(plainList, savePath);
                        }*/
                        }*//*
                    }
                }
            }
@@ -121,7 +104,7 @@
            logger.error("下载平台证书返回结果:" + e);
        }
        return x509Certs;
    }
    }*/
    /*private static List<PlainCertificateItem> decrypt(List<CertificateItem> certList,CloseableHttpResponse response) throws GeneralSecurityException, IOException {