mirror of
https://github.com/xiaoqidun/ofdgo.git
synced 2026-08-30 12:12:40 +08:00
@@ -1557,6 +1557,8 @@ function renderSignatures() {
|
|||||||
appendSignatureCheck(row, "匹配", signature.sealMatchOK);
|
appendSignatureCheck(row, "匹配", signature.sealMatchOK);
|
||||||
}
|
}
|
||||||
appendSignatureCheck(row, "证书", signature.certOK);
|
appendSignatureCheck(row, "证书", signature.certOK);
|
||||||
|
appendSignaturePolicy(row, "时效", signature.certTimeChecked, signature.certTimeOK);
|
||||||
|
appendSignaturePolicy(row, "信任", signature.certTrustChecked, signature.certTrustOK);
|
||||||
appendSignatureLine(row, "保护", signatureReferenceText(signature), signatureReferenceStatus(signature));
|
appendSignatureLine(row, "保护", signatureReferenceText(signature), signatureReferenceStatus(signature));
|
||||||
appendSignatureLine(row, "序号", signature.signSerial);
|
appendSignatureLine(row, "序号", signature.signSerial);
|
||||||
appendSignatureLine(row, "算法", signature.signatureMethod);
|
appendSignatureLine(row, "算法", signature.signatureMethod);
|
||||||
@@ -1676,6 +1678,13 @@ function appendSignatureCheck(row, label, ok) {
|
|||||||
appendSignatureLine(row, label, ok ? "通过" : "失败", ok ? "ok" : "fail");
|
appendSignatureLine(row, label, ok ? "通过" : "失败", ok ? "ok" : "fail");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function appendSignaturePolicy(row, label, checked, ok) {
|
||||||
|
if (!checked) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
appendSignatureCheck(row, label, ok);
|
||||||
|
}
|
||||||
|
|
||||||
async function focusSignatureStamp(stamp) {
|
async function focusSignatureStamp(stamp) {
|
||||||
const pageIndex = (stamp.page || 0) - 1;
|
const pageIndex = (stamp.page || 0) - 1;
|
||||||
if (!state.doc || pageIndex < 0) {
|
if (!state.doc || pageIndex < 0) {
|
||||||
|
|||||||
+26
-9
@@ -55,6 +55,10 @@ type SignatureInfo struct {
|
|||||||
SealOK bool `json:"sealOK"`
|
SealOK bool `json:"sealOK"`
|
||||||
SealMatchOK bool `json:"sealMatchOK"`
|
SealMatchOK bool `json:"sealMatchOK"`
|
||||||
CertOK bool `json:"certOK"`
|
CertOK bool `json:"certOK"`
|
||||||
|
CertTimeChecked bool `json:"certTimeChecked,omitempty"`
|
||||||
|
CertTimeOK bool `json:"certTimeOK,omitempty"`
|
||||||
|
CertTrustChecked bool `json:"certTrustChecked,omitempty"`
|
||||||
|
CertTrustOK bool `json:"certTrustOK,omitempty"`
|
||||||
ReferenceCount int `json:"referenceCount"`
|
ReferenceCount int `json:"referenceCount"`
|
||||||
ReferencePassed int `json:"referencePassed"`
|
ReferencePassed int `json:"referencePassed"`
|
||||||
SignSerial string `json:"signSerial,omitempty"`
|
SignSerial string `json:"signSerial,omitempty"`
|
||||||
@@ -315,19 +319,15 @@ func (s *Session) signatureInfos() ([]SignatureInfo, error) {
|
|||||||
}
|
}
|
||||||
infos := make([]SignatureInfo, 0, len(reports))
|
infos := make([]SignatureInfo, 0, len(reports))
|
||||||
for _, report := range reports {
|
for _, report := range reports {
|
||||||
positions, err := s.Reader.SignatureStampPositions(report.Stamps)
|
infos = append(infos, signatureInfo(report))
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
infos = append(infos, signatureInfo(report, positions))
|
|
||||||
}
|
}
|
||||||
return infos, nil
|
return infos, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// signatureInfo 转换签名验证信息
|
// signatureInfo 转换签名验证信息
|
||||||
// 入参: report 签名验证报告, positions 签名外观位置
|
// 入参: report 签名验证报告
|
||||||
// 返回: SignatureInfo 签名验证信息
|
// 返回: SignatureInfo 签名验证信息
|
||||||
func signatureInfo(report ofdgo.SignatureVerifyReport, positions []ofdgo.SignatureStampPosition) 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),
|
||||||
@@ -343,6 +343,10 @@ func signatureInfo(report ofdgo.SignatureVerifyReport, positions []ofdgo.Signatu
|
|||||||
SealOK: report.SealOK,
|
SealOK: report.SealOK,
|
||||||
SealMatchOK: report.SealMatchOK,
|
SealMatchOK: report.SealMatchOK,
|
||||||
CertOK: report.CertOK,
|
CertOK: report.CertOK,
|
||||||
|
CertTimeChecked: report.CertTimeChecked,
|
||||||
|
CertTimeOK: report.CertTimeOK,
|
||||||
|
CertTrustChecked: report.CertTrustChecked,
|
||||||
|
CertTrustOK: report.CertTrustOK,
|
||||||
ReferenceCount: len(report.References),
|
ReferenceCount: len(report.References),
|
||||||
ReferencePassed: signatureReferencePassed(report.References),
|
ReferencePassed: signatureReferencePassed(report.References),
|
||||||
SignSerial: report.SignCert.SerialNumber,
|
SignSerial: report.SignCert.SerialNumber,
|
||||||
@@ -351,8 +355,8 @@ func signatureInfo(report ofdgo.SignatureVerifyReport, positions []ofdgo.Signatu
|
|||||||
SignSubject: report.SignCert.Subject,
|
SignSubject: report.SignCert.Subject,
|
||||||
SignIssuer: report.SignCert.Issuer,
|
SignIssuer: report.SignCert.Issuer,
|
||||||
SealSubject: report.SealCert.Subject,
|
SealSubject: report.SealCert.Subject,
|
||||||
Stamps: signatureStampInfos(positions),
|
Stamps: signatureStampInfos(report.StampPositions),
|
||||||
Error: report.Error,
|
Error: signatureReportError(report),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -385,6 +389,19 @@ func signatureReferencePassed(refs []ofdgo.SignatureReferenceVerify) int {
|
|||||||
return count
|
return count
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// signatureReportError 获取签名错误信息
|
||||||
|
// 入参: report 签名验证报告
|
||||||
|
// 返回: string 错误信息
|
||||||
|
func signatureReportError(report ofdgo.SignatureVerifyReport) string {
|
||||||
|
if report.Error != "" && report.StampPositionError != "" {
|
||||||
|
return report.Error + "; " + report.StampPositionError
|
||||||
|
}
|
||||||
|
if report.Error != "" {
|
||||||
|
return report.Error
|
||||||
|
}
|
||||||
|
return report.StampPositionError
|
||||||
|
}
|
||||||
|
|
||||||
// signatureStampInfos 转换签名外观位置
|
// signatureStampInfos 转换签名外观位置
|
||||||
// 入参: positions 签名外观位置
|
// 入参: positions 签名外观位置
|
||||||
// 返回: []SignatureStampInfo 签名外观信息
|
// 返回: []SignatureStampInfo 签名外观信息
|
||||||
|
|||||||
Reference in New Issue
Block a user