mirror of
https://github.com/xiaoqidun/ofdgo.git
synced 2026-08-30 12:12:40 +08:00
+25
-13
@@ -1544,27 +1544,26 @@ function renderSignatures() {
|
||||
|
||||
head.append(name, badges);
|
||||
row.append(head);
|
||||
appendSignatureLine(row, "编号", signature.id);
|
||||
appendSignatureLine(row, "版本", signature.version);
|
||||
appendSignatureLine(row, "章图", signature.sealType);
|
||||
appendSignatureLine(row, "签者", signature.signer);
|
||||
appendSignatureLine(row, "时间", formatSignatureTime(signature.signatureDateTime));
|
||||
appendSignatureLine(row, "机构", signatureAgency(signature));
|
||||
appendSignatureLine(row, "版本", signature.version);
|
||||
appendSignatureLine(row, "保护", `${signature.referencePassed || 0}/${signature.referenceCount || 0}`);
|
||||
appendSignatureCheck(row, "原文", signature.dataHashOK);
|
||||
appendSignatureCheck(row, "摘要", signature.digestOK);
|
||||
appendSignatureCheck(row, "签名", signature.signedValueOK);
|
||||
appendSignatureCheck(row, "证书", signature.certOK);
|
||||
if (signature.type !== "Sign") {
|
||||
appendSignatureCheck(row, "印章", signature.sealOK && signature.sealMatchOK);
|
||||
appendSignatureCheck(row, "匹配", signature.sealMatchOK);
|
||||
}
|
||||
appendSignatureCheck(row, "证书", signature.certOK);
|
||||
appendSignatureLine(row, "保护", signatureReferenceText(signature), signatureReferenceStatus(signature));
|
||||
appendSignatureLine(row, "序号", signature.signSerial);
|
||||
appendSignatureLine(row, "算法", signature.signatureMethod);
|
||||
appendSignatureLine(row, "散列", signature.digestMethod);
|
||||
appendSignatureLine(row, "主体", signature.signSubject && signature.signSubject !== signature.signer ? signature.signSubject : "");
|
||||
appendSignatureLine(row, "颁发", signature.signIssuer);
|
||||
appendSignatureLine(row, "序列", signature.signSerial);
|
||||
appendSignatureLine(row, "章图", signature.sealType);
|
||||
appendSignatureLine(row, "章证", signature.sealSubject);
|
||||
appendSignatureLine(row, "编号", signature.id);
|
||||
appendSignatureLine(row, "错误", signature.error, "fail");
|
||||
fragment.append(row);
|
||||
}
|
||||
@@ -1582,16 +1581,12 @@ function signatureSummary(signatures) {
|
||||
return `通过 ${signatures.length}`;
|
||||
}
|
||||
|
||||
function signatureName() {
|
||||
return "签名";
|
||||
}
|
||||
|
||||
function signatureNameNode(signature) {
|
||||
const stamps = signature.stamps || [];
|
||||
if (!stamps.length) {
|
||||
const name = document.createElement("div");
|
||||
name.className = "signature-name";
|
||||
name.textContent = signatureName();
|
||||
name.textContent = "签名";
|
||||
return name;
|
||||
}
|
||||
const name = document.createElement("div");
|
||||
@@ -1600,7 +1595,7 @@ function signatureNameNode(signature) {
|
||||
const button = document.createElement("button");
|
||||
button.type = "button";
|
||||
button.className = "signature-name-button";
|
||||
button.textContent = signatureName();
|
||||
button.textContent = "签名";
|
||||
button.addEventListener("click", () => focusSignatureStamp(stamps[0]));
|
||||
name.append(button, signatureStampGroup(stamps));
|
||||
return name;
|
||||
@@ -1632,6 +1627,23 @@ function signatureAgency(signature) {
|
||||
return signature.company || signature.provider || "";
|
||||
}
|
||||
|
||||
function signatureReferenceText(signature) {
|
||||
const passed = signature.referencePassed || 0;
|
||||
const count = signature.referenceCount || 0;
|
||||
if (!count) {
|
||||
return "";
|
||||
}
|
||||
return `${passed === count ? "通过" : "失败"} ${passed}/${count}`;
|
||||
}
|
||||
|
||||
function signatureReferenceStatus(signature) {
|
||||
const count = signature.referenceCount || 0;
|
||||
if (!count) {
|
||||
return "";
|
||||
}
|
||||
return signature.referencePassed === count ? "ok" : "fail";
|
||||
}
|
||||
|
||||
function formatSignatureTime(value) {
|
||||
const text = String(value || "").trim();
|
||||
const digits = text.match(/^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$/);
|
||||
|
||||
+26
-32
@@ -44,30 +44,27 @@ type SignatureInfo struct {
|
||||
ID string `json:"id"`
|
||||
Type string `json:"type"`
|
||||
Valid bool `json:"valid"`
|
||||
Error string `json:"error,omitempty"`
|
||||
Version string `json:"version,omitempty"`
|
||||
SealType string `json:"sealType,omitempty"`
|
||||
Signer string `json:"signer,omitempty"`
|
||||
SignatureDateTime string `json:"signatureDateTime,omitempty"`
|
||||
Provider string `json:"provider,omitempty"`
|
||||
Company string `json:"company,omitempty"`
|
||||
Version string `json:"version,omitempty"`
|
||||
Signer string `json:"signer,omitempty"`
|
||||
SignSubject string `json:"signSubject,omitempty"`
|
||||
SignIssuer string `json:"signIssuer,omitempty"`
|
||||
SignSerial string `json:"signSerial,omitempty"`
|
||||
SealSubject string `json:"sealSubject,omitempty"`
|
||||
SealIssuer string `json:"sealIssuer,omitempty"`
|
||||
SealSerial string `json:"sealSerial,omitempty"`
|
||||
SealType string `json:"sealType,omitempty"`
|
||||
SignatureMethod string `json:"signatureMethod,omitempty"`
|
||||
SignatureDateTime string `json:"signatureDateTime,omitempty"`
|
||||
DigestMethod string `json:"digestMethod,omitempty"`
|
||||
ReferenceCount int `json:"referenceCount"`
|
||||
ReferencePassed int `json:"referencePassed"`
|
||||
DigestOK bool `json:"digestOK"`
|
||||
DataHashOK bool `json:"dataHashOK"`
|
||||
SignedValueOK bool `json:"signedValueOK"`
|
||||
SealOK bool `json:"sealOK"`
|
||||
SealMatchOK bool `json:"sealMatchOK"`
|
||||
CertOK bool `json:"certOK"`
|
||||
ReferenceCount int `json:"referenceCount"`
|
||||
ReferencePassed int `json:"referencePassed"`
|
||||
SignSerial string `json:"signSerial,omitempty"`
|
||||
SignatureMethod string `json:"signatureMethod,omitempty"`
|
||||
DigestMethod string `json:"digestMethod,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 签名外观信息
|
||||
@@ -335,30 +332,27 @@ func signatureInfo(report ofdgo.SignatureVerifyReport, positions []ofdgo.Signatu
|
||||
ID: report.ID,
|
||||
Type: string(report.Type),
|
||||
Valid: report.Valid,
|
||||
Error: report.Error,
|
||||
Version: report.Provider.Version,
|
||||
SealType: report.SealType,
|
||||
Signer: signatureSigner(report),
|
||||
SignatureDateTime: report.SignatureDateTime,
|
||||
Provider: report.Provider.ProviderName,
|
||||
Company: report.Provider.Company,
|
||||
Version: report.Provider.Version,
|
||||
Signer: signatureSigner(report),
|
||||
SignSubject: report.SignCert.Subject,
|
||||
SignIssuer: report.SignCert.Issuer,
|
||||
SignSerial: report.SignCert.SerialNumber,
|
||||
SealSubject: report.SealCert.Subject,
|
||||
SealIssuer: report.SealCert.Issuer,
|
||||
SealSerial: report.SealCert.SerialNumber,
|
||||
SealType: report.SealType,
|
||||
SignatureMethod: report.SignatureMethod,
|
||||
SignatureDateTime: report.SignatureDateTime,
|
||||
DigestMethod: report.DigestMethod,
|
||||
ReferenceCount: len(report.References),
|
||||
ReferencePassed: signatureReferencePassed(report.References),
|
||||
DigestOK: report.DigestOK,
|
||||
DataHashOK: report.DataHashOK,
|
||||
SignedValueOK: report.SignedValueOK,
|
||||
SealOK: report.SealOK,
|
||||
SealMatchOK: report.SealMatchOK,
|
||||
CertOK: report.CertOK,
|
||||
ReferenceCount: len(report.References),
|
||||
ReferencePassed: signatureReferencePassed(report.References),
|
||||
SignSerial: report.SignCert.SerialNumber,
|
||||
SignatureMethod: report.SignatureMethod,
|
||||
DigestMethod: report.DigestMethod,
|
||||
SignSubject: report.SignCert.Subject,
|
||||
SignIssuer: report.SignCert.Issuer,
|
||||
SealSubject: report.SealCert.Subject,
|
||||
Stamps: signatureStampInfos(positions),
|
||||
Error: report.Error,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user