Bu sayfa salt okunur. Kaynağı görebilirsiniz ama değiştiremezsiniz. Bunun yanlış olduğunu düşünüyorsanız yöneticiye danışın.
The sample codes for creating different types of signatures stated in the standarts are listed below. See the section Signature Types for the information about signature types
The sample codes are in the package tr.gov.tubitak.uekae.esya.api.xades.example.formats.
tr.gov.tubitak.uekae.esya.api.xades.example.formats
BES signature creation is as follows:
BES
<sxh java> create context with working directory Context context = createContext(); create signature according to context, with default type (XADES_BES) XMLSignature signature = new XMLSignature(context); add document as reference, but do not embed it into the signature (embed=false) signature.addDocument("./sample.txt", "text/plain", false); signature.getSignedInfo().setSignatureMethod(SignatureMethod.RSA_SHA256); false-true gets non-qualified certificates while true-false gets qualified ones X509Certificate cert = JSmartCardManager.getInstance().getSignatureCertificate(true, false);
add certificate to show who signed the document signature.addKeyInfo(new ECertificate(cert.getEncoded())); now sign it by using smart card signature.sign(JSmartCardManager.getInstance().getSigner(PIN, cert));
signature.write(new FileOutputStream(BASE_DIR + SIGNATURE_FILENAME)); </sxh>
T signature creation is as follows:
T
upgrade to T signature.upgrade(SignatureType.ES_T); signature.write(new FileOutputStream(BASE_DIR + SIGNATURE_FILENAME)); </sxh> ===== C Signature ===== C signature creation is as follows: The difference is the upgrade line, which is ES_C in this case. <sxh java> upgrade to C signature.upgrade(SignatureType.ES_C); </sxh>
C
ES_C
X1 signature creation is as follows:
X1
The difference is the upgrade line, which is ES_X_Type1 in this case.
ES_X_Type1
<sxh java> upgrade to X1 signature.upgrade(SignatureType.ES_X_Type1); </sxh> ===== X-Type2 Signature ===== X2 signature creation is as follows. The difference is the upgrade line, which is ES_X_Type2 in this case. <sxh java> upgrade to X2 signature.upgrade(SignatureType.ES_X_Type2); </sxh>
X2
ES_X_Type2
XL signature creation is as follows:
XL
The difference is the upgrade line, which is ES_XL in this case.
ES_XL
<sxh java> upgrade to XL signature.upgrade(SignatureType.ES_XL); </sxh> ===== Archival Signature ===== A signature creation is as follows: The difference is the upgrade line, which is ES_A in this case. <sxh java> upgrade to A signature.upgrade(SignatureType.ES_A); </sxh>
A
ES_A