mirror of
https://github.com/xiaoqidun/ofdgo.git
synced 2026-08-30 12:12:40 +08:00
+11
-3
@@ -1673,7 +1673,7 @@ function renderSignatures() {
|
|||||||
const fragment = document.createDocumentFragment();
|
const fragment = document.createDocumentFragment();
|
||||||
for (const signature of signatures) {
|
for (const signature of signatures) {
|
||||||
const row = document.createElement("div");
|
const row = document.createElement("div");
|
||||||
row.className = `signature-row ${signature.integrityValid ? "valid" : "invalid"}`;
|
row.className = `signature-row ${signature.valid ? "valid" : "invalid"}`;
|
||||||
|
|
||||||
const head = document.createElement("div");
|
const head = document.createElement("div");
|
||||||
head.className = "signature-head";
|
head.className = "signature-head";
|
||||||
@@ -1682,13 +1682,16 @@ function renderSignatures() {
|
|||||||
|
|
||||||
const badges = document.createElement("div");
|
const badges = document.createElement("div");
|
||||||
badges.className = "signature-badges";
|
badges.className = "signature-badges";
|
||||||
badges.append(fontBadge(signature.integrityValid ? "完整" : "异常", signature.integrityValid ? "valid" : "invalid"));
|
badges.append(fontBadge(signature.valid ? "通过" : "异常", signature.valid ? "valid" : "invalid"));
|
||||||
|
|
||||||
head.append(name, badges);
|
head.append(name, badges);
|
||||||
row.append(head);
|
row.append(head);
|
||||||
appendSignatureLine(row, "编号", signature.id);
|
appendSignatureLine(row, "编号", signature.id);
|
||||||
appendSignatureLine(row, "版本", signature.version);
|
appendSignatureLine(row, "版本", signature.version);
|
||||||
appendSignatureLine(row, "章图", signature.sealType);
|
appendSignatureLine(row, "章图", signature.sealType);
|
||||||
|
appendSignatureLine(row, "章号", signature.sealId);
|
||||||
|
appendSignatureLine(row, "章名", signature.sealName);
|
||||||
|
appendSignatureLine(row, "厂商", signature.sealVendor);
|
||||||
appendSignatureLine(row, "签者", signature.signer);
|
appendSignatureLine(row, "签者", signature.signer);
|
||||||
appendSignatureLine(row, "时间", formatSignatureTime(signature.signatureDateTime));
|
appendSignatureLine(row, "时间", formatSignatureTime(signature.signatureDateTime));
|
||||||
appendSignatureLine(row, "机构", signatureAgency(signature));
|
appendSignatureLine(row, "机构", signatureAgency(signature));
|
||||||
@@ -1699,6 +1702,11 @@ function renderSignatures() {
|
|||||||
appendSignatureCheck(row, "一致", signature.sealMatchOK);
|
appendSignatureCheck(row, "一致", signature.sealMatchOK);
|
||||||
}
|
}
|
||||||
appendSignatureCheck(row, "证书", signature.certOK);
|
appendSignatureCheck(row, "证书", signature.certOK);
|
||||||
|
appendSignaturePolicy(row, "签期", signature.signatureTimeChecked, signature.signatureTimeOK);
|
||||||
|
appendSignaturePolicy(row, "章期", signature.sealTimeChecked, signature.sealTimeOK);
|
||||||
|
if (signature.sealCertTimeChecked) {
|
||||||
|
appendSignatureLine(row, "制期", signature.sealCertTimeOK ? "有效" : "失效", signature.sealCertTimeOK ? "ok" : "");
|
||||||
|
}
|
||||||
appendSignaturePolicy(row, "时效", signature.certTimeChecked, signature.certTimeOK);
|
appendSignaturePolicy(row, "时效", signature.certTimeChecked, signature.certTimeOK);
|
||||||
appendSignaturePolicy(row, "信任", signature.certTrustChecked, signature.certTrustOK);
|
appendSignaturePolicy(row, "信任", signature.certTrustChecked, signature.certTrustOK);
|
||||||
appendSignatureLine(row, "保护", signatureReferenceText(signature), signatureReferenceStatus(signature));
|
appendSignatureLine(row, "保护", signatureReferenceText(signature), signatureReferenceStatus(signature));
|
||||||
@@ -1718,7 +1726,7 @@ function signatureSummary(signatures) {
|
|||||||
if (!signatures.length) {
|
if (!signatures.length) {
|
||||||
return "0";
|
return "0";
|
||||||
}
|
}
|
||||||
const invalid = signatures.filter((signature) => !signature.integrityValid).length;
|
const invalid = signatures.filter((signature) => !signature.valid).length;
|
||||||
if (invalid) {
|
if (invalid) {
|
||||||
return `${signatures.length} · 异常 ${invalid}`;
|
return `${signatures.length} · 异常 ${invalid}`;
|
||||||
}
|
}
|
||||||
|
|||||||
+74
-56
@@ -41,34 +41,43 @@ type FontInfo = ofdgo.FontInfo
|
|||||||
|
|
||||||
// SignatureInfo 签名验证信息
|
// SignatureInfo 签名验证信息
|
||||||
type SignatureInfo struct {
|
type SignatureInfo struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
Type string `json:"type"`
|
Type string `json:"type"`
|
||||||
IntegrityValid bool `json:"integrityValid"`
|
Valid bool `json:"valid"`
|
||||||
Version string `json:"version,omitempty"`
|
Version string `json:"version,omitempty"`
|
||||||
SealType string `json:"sealType,omitempty"`
|
SealType string `json:"sealType,omitempty"`
|
||||||
Signer string `json:"signer,omitempty"`
|
SealID string `json:"sealId,omitempty"`
|
||||||
SignatureDateTime string `json:"signatureDateTime,omitempty"`
|
SealName string `json:"sealName,omitempty"`
|
||||||
Provider string `json:"provider,omitempty"`
|
SealVendor string `json:"sealVendor,omitempty"`
|
||||||
Company string `json:"company,omitempty"`
|
Signer string `json:"signer,omitempty"`
|
||||||
DataHashOK bool `json:"dataHashOK"`
|
SignatureDateTime string `json:"signatureDateTime,omitempty"`
|
||||||
SignedValueOK bool `json:"signedValueOK"`
|
Provider string `json:"provider,omitempty"`
|
||||||
SealOK bool `json:"sealOK"`
|
Company string `json:"company,omitempty"`
|
||||||
SealMatchOK bool `json:"sealMatchOK"`
|
DataHashOK bool `json:"dataHashOK"`
|
||||||
CertOK bool `json:"certOK"`
|
SignedValueOK bool `json:"signedValueOK"`
|
||||||
CertTimeChecked bool `json:"certTimeChecked,omitempty"`
|
SealOK bool `json:"sealOK"`
|
||||||
CertTimeOK bool `json:"certTimeOK,omitempty"`
|
SealMatchOK bool `json:"sealMatchOK"`
|
||||||
CertTrustChecked bool `json:"certTrustChecked,omitempty"`
|
CertOK bool `json:"certOK"`
|
||||||
CertTrustOK bool `json:"certTrustOK,omitempty"`
|
SignatureTimeChecked bool `json:"signatureTimeChecked,omitempty"`
|
||||||
ReferenceCount int `json:"referenceCount"`
|
SignatureTimeOK bool `json:"signatureTimeOK,omitempty"`
|
||||||
ReferencePassed int `json:"referencePassed"`
|
SealTimeChecked bool `json:"sealTimeChecked,omitempty"`
|
||||||
SignatureMethod string `json:"signatureMethod,omitempty"`
|
SealTimeOK bool `json:"sealTimeOK,omitempty"`
|
||||||
DigestMethod string `json:"digestMethod,omitempty"`
|
SealCertTimeChecked bool `json:"sealCertTimeChecked,omitempty"`
|
||||||
SignSerial string `json:"signSerial,omitempty"`
|
SealCertTimeOK bool `json:"sealCertTimeOK,omitempty"`
|
||||||
SignSubject string `json:"signSubject,omitempty"`
|
CertTimeChecked bool `json:"certTimeChecked,omitempty"`
|
||||||
SignIssuer string `json:"signIssuer,omitempty"`
|
CertTimeOK bool `json:"certTimeOK,omitempty"`
|
||||||
SealSubject string `json:"sealSubject,omitempty"`
|
CertTrustChecked bool `json:"certTrustChecked,omitempty"`
|
||||||
Stamps []SignatureStampInfo `json:"stamps,omitempty"`
|
CertTrustOK bool `json:"certTrustOK,omitempty"`
|
||||||
Error string `json:"error,omitempty"`
|
ReferenceCount int `json:"referenceCount"`
|
||||||
|
ReferencePassed int `json:"referencePassed"`
|
||||||
|
SignatureMethod string `json:"signatureMethod,omitempty"`
|
||||||
|
DigestMethod string `json:"digestMethod,omitempty"`
|
||||||
|
SignSerial string `json:"signSerial,omitempty"`
|
||||||
|
SignSubject string `json:"signSubject,omitempty"`
|
||||||
|
SignIssuer string `json:"signIssuer,omitempty"`
|
||||||
|
SealSubject string `json:"sealSubject,omitempty"`
|
||||||
|
Stamps []SignatureStampInfo `json:"stamps,omitempty"`
|
||||||
|
Error string `json:"error,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// SignatureStampInfo 签名外观信息
|
// SignatureStampInfo 签名外观信息
|
||||||
@@ -346,34 +355,43 @@ func (s *Session) signatureInfos() ([]SignatureInfo, error) {
|
|||||||
// 返回: SignatureInfo 签名验证信息
|
// 返回: SignatureInfo 签名验证信息
|
||||||
func signatureInfo(report ofdgo.SignatureVerifyReport) SignatureInfo {
|
func signatureInfo(report ofdgo.SignatureVerifyReport) SignatureInfo {
|
||||||
return SignatureInfo{
|
return SignatureInfo{
|
||||||
ID: report.ID,
|
ID: report.ID,
|
||||||
Type: string(report.Type),
|
Type: string(report.Type),
|
||||||
IntegrityValid: report.IntegrityValid(),
|
Valid: report.Valid,
|
||||||
Version: report.Provider.Version,
|
Version: report.Provider.Version,
|
||||||
SealType: report.SealType,
|
SealType: report.SealType,
|
||||||
Signer: signatureSigner(report),
|
SealID: report.SealInfo.ID,
|
||||||
SignatureDateTime: report.SignatureDateTime,
|
SealName: report.SealInfo.Name,
|
||||||
Provider: report.Provider.ProviderName,
|
SealVendor: report.SealInfo.VendorID,
|
||||||
Company: report.Provider.Company,
|
Signer: signatureSigner(report),
|
||||||
DataHashOK: report.DataHashOK,
|
SignatureDateTime: report.SignatureDateTime,
|
||||||
SignedValueOK: report.SignedValueOK,
|
Provider: report.Provider.ProviderName,
|
||||||
SealOK: report.SealOK,
|
Company: report.Provider.Company,
|
||||||
SealMatchOK: report.SealMatchOK,
|
DataHashOK: report.DataHashOK,
|
||||||
CertOK: report.CertOK,
|
SignedValueOK: report.SignedValueOK,
|
||||||
CertTimeChecked: report.CertTimeChecked,
|
SealOK: report.SealOK,
|
||||||
CertTimeOK: report.CertTimeOK,
|
SealMatchOK: report.SealMatchOK,
|
||||||
CertTrustChecked: report.CertTrustChecked,
|
CertOK: report.CertOK,
|
||||||
CertTrustOK: report.CertTrustOK,
|
SignatureTimeChecked: report.SignatureTimeChecked,
|
||||||
ReferenceCount: len(report.References),
|
SignatureTimeOK: report.SignatureTimeOK,
|
||||||
ReferencePassed: signatureReferencePassed(report.References),
|
SealTimeChecked: report.SealTimeChecked,
|
||||||
SignatureMethod: report.SignatureMethod,
|
SealTimeOK: report.SealTimeOK,
|
||||||
DigestMethod: report.DigestMethod,
|
SealCertTimeChecked: report.SealCertTimeChecked,
|
||||||
SignSerial: report.SignCert.SerialNumber,
|
SealCertTimeOK: report.SealCertTimeOK,
|
||||||
SignSubject: report.SignCert.Subject,
|
CertTimeChecked: report.CertTimeChecked,
|
||||||
SignIssuer: report.SignCert.Issuer,
|
CertTimeOK: report.CertTimeOK,
|
||||||
SealSubject: report.SealCert.Subject,
|
CertTrustChecked: report.CertTrustChecked,
|
||||||
Stamps: signatureStampInfos(report.StampPositions),
|
CertTrustOK: report.CertTrustOK,
|
||||||
Error: signatureReportError(report),
|
ReferenceCount: len(report.References),
|
||||||
|
ReferencePassed: signatureReferencePassed(report.References),
|
||||||
|
SignatureMethod: report.SignatureMethod,
|
||||||
|
DigestMethod: report.DigestMethod,
|
||||||
|
SignSerial: report.SignCert.SerialNumber,
|
||||||
|
SignSubject: report.SignCert.Subject,
|
||||||
|
SignIssuer: report.SignCert.Issuer,
|
||||||
|
SealSubject: report.SealCert.Subject,
|
||||||
|
Stamps: signatureStampInfos(report.StampPositions),
|
||||||
|
Error: signatureReportError(report),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user