|
@@ -2381,8 +2381,8 @@ function getWidgetAnnotation({
|
|
|
return annotation
|
|
|
}
|
|
|
|
|
|
-function getSignatures({
|
|
|
- doc
|
|
|
+async function getSignatures({
|
|
|
+ doc,
|
|
|
}) {
|
|
|
const signatureList = []
|
|
|
const count = Module._GetSignatureCount(doc)
|
|
@@ -2410,25 +2410,31 @@ function getSignatures({
|
|
|
const signer = {
|
|
|
signerPtr,
|
|
|
isSignVerified: false,
|
|
|
- isCertValid: false,
|
|
|
+ isCertTrusted: false,
|
|
|
certificateList
|
|
|
}
|
|
|
|
|
|
const certPtr = Module._GetSignCert(signerPtr)
|
|
|
|
|
|
console.log('certPtr', certPtr)
|
|
|
- const result = false
|
|
|
+ let result = false
|
|
|
if (certPtr) {
|
|
|
// TODO: 验证证书
|
|
|
- // result = Module._VerifyGetChain(signerPtr, certPtr, 0, 10000)
|
|
|
- // if (result === 1) {
|
|
|
- // signer.IsCertTrusted = true
|
|
|
- // for (let f = 0; f < signer.certificateList.length; f++) {
|
|
|
- // signer.certificateList[f].IsTrusted = true
|
|
|
- // }
|
|
|
- // } else {
|
|
|
- // needCheck = true
|
|
|
- // }
|
|
|
+ CertArray = []
|
|
|
+ Module._ExportToFilePath(certPtr, 1)
|
|
|
+ ComPDFKitJS.opened_cert[0] = CertArray[0]
|
|
|
+ result = Module._VerifyGetChain(signerPtr, certPtr, 0, CertArray[0].length)
|
|
|
+ if (result === 1) {
|
|
|
+ signer.isCertTrusted = true
|
|
|
+ for (let f = 0; f < signer.certificateList.length; f++) {
|
|
|
+ signer.certificateList[f].IsTrusted = true
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ needCheck = true
|
|
|
+ }
|
|
|
+
|
|
|
+ const len = ComPDFKitJS.opened_files[0].length
|
|
|
+ result = Module._VerifyDocument(doc, signaturePtr, 0, len)
|
|
|
|
|
|
CertArray = []
|
|
|
Module._GetSignCertChain(certPtr)
|
|
@@ -2448,7 +2454,7 @@ function getSignatures({
|
|
|
const timeSpanPtr = Module._GetTimeStampSignature(signerPtr)
|
|
|
if (timeSpanPtr) {
|
|
|
// TODO: 验证时间戳
|
|
|
- // result = Module._VerifyTimestamp(signaturePtr, signerPtr, 0, 10000)
|
|
|
+ // result = Module._VerifyTimestamp(signaturePtr, signerPtr, 0, 0)
|
|
|
// if (result == 1) {
|
|
|
// signer.IsSignVerified = true;
|
|
|
// } else {
|