Bu sayfa salt okunur. Kaynağı görebilirsiniz ama değiştiremezsiniz. Bunun yanlış olduğunu düşünüyorsanız yöneticiye danışın.
Mevcut imzanın okunmasının ardından geliştirme fonksiyonunun geliştirilmek istenen imza tipi parametresi ile çağırılması yeterlidir.
<sxh java> create context with working directory Context context = createContext(); read signature to be upgraded XMLSignature signature = XMLSignature.parse(new FileDocument(new File(BASE_DIR + "bes.xml")),context);
upgrade to T signature.upgrade(SignatureType.ES_T); signature.write(new FileOutputStream(BASE_DIR + SIGNATURE_FILENAME)); </sxh> ===== Zarflanmış İmzanın Geliştirmesi ===== Zarflanmış imzalarda ise dökümanın okunması, içinden imzanın alınması, imzanın geliştirilmesi ve tekrar bütün dökümanın yazılması gerekir. <sxh java> create context with working directory Context context = createContext();
parse the previously created enveloped signature org.w3c.dom.Document document = parseDoc(Enveloped.SIGNATURE_FILENAME, context); get the signature in DOM document XMLSignature signature = readSignature(document, context);
upgrade the signature to type T signature.upgrade(SignatureType.ES_T); writing enveloped XML to the file Source source = new DOMSource(document); Transformer transformer = TransformerFactory.newInstance().newTransformer(); transformer.transform(source, new StreamResult(new FileOutputStream(BASE_DIR + SIGNATURE_FILENAME))); </sxh>
Paralel imzaların geliştirmesinde ise geliştirilecek imzalar seçilip onlar üzerinden işlem yapılması gerekir.
<sxh java> create context with working directory Context context = createContext(); parse the previously created enveloped signature org.w3c.dom.Document document = parseDoc(ParallelDetached.SIGNATURE_FILENAME, context);
get and upgrade the signature 1 in DOM document XMLSignature signature1 = readSignature(document, context, 0); signature1.upgrade(SignatureType.ES_T); get and upgrade the signature 2 in DOM document XMLSignature signature2 = readSignature(document, context, 1); signature2.upgrade(SignatureType.ES_T);
writing enveloped XML to the file Source source = new DOMSource(document); Transformer transformer = TransformerFactory.newInstance().newTransformer(); transformer.transform(source, new StreamResult(new FileOutputStream(BASE_DIR + SIGNATURE_FILENAME))); </sxh>