### Question:
SESV1Container implements ExtendSignatureContainer { @Override public byte[] sign(InputStream inData, String propertyInfo) throws IOException, GeneralSecurityException { MessageDigest md = getDigestFnc(); byte[] digest = md.digest(IOUtils.toByteArray(inData)); ASN1UTCTime signUTCTime = new ASN1UTCTime(new Date(), Locale.CHINA); TBS_Sign tbsSign = new TBS_Sign() .setVersion(new ASN1Integer(1)) .setEseal(seal) .setTimeInfo(new DERBitString(signUTCTime)) .setDataHash(new DERBitString(digest)) .setPropertyInfo(new DERIA5String(propertyInfo)) .setCert(new DEROctetString(certificate.getEncoded())) .setSignatureAlgorithm(GMObjectIdentifiers.sm2sign_with_sm3); Signature signature = Signature.getInstance("SM3withSm2", new BouncyCastleProvider()); signature.initSign(privateKey); signature.update(tbsSign.getEncoded("DER")); byte[] sign = signature.sign(); SES_Signature sesSignature = new SES_Signature(tbsSign, new DERBitString(sign)); return sesSignature.getEncoded("DER"); } SESV1Container(PrivateKey privateKey, SESeal seal, Certificate signCert); @Override MessageDigest getDigestFnc(); @Override ASN1ObjectIdentifier getSignAlgOID(); @Override byte[] sign(InputStream inData, String propertyInfo); @Override byte[] getSeal(); @Override SigType getSignType();  }### Answer:
@Test public void sign() throws GeneralSecurityException, IOException { Path userP12Path = Paths.get("src/test/resources", "USER.p12"); Path sealPath = Paths.get("src/test/resources", "UserV1.esl"); PrivateKey prvKey = PKCS12Tools.ReadPrvKey(userP12Path, "private", "777777"); Certificate signCert = PKCS12Tools.ReadUserCert(userP12Path, "private", "777777"); SESeal seal = SESeal.getInstance(Files.readAllBytes(sealPath)); Path src = Paths.get("src/test/resources", "helloworld.ofd"); Path out = Paths.get("target/SESV1SignDoc.ofd"); try (OFDReader reader = new OFDReader(src); OFDSigner signer = new OFDSigner(reader, out) ) { SESV1Container signContainer = new SESV1Container(prvKey, seal, signCert); signer.setSignMode(SignMode.ContinueSign); signer.setSignContainer(signContainer); signer.addApPos(new NormalStampPos(1, 50, 50, 40, 40)); signer.exeSign(); } System.out.println(">> 生成文件位置: " + out.toAbsolutePath().toAbsolutePath()); }