====== XAdES İmza Yapıları ======
Kodları ''tr.gov.tubitak.uekae.esya.api.xades.example.structures'' paketi altında bulabilirsiniz.
===== Ayrık (Detached) İmza =====
İmzalanan dökümanın imzadan ayrı olduğu imza şeklidir. Örneği ''Detached'' sınıfındadır.
// 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));
===== Zarflayan (Enveloping) İmza =====
İmzalanan dökümanın imzanın içine konduğu imza şeklidir. Örnek kod ''Enveloping'' içindedir.
// 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, and keep BASE64 version of data
// in an