### Question:
SES_Signature extends ASN1Object { public static SES_Signature getInstance(Object o) { if (o instanceof SES_Signature) { return (SES_Signature) o; } else if (o != null) { return new SES_Signature(ASN1Sequence.getInstance(o)); } return null; } SES_Signature();  SES_Signature(TBS_Sign toSign, ASN1BitString signature);  SES_Signature(ASN1Sequence seq); static SES_Signature getInstance(Object o); TBS_Sign getToSign(); SES_Signature setToSign(TBS_Sign toSign); ASN1BitString getSignature(); SES_Signature setSignature(ASN1BitString signature); SES_Signature setSignature(byte[] signature); @Override ASN1Primitive toASN1Primitive();  }### Answer:
@Test void build() throws Exception { Path p = Paths.get("src/test/resources", "UserV1.esl"); final Path out = Paths.get("target/SignedValue.dat"); Path userP12 = Paths.get("src/test/resources", "USER.p12"); Certificate userCert = PKCS12Tools.ReadUserCert(userP12, "private", "777777"); byte[] mockDigest = new byte[32]; SESeal seal = SESeal.getInstance(Files.readAllBytes(p)); String propertyInfo = "/Doc_0/Signs/Signatures.xml"; 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(mockDigest)) .setPropertyInfo(new DERIA5String(propertyInfo)) .setCert(new DEROctetString(userCert.getEncoded())) .setSignatureAlgorithm(GMObjectIdentifiers.sm2sign_with_sm3); char[] pwd = "777777".toCharArray(); KeyStore userKs = KeyStore.getInstance("PKCS12", new BouncyCastleProvider()); try (InputStream rootKsIn = Files.newInputStream(userP12)) { userKs.load(rootKsIn, pwd); PrivateKey privateKey = (PrivateKey) userKs.getKey("private", pwd); Signature signature = Signature.getInstance("SM3withSm2", "BC"); signature.initSign(privateKey); signature.update(tbsSign.getEncoded("DER")); byte[] sign = signature.sign(); SES_Signature sesSignature = new SES_Signature(tbsSign, new DERBitString(sign)); Files.write(out, sesSignature.getEncoded("DER")); } }