From 026241e642fd749ce26945d272d3e202c9f1f7f8 Mon Sep 17 00:00:00 2001 From: Jerry <85411418@qq.com> Date: Fri, 9 Jun 2023 21:23:47 +0800 Subject: [PATCH] change alipay cert --- alipay/cert/alipayCertPublicKey_RSA2.crt | 19 ------ alipay/cert/alipayPublicCert.crt | 38 +++++++++++ alipay/cert/appCertPublicKey.crt | 19 ------ alipay/cert/appPublicCert.crt | 19 ++++++ alipay/cert/cert.go | 84 +++++++++++++++--------- alipay/client.go | 2 +- alipay/client_test.go | 19 +----- alipay/payment_api_test.go | 6 +- alipay/sign.go | 6 +- alipay/sign_test.go | 6 +- doc/alipay.md | 12 ++-- examples/alipay/alipay_ServiceApi.go | 6 +- examples/main.go | 2 +- 13 files changed, 131 insertions(+), 107 deletions(-) delete mode 100644 alipay/cert/alipayCertPublicKey_RSA2.crt create mode 100644 alipay/cert/alipayPublicCert.crt delete mode 100644 alipay/cert/appCertPublicKey.crt create mode 100644 alipay/cert/appPublicCert.crt diff --git a/alipay/cert/alipayCertPublicKey_RSA2.crt b/alipay/cert/alipayCertPublicKey_RSA2.crt deleted file mode 100644 index 273989dc..00000000 --- a/alipay/cert/alipayCertPublicKey_RSA2.crt +++ /dev/null @@ -1,19 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIDszCCApugAwIBAgIQICEGEs5toISjThCzk4QcbzANBgkqhkiG9w0BAQsFADCBkTELMAkGA1UE -BhMCQ04xGzAZBgNVBAoMEkFudCBGaW5hbmNpYWwgdGVzdDElMCMGA1UECwwcQ2VydGlmaWNhdGlv -biBBdXRob3JpdHkgdGVzdDE+MDwGA1UEAww1QW50IEZpbmFuY2lhbCBDZXJ0aWZpY2F0aW9uIEF1 -dGhvcml0eSBDbGFzcyAyIFIxIHRlc3QwHhcNMjEwNjEyMDkwNjIwWhcNMjQwNjEwMDkwNjIwWjCB -hDELMAkGA1UEBhMCQ04xHzAdBgNVBAoMFndoeGh4azI3OTdAc2FuZGJveC5jb20xDzANBgNVBAsM -BkFsaXBheTFDMEEGA1UEAww65pSv5LuY5a6dKOS4reWbvSnnvZHnu5zmioDmnK/mnInpmZDlhazl -j7gtMjA4ODYyMTk1NTk2ODg5ODCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKXjSPJi -S8SHSbjq99Q++KGJ5UImEHTYHStD0wPRkLrLD+XNwU3z+O9b3R1KOLukqTTJIjoMiiFjzlNI1Yj9 -4+WysoS+Kl52WKp2SPOd8zPW1oq3qgeMqka5brHogbhkGbSbzgW+KsDPnP0+z9QKUSt7mxXl5kMq -eA1V23W2e94/99ITXuho5oHeyytxOXbe+FMqI0xA7raQ92JBd0BWMTyNY2YbZGHbeTNtkz+IQ/bP -zphCRJ0XIChiYWXHruTZvXA+Q8eRtaJme/94xkDYCIJbgAAoXgfa6kpRqXs4KYxxH0g+ol7wiZ9x -HXfzmAla97tPylMniBJ4UMlHu6nLQxsCAwEAAaMSMBAwDgYDVR0PAQH/BAQDAgTwMA0GCSqGSIb3 -DQEBCwUAA4IBAQA1Ixqig4lSOB1NKV0Av4zhQGOzi1hV+Lyj+7EO3S8l3l8rIcAbwoAAo9pgM7qN -5/Soudso+KkaG2v4n0jVJp/fDeFkRkQ3RHV/D52X2Ev+7bAn22OOUukNk24yhhaNk1Fx3clipgyQ -JCP9OfTF/tmHdAunqgVEv97NDbZ+bnD/8NiRVvN/M9ge/nnKv+VvwAmm0aFmLle1YUtbe+Iu9lKL -I6KMVtXmuLs0sG08js202fuWCribWY0vg7LUmIwczgeZjr3oX8E/SNtsAj4Z+zUYZ4MP3sgYRCRC -T/gvZ1y0v9+Q58MeZC5MZfDPAzyxYwAGOvBF11jKeXG3nW4WyGCT ------END CERTIFICATE----- diff --git a/alipay/cert/alipayPublicCert.crt b/alipay/cert/alipayPublicCert.crt new file mode 100644 index 00000000..db88fc37 --- /dev/null +++ b/alipay/cert/alipayPublicCert.crt @@ -0,0 +1,38 @@ +-----BEGIN CERTIFICATE----- +MIIDszCCApugAwIBAgIQICMGCYN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k4IHVOg0ORiQ6SUgxZUTYcCAwEAAaMSMBAwDgYDVR0PAQH/BAQDAgTwMA0GCSqGSIb3 +DQEBCwUAA4IBAQBWThEoIaQoBX2YeRY/I8gu6TYnFXtyuCljANnXnM38ft+ikhE5mMNgKmJYLHvT +yWWWgwHoSAWEuml7EGbE/2AK2h3k0MdfiWLzdmpPCRG/RJHk6UB1pMHPilI+c0MVu16OPpKbg5Vf +LTv7dsAB40AzKsvyYw88/Ezi1osTXo6QQwda7uefvudirtb8FcQM9R66cJxl3kt1FXbpYwheIm/p +j1mq64swCoIYu4NrsUYtn6CV542DTQMI5QdXkn+PzUUly8F6kDp+KpMNd0avfWNL5+O++z+F5Szy +1CPta1D7EQ/eYmMP+mOQ35oifWIoFCpN6qQVBS/Hob1J/UUyg7BW +-----END CERTIFICATE----- diff --git a/alipay/cert/appCertPublicKey.crt b/alipay/cert/appCertPublicKey.crt deleted file mode 100644 index d0113ff2..00000000 --- a/alipay/cert/appCertPublicKey.crt +++ /dev/null @@ -1,19 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIDmTCCAoGgAwIBAgIQICEGEtdR5YUIwp9bt5LmGjANBgkqhkiG9w0BAQsFADCBkTELMAkGA1UE -BhMCQ04xGzAZBgNVBAoMEkFudCBGaW5hbmNpYWwgdGVzdDElMCMGA1UECwwcQ2VydGlmaWNhdGlv -biBBdXRob3JpdHkgdGVzdDE+MDwGA1UEAww1QW50IEZpbmFuY2lhbCBDZXJ0aWZpY2F0aW9uIEF1 -dGhvcml0eSBDbGFzcyAyIFIxIHRlc3QwHhcNMjEwNjEyMTAxMzIxWhcNMjQwNjEwMTAxMzIxWjBr -MQswCQYDVQQGEwJDTjEfMB0GA1UECgwWd2h4aHhrMjc5N0BzYW5kYm94LmNvbTEPMA0GA1UECwwG -QWxpcGF5MSowKAYDVQQDDCEyMDg4NjIxOTU1OTY4ODk4LTIwMjEwMDAxMTc2NzM2ODMwggEiMA0G -CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCcbdhtW4JTRCm1ADMeexzLVbdrml6ESgaM92G+lS7Y -NG3JtqlLDXp3etVOcxR1ly28xKZTR9d+46M8W/O6EkbCTAkGcao840C3Wi6uVTMTOXewhFtzJczF -UVc5xXYOwoVwIBMYuFZ6/jyM1+gs0/QAPcfreDvQ24uD8LHW/p9YTyZkFJIg000rbEPI/+sNEpsI -YEpfFgoPq0lc2lzsY5pPwbogNBN8fMNBICgzNxbdK6W0tynpR3Is/6mJui9bjXQgAvW8KsPqea6d -PV5crNkUdso+wYL05XHJhskg+7p78rbgtwPmznU4/1uYqOUayPRN5VbW8GdCt8+LInX6bHPxAgMB -AAGjEjAQMA4GA1UdDwEB/wQEAwIE8DANBgkqhkiG9w0BAQsFAAOCAQEAHz2vPWvqGxWMwNY/9mY5 -nD3+k4NupipCa0h4vQ2J0TldmY88rB2jYv/v23DunzwkkMJ/ZL9LYqGwdSvZGC+fBu8/pAbqEpy+ -D/QdKYJ5FQYDGuo1F69xC2f5oaaYei44NhtmeKOsMENpWlhTkgzVMxpo50GAAwLA/L8qN2Ik/JJL -uB8TTZ/Eu/IN2PCDs9mRLBJSCAiE1sosVDA6pggPlw94E81JdYSZ6U9Rb0DUa5fqXH3ufl542J+T -YEyq5nnILI9wBJuHhoioU0qx7EJHhinx5YOcdxolGrgPYhYBTcy37by3sTTaHJaGfxu9xjowB8W1 -wKOgdtsFqrqhe73pTQ== ------END CERTIFICATE----- \ No newline at end of file diff --git a/alipay/cert/appPublicCert.crt b/alipay/cert/appPublicCert.crt new file mode 100644 index 00000000..b5460485 --- /dev/null +++ b/alipay/cert/appPublicCert.crt @@ -0,0 +1,19 @@ +-----BEGIN CERTIFICATE----- +MIIDmTCCAoGgAwIBAgIQICMGCXK2Am4QGbc/5Yi2QjANBgkqhkiG9w0BAQsFADCBkTELMAkGA1UE +BhMCQ04xGzAZBgNVBAoMEkFudCBGaW5hbmNpYWwgdGVzdDElMCMGA1UECwwcQ2VydGlmaWNhdGlv +biBBdXRob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== +-----END CERTIFICATE----- \ No newline at end of file diff --git a/alipay/cert/cert.go b/alipay/cert/cert.go index 77675b01..aae0a482 100644 --- a/alipay/cert/cert.go +++ b/alipay/cert/cert.go @@ -1,31 +1,51 @@ package cert var ( - Appid = "" + Appid = "2021000122672388" // 私钥 - PrivateKey = "MIIEowIBAAKCAQEAnG3YbVuCU0QptQAzHnscy1W3a5pehEoGjPdhvpUu2DRtybapSw16d3rVTnMUdZctvMSmU0fXfuOjPFvzuhJGwkwJBnGqPONAt1ourlUzEzl3sIRbcyXMxVFXOcV2DsKFcCATGLhWev48jNfoLNP0AD3H63g70NuLg/Cx1v6fWE8mZBSSINNNK2xDyP/rDRKbCGBKXxYKD6tJXNpc7GOaT8G6IDQTfHzDQSAoMzcW3SultLcp6UdyLP+pibovW410IAL1vCrD6nmunT1eXKzZFHbKPsGC9OVxyYbJIPu6e/K24LcD5s51OP9bmKjlGsj0TeVW1vBnQrfPiyJ1+mxz8QIDAQABAoIBAHJrgpBTDBvd0uf7MmkMQj6U/yos6w+2md4IoS1nL7Gjf964xlIIlNjKNzY/xOpSX3khGkv2U7ETzvW6iKdE8Q7z0PIuuAf7bf3vcA/CcC6SrXKnDcFHF+YInlW6kqUvMa2XOICvbUpfpmibEM+hZWu7xPz+oDogLIegymRpMKLFcl50vd/mpChJifN7k3/4pC/n8SlAB3K1xakRWvsfEyj2DgzSB/CDCSOsVi1J1P9YfZ1dU0E3GOIRFtrbrtagBaOPeYiS1qSkwlCyy9UXo3RAsooSjbUZtU+IhuqOFXIySG9gV6gMLFzsaGoRRPCnI9yS/cosSHXo8CTDW8urBqUCgYEA6Dn3wI/nTGceUfD+yaqSV159pwWptSRfhbY5iduJCsbEkI3MhP6WW0vHPL5inixm1Gz2c8/0Xr+5fiwK73vPApQu8tj33wjUYOLsZdi2gXEHyi1e341UwIBUubTO13ZlUtAt9pMaYBusAbGV6JXF5/KJzZ5SnnENWuMBo2OlwqcCgYEArHFuqFiNQ9eGpwv8B802BEVU0HKN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cnPIHqytkvrc9gpqW4XU0Ux7pU/twPO9JXHfXDNWXmJUHyYIeLwbeHrhJ+avtPDs8VwsI8zbBu84D13NJq7dWxPLEUYQNrCrAw4+ywvXmBzXkvEdLaQq1S4=" // 支付宝公钥证书 AlipayPublicContentRSA2 = []byte(`-----BEGIN CERTIFICATE----- -MIIDszCCApugAwIBAgIQICEGEs5toISjThCzk4QcbzANBgkqhkiG9w0BAQsFADCBkTELMAkGA1UE +MIIDszCCApugAwIBAgIQICMGCYNKwsloIKi8XMlUgzANBgkqhkiG9w0BAQsFADCBkTELMAkGA1UE BhMCQ04xGzAZBgNVBAoMEkFudCBGaW5hbmNpYWwgdGVzdDElMCMGA1UECwwcQ2VydGlmaWNhdGlv biBBdXRob3JpdHkgdGVzdDE+MDwGA1UEAww1QW50IEZpbmFuY2lhbCBDZXJ0aWZpY2F0aW9uIEF1 -dGhvcml0eSBDbGFzcyAyIFIxIHRlc3QwHhcNMjEwNjEyMDkwNjIwWhcNMjQwNjEwMDkwNjIwWjCB -hDELMAkGA1UEBhMCQ04xHzAdBgNVBAoMFndoeGh4azI3OTdAc2FuZGJveC5jb20xDzANBgNVBAsM +dGhvcml0eSBDbGFzcyAyIFIxIHRlc3QwHhcNMjMwNjA5MTI1MjAzWhcNMjQwNjA4MTI1MjAzWjCB +hDELMAkGA1UEBhMCQ04xHzAdBgNVBAoMFmxhZ21pczYyNTRAc2FuZGJveC5jb20xDzANBgNVBAsM BkFsaXBheTFDMEEGA1UEAww65pSv5LuY5a6dKOS4reWbvSnnvZHnu5zmioDmnK/mnInpmZDlhazl -j7gtMjA4ODYyMTk1NTk2ODg5ODCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKXjSPJi -S8SHSbjq99Q++KGJ5UImEHTYHStD0wPRkLrLD+XNwU3z+O9b3R1KOLukqTTJIjoMiiFjzlNI1Yj9 -4+WysoS+Kl52WKp2SPOd8zPW1oq3qgeMqka5brHogbhkGbSbzgW+KsDPnP0+z9QKU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/iKNB5MbGll8LRAxntsKvZZj6vUTMb705gYgm +VUMILwi/ZxKTQqBtkT/kQQ5y6nOZsj7XI5rYdz6qqOROrpvS/d7iypdHOMIM9Iz9DlL1mrCykbBi +t25y+gTeXmuisHUwqaRpwtCGK4BayCqxRGbNipe6W73EK9lBrrzNtTr9NaysesT/v+l25JHCL9tG +wpNr1oWFzk4IHVOg0ORiQ6SUgxZUTYcCAwEAAaMSMBAwDgYDVR0PAQH/BAQDAgTwMA0GCSqGSIb3 +DQEBCwUAA4IBAQBWThEoIaQoBX2YeRY/I8gu6TYnFXtyuCljANnXnM38ft+ikhE5mMNgKmJYLHvT +yWWWgwHoSAWEuml7EGbE/2AK2h3k0MdfiWLzdmpPCRG/RJHk6UB1pMHPilI+c0MVu16OPpKbg5Vf +LTv7dsAB40AzKsvyYw88/Ezi1osTXo6QQwda7uefvudirtb8FcQM9R66cJxl3kt1FXbpYwheIm/p +j1mq64swCoIYu4NrsUYtn6CV542DTQMI5QdXkn+PzUUly8F6kDp+KpMNd0avfWNL5+O++z+F5Szy +1CPta1D7EQ/eYmMP+mOQ35oifWIoFCpN6qQVBS/Hob1J/UUyg7BW +-----END CERTIFICATE----- +`) // 支付宝根证书 AlipayRootContent = []byte(`-----BEGIN CERTIFICATE----- @@ -119,22 +139,22 @@ Yf4Zr0fJsGuv // 应用公钥证书 AppPublicContent = []byte(`-----BEGIN CERTIFICATE----- -MIIDmTCCAoGgAwIBAgIQICEGEtdR5YUIwp9bt5LmGjANBgkqhkiG9w0BAQsFADCBkTELMAkGA1UE +MIIDmTCCAoGgAwIBAgIQICMGCXK2Am4QGbc/5Yi2QjANBgkqhkiG9w0BAQsFADCBkTELMAkGA1UE BhMCQ04xGzAZBgNVBAoMEkFudCBGaW5hbmNpYWwgdGVzdDElMCMGA1UECwwcQ2VydGlmaWNhdGlv biBBdXRob3JpdHkgdGVzdDE+MDwGA1UEAww1QW50IEZpbmFuY2lhbCBDZXJ0aWZpY2F0aW9uIEF1 -dGhvc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cNMjQwNjEzMTI1MjAyWjBr +MQswCQYDVQQGEwJDTjEfMB0GA1UECgwWbGFnbWlzNjI1NEBzYW5kYm94LmNvbTEPMA0GA1UECwwG +QWxpcGF5MSowKAYDVQQDDCEyMDg4NzIxMDAzMjM2NDQyLTIwMjEwMDAxMjI2NzIzODgwggEiMA0G +CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDDTHpBfR55b5dE2Hi78EbVGzK5hiweap6eTgas9XwS +WtQQ3qctHBJcZIgi4i7IKjS3izAI2n1DniD4BSakB114EJiEcqsBgbifXUyddRiiwR7jfDNSF3s9 +penFy0WVIqEWBgGJftxCD87xOEcknQfRDL6T000naAyd8/KmT3/jcOy0eYoRVC+BClyCeGVsrxfi +2EgrjNbTHAeAOFIB5m71Au9/9xzY90qZ3nGJRQzsns+3BPtW9sojbt9g4F7WHHGu+ljq9wYYZqXz +GE04oP56KpcCA+AhFi5eouk+Bpg4iaOecf2UinOOsI7SextrVPi2icOOnmO/QVpIrA5MCM7pAgMB +AAGjEjAQMA4GA1UdDwEB/wQEAwIE8DANBgkqhkiG9w0BAQsFAAOCAQEAZc2RyiGKftnKi/0zIUUl +xKDPyUdVBBYDagcraHROKXafsZEnhO/cdBPC3VAJEiygNvddB51l088cGb8pGS2VqTQqR/Ehmd1x +kLMleWlUocX0Mwctz/J6jNp9/JKcVe1jk492HR7Csqjf+hvsajIVliIWzuhzB7C0eNEb46Js/G8T +QmsX92eHI0r2pcmsVr+PmDioLu4H4miKrDRhXNXLQ2AQfxPOCOtxt0tSNrB97bDNSwB1O4OItmr/ +Cimb7l1nqxY3BOY5o8iAWLv4wG4giYu9LSrEJW0nWa2JG059kMlWLSVe7Afx0GzMVQUP6NJNdulP +ddebveu2CNZcJ7ipbA== -----END CERTIFICATE-----`) ) diff --git a/alipay/client.go b/alipay/client.go index 268888df..652d3727 100644 --- a/alipay/client.go +++ b/alipay/client.go @@ -28,7 +28,7 @@ type Client struct { IsProd bool bodySize int // http response body size(MB), default is 10MB privateKey *rsa.PrivateKey - aliPayPublicKey *rsa.PublicKey // 支付宝证书公钥内容 alipayCertPublicKey_RSA2.crt + aliPayPublicKey *rsa.PublicKey // 支付宝证书公钥内容 alipayPublicCert.crt autoSign bool DebugSwitch gopay.DebugSwitch location *time.Location diff --git a/alipay/client_test.go b/alipay/client_test.go index d5817111..4c34fcb9 100644 --- a/alipay/client_test.go +++ b/alipay/client_test.go @@ -41,13 +41,13 @@ func TestMain(m *testing.M) { SetNotifyUrl("https://www.fmm.ink") // 自动同步验签(只支持证书模式) - // 传入 alipayCertPublicKey_RSA2.crt 内容 + // 传入 支付宝公钥证书 alipayPublicCert.crt 内容 client.AutoVerifySign(cert.AlipayPublicContentRSA2) // 传入证书内容 err := client.SetCertSnByContent(cert.AppPublicContent, cert.AlipayRootContent, cert.AlipayPublicContentRSA2) // 传入证书文件路径 - //err := client.SetCertSnByPath("cert/appCertPublicKey_2021000117673683.crt", "cert/alipayRootCert.crt", "cert/alipayCertPublicKey_RSA2.crt") + //err := client.SetCertSnByPath("cert/appPublicCert.crt", "cert/alipayRootCert.crt", "cert/alipayPublicCert.crt") if err != nil { xlog.Debug("SetCertSn:", err) return @@ -79,21 +79,6 @@ func TestClient_PostAliPayAPISelfV2(t *testing.T) { xlog.Debug(aliPsp.Response) } -func TestClient_PostAliPayAPISelf(t *testing.T) { - bm := make(gopay.BodyMap) - bm.Set("subject", "预创建创建订单") - bm.Set("out_trade_no", util.RandomString(32)) - bm.Set("total_amount", "100") - - aliPsp := new(TradePrecreateResponse) - err := client.PostAliPayAPISelf(ctx, bm, "alipay.trade.precreate", aliPsp) - if err != nil { - xlog.Error(err) - return - } - xlog.Debug(aliPsp.Response) -} - // ================================================= func TestDecryptOpenDataToBodyMap(t *testing.T) { diff --git a/alipay/payment_api_test.go b/alipay/payment_api_test.go index e7e3a3ee..5cf74e86 100644 --- a/alipay/payment_api_test.go +++ b/alipay/payment_api_test.go @@ -42,9 +42,9 @@ func TestClient_TradeCreate(t *testing.T) { // 请求参数 bm := make(gopay.BodyMap) bm.Set("subject", "创建订单"). - Set("buyer_id", "2088802095984694"). + Set("buyer_id", "2088722003236450"). Set("out_trade_no", util.RandomString(32)). - Set("total_amount", "0.01") + Set("total_amount", "100.10") // 创建订单 aliRsp, err := client.TradeCreate(ctx, bm) @@ -148,7 +148,7 @@ func TestClient_TradePay(t *testing.T) { } func TestClient_TradeQuery(t *testing.T) { - const outTradeNo = "Xdhxpe4bI5hhXAldhkMiGTZ03Jm9V6V0" + const outTradeNo = "GZ201909081743431443" // 请求参数 bm := make(gopay.BodyMap) bm.Set("out_trade_no", outTradeNo) diff --git a/alipay/sign.go b/alipay/sign.go index 5eaf44bd..d28bd853 100644 --- a/alipay/sign.go +++ b/alipay/sign.go @@ -56,7 +56,7 @@ A:开发者上传自己的应用公钥证书后,开放平台会为开发者 */ // GetCertSN 获取证书序列号SN -// certPathOrData x509证书文件路径(appCertPublicKey.crt、alipayCertPublicKey_RSA2.crt) 或证书 buffer +// certPathOrData x509证书文件路径(appPublicCert.crt、alipayPublicCert.crt) 或证书 buffer // 返回 sn:证书序列号(app_cert_sn、alipay_cert_sn) // 返回 err:error 信息 func GetCertSN(certPathOrData interface{}) (sn string, err error) { @@ -259,7 +259,7 @@ func VerifySyncSign(aliPayPublicKey, signData, sign string) (ok bool, err error) // VerifySyncSignWithCert 支付宝同步返回验签(公钥证书模式) // 注意:APP支付,手机网站支付,电脑网站支付,身份认证开始认证 不支持同步返回验签 -// aliPayPublicKeyCert:支付宝公钥证书存放路径 alipayCertPublicKey_RSA2.crt 或文件内容[]byte +// aliPayPublicKeyCert:支付宝公钥证书存放路径 alipayPublicCert.crt 或文件内容[]byte // signData:待验签参数,aliRsp.SignData // sign:待验签sign,aliRsp.Sign // 返回参数ok:是否验签通过 @@ -352,7 +352,7 @@ func VerifySign(alipayPublicKey string, notifyBean interface{}) (ok bool, err er // 支付宝异步通知验签(公钥证书模式) // 注意:APP支付,手机网站支付,电脑网站支付 暂不支持同步返回验签 -// aliPayPublicKeyCert:支付宝公钥证书存放路径 alipayCertPublicKey_RSA2.crt 或文件内容[]byte +// aliPayPublicKeyCert:支付宝公钥证书存放路径 alipayPublicCert.crt 或文件内容[]byte // notifyBean:此参数为异步通知解析的结构体或BodyMap:notifyReq 或 bm,推荐通 BodyMap 验签 // 返回参数ok:是否验签通过 // 返回参数err:错误信息 diff --git a/alipay/sign_test.go b/alipay/sign_test.go index fdb11755..479d9f41 100644 --- a/alipay/sign_test.go +++ b/alipay/sign_test.go @@ -83,7 +83,7 @@ func TestVerifySignWithCert(t *testing.T) { bm.Set("seller_id", "2088102119685838") bm.Set("notify_id", "4a91b7a78a503640467525113fb7d8bg8e") // filePath - filepath := "/cert/alipayCertPublicKey_RSA2.crt" + filepath := "/cert/alipayPublicCert.crt" ok, err := VerifySignWithCert(filepath, bm) if err != nil { xlog.Errorf("VerifySignWithCert(%+v),error:%+v", bm, err) @@ -105,13 +105,13 @@ func TestVerifySignWithCert(t *testing.T) { } func TestGetCertSN(t *testing.T) { - sn, err := GetCertSN("cert/alipayCertPublicKey_RSA2.crt") + sn, err := GetCertSN("cert/alipayPublicCert.crt") if err != nil { xlog.Errorf("GetCertSN(),error:%+v", err) return } xlog.Debug(sn) - pubKeyPath := "cert/appCertPublicKey.crt" + pubKeyPath := "cert/appPublicCert.crt" sn, err = GetCertSN(pubKeyPath) if err != nil { xlog.Errorf("GetCertSN(),error:%+v", err) diff --git a/doc/alipay.md b/doc/alipay.md index 2fbf8dd3..e25a3d97 100644 --- a/doc/alipay.md +++ b/doc/alipay.md @@ -50,14 +50,14 @@ SetReturnUrl("https://www.fmm.ink"). // 设置返回URL SetAppAuthToken() // 设置第三方应用授权 // 自动同步验签(只支持证书模式) -// 传入 alipayCertPublicKey_RSA2.crt 内容 -client.AutoVerifySign([]byte("alipayCertPublicKey_RSA2 bytes")) +// 传入 alipayPublicCert.crt 内容 +client.AutoVerifySign([]byte("alipayPublicCert.crt bytes")) // 公钥证书模式,需要传入证书,以下两种方式二选一 // 证书路径 -err := client.SetCertSnByPath("appCertPublicKey.crt", "alipayRootCert.crt", "alipayCertPublicKey_RSA2.crt") +err := client.SetCertSnByPath("appPublicCert.crt", "alipayRootCert.crt", "alipayPublicCert.crt") // 证书内容 -err := client.SetCertSnByContent("appCertPublicKey bytes", "alipayRootCert bytes", "alipayCertPublicKey_RSA2 bytes") +err := client.SetCertSnByContent("appPublicCert.crt bytes", "alipayRootCert bytes", "alipayPublicCert.crt bytes") ``` ### 2、API 方法调用及入参 @@ -130,7 +130,7 @@ if err != nil { ok, err := alipay.VerifySyncSign(aliPayPublicKey, aliRsp.SignData, aliRsp.Sign) // 公钥证书模式验签 -// aliPayPublicKeyCert:支付宝公钥证书存放路径 alipayCertPublicKey_RSA2.crt 或文件内容[]byte +// aliPayPublicKeyCert:支付宝公钥证书存放路径 alipayPublicCert.crt 或文件内容[]byte // signData:待验签参数,aliRsp.SignData // sign:待验签sign,aliRsp.Sign ok, err := alipay.VerifySyncSignWithCert(aliPayPublicKeyCert, aliRsp.SignData, aliRsp.Sign) @@ -162,7 +162,7 @@ if err != nil { ok, err = alipay.VerifySign(aliPayPublicKey, notifyReq) // 支付宝异步通知验签(公钥证书模式) -ok, err = alipay.VerifySignWithCert("alipayCertPublicKey_RSA2.crt content", notifyReq) +ok, err = alipay.VerifySignWithCert("alipayPublicCert.crt content", notifyReq) // 如果需要,可将 BodyMap 内数据,Unmarshal 到指定结构体指针 ptr err = notifyReq.Unmarshal(ptr) diff --git a/examples/alipay/alipay_ServiceApi.go b/examples/alipay/alipay_ServiceApi.go index 11f6e88c..92e41a67 100644 --- a/examples/alipay/alipay_ServiceApi.go +++ b/examples/alipay/alipay_ServiceApi.go @@ -86,7 +86,7 @@ func ParseNotifyAndVerifySign(req *http.Request) { } func ParseNotifyAndVerifySignWithCert(req *http.Request) { - aliPayPublicKeyPathOrContent := "/root/alipay/cert/alipayCertPublicKey_RSA2.crt" + aliPayPublicKeyPathOrContent := "/root/alipay/cert/alipayPublicCert.crt" // 解析请求参数 bm, err := alipay.ParseNotifyToBodyMap(req) @@ -106,14 +106,14 @@ func ParseNotifyAndVerifySignWithCert(req *http.Request) { } func GetCertSN() { - sn, err := alipay.GetCertSN("cert/appCertPublicKey.crt") + sn, err := alipay.GetCertSN("cert/appPublicCert.crt") if err != nil { xlog.Error("err:", err) return } xlog.Debug("sn:", sn) - sn, err = alipay.GetCertSN("cert/alipayCertPublicKey_RSA2.crt") + sn, err = alipay.GetCertSN("cert/alipayPublicCert.crt") if err != nil { xlog.Error("err:", err) return diff --git a/examples/main.go b/examples/main.go index b90be3ad..d7d4b503 100644 --- a/examples/main.go +++ b/examples/main.go @@ -20,7 +20,7 @@ func main() { client.SetCharset("utf-8"). SetSignType(alipay.RSA2). SetNotifyUrl("http://crm.deepic.cn/ali/pay/notify") - client.SetCertSnByPath("./appCertPublicKey_2021002103640726.crt", "./alipayRootCert.crt", "./alipayCertPublicKey_RSA2.crt") + client.SetCertSnByPath("./appPublicCert.crt", "./alipayRootCert.crt", "./alipayPublicCert.crt") //请求参数 bm := gopay.BodyMap{}