mirror of
https://github.com/woodchen-ink/certimate.git
synced 2025-07-19 01:41:55 +08:00
improvement: improve certificate fingerprint comparison
This commit is contained in:
parent
9eae8f5077
commit
f847b7ff62
@ -6,6 +6,7 @@ import (
|
|||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
xerrors "github.com/pkg/errors"
|
xerrors "github.com/pkg/errors"
|
||||||
@ -68,7 +69,7 @@ func (u *VolcengineCDNUploader) Upload(ctx context.Context, certPem string, priv
|
|||||||
if listCertResp.Result.CertInfo != nil {
|
if listCertResp.Result.CertInfo != nil {
|
||||||
for _, certDetail := range listCertResp.Result.CertInfo {
|
for _, certDetail := range listCertResp.Result.CertInfo {
|
||||||
hash := sha256.Sum256(certX509.Raw)
|
hash := sha256.Sum256(certX509.Raw)
|
||||||
isSameCert := hex.EncodeToString(hash[:]) == certDetail.CertFingerprint.Sha256
|
isSameCert := strings.EqualFold(hex.EncodeToString(hash[:]), certDetail.CertFingerprint.Sha256)
|
||||||
// 如果已存在相同证书,直接返回已有的证书信息
|
// 如果已存在相同证书,直接返回已有的证书信息
|
||||||
if isSameCert {
|
if isSameCert {
|
||||||
return &uploader.UploadResult{
|
return &uploader.UploadResult{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user