### Question:
SESV1ValidateContainer implements SignedDataValidateContainer { @Override public void validate(SigType type, String signAlgName, byte[] tbsContent, byte[] signedValue) throws InvalidSignedValueException, IOException, GeneralSecurityException { if (type == SigType.Sign) { throw new IllegalArgumentException("签名类型(type)必须是 Seal，不支持电子印章验证"); } MessageDigest md = new SM3.Digest(); byte[] actualDataHash = md.digest(tbsContent); SES_Signature sesSignature = SES_Signature.getInstance(signedValue); TBS_Sign toSign = sesSignature.getToSign(); byte[] expectDataHash = toSign.getDataHash().getOctets(); if (!Arrays.equals(actualDataHash, expectDataHash)) { throw new InvalidSignedValueException("Signature.xml 文件被篡改，电子签章失效。(" + toSign.getPropertyInfo().getString() + ")"); } byte[] expSigVal = sesSignature.getSignature().getOctets(); Signature sg = Signature.getInstance( toSign.getSignatureAlgorithm().getId(), new BouncyCastleProvider()); byte[] certDER = toSign.getCert().getOctets(); Certificate signCert = new CertificateFactory() .engineGenerateCertificate(new ByteArrayInputStream(certDER)); sg.initVerify(signCert); sg.update(toSign.getEncoded("DER")); if (!sg.verify(expSigVal)) { throw new InvalidSignedValueException("电子签章数据签名值不匹配，电子签章数据失效。"); } }  @Override void validate(SigType type,
                         String signAlgName,
                         byte[] tbsContent,
                         byte[] signedValue);  }### Answer:
@Test void validate() throws IOException, GeneralSecurityException { Path src = Paths.get("target/SESV1SignDoc.ofd"); try (OFDReader reader = new OFDReader(src); OFDValidator validator = new OFDValidator(reader)) { validator.setValidator(new SESV1ValidateContainer()); validator.exeValidate(); System.out.println(">> 验证通过"); } }