Bu sayfa salt okunur. Kaynağı görebilirsiniz ama değiştiremezsiniz. Bunun yanlış olduğunu düşünüyorsanız yöneticiye danışın.
The attributes listed in the standarts can be added to XAdES signatures.
The sample codes are in the package tr.gov.tubitak.uekae.esya.api.xades.example.attributes.
tr.gov.tubitak.uekae.esya.api.xades.example.attributes
It adds the time of signature creation ,which is stated by the signer, to the signed document
See SigningTimeAttribute.
SigningTimeAttribute
<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())); add signing time signature.getQualifyingProperties().getSignedSignatureProperties().setSigningTime(getTime());
now sign it by using smart card signature.sign(JSmartCardManager.getInstance().getSigner(PIN, cert)); signature.write(new FileOutputStream(BASE_DIR + SIGNATURE_FILENAME)); </sxh> ===== Signing Production Place ===== It states the location of the signature creation. See SignatureProductionPlaceAttribute . <sxh java> add signature production place signature.getQualifyingProperties().getSignedSignatureProperties().setSignatureProductionPlace(
SignatureProductionPlaceAttribute
new SignatureProductionPlace(context, "Istanbul", "Marmara", "34470", "Turkey"));
</sxh>
It contains additional information about the signer.
See SignerRoleAttribute.
SignerRoleAttribute
<sxh java> add signer role signature.getQualifyingProperties().getSignedSignatureProperties().setSignerRole( new SignerRole(context, new ClaimedRole[]{new ClaimedRole(context, "Manager")})); </sxh> ===== Commitment Type Indication ===== It specifies the commitment type of the signed document. See CommitmentTypeIndicationAttribute. <sxh java> create context with working directory Context context = createContext();
CommitmentTypeIndicationAttribute
create signature according to context, with default type (XADES_BES) XMLSignature signature = new XMLSignature(context);
add document String ref1 = "#"+signature.addDocument("./sample.txt", "text/plain", true); String objId2 = signature.addPlainObject("Test data 1.", "text/plain", null); String ref2 = "#"+signature.addDocument("#"+objId2, null, 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())); add commitment type indication signature.getQualifyingProperties().getSignedProperties().createOrGetSignedDataObjectProperties().
addCommitmentTypeIndication(createTestCTI(context,ref1,ref2));
now sign it by using smart card signature.sign(JSmartCardManager.getInstance().getSigner(PIN, cert)); signature.write(new FileOutputStream(BASE_DIR + SIGNATURE_FILENAME)); </sxh> ===== Timestamp for All Data Objects ===== It contains the timestamp for all documents. See AllDataObjectsTimeStampAttribute. <sxh java> add all data objects timestamp signature.getQualifyingProperties().getSignedProperties().createOrGetSignedDataObjectProperties().
AllDataObjectsTimeStampAttribute
addAllDataObjectsTimeStamp(new AllDataObjectsTimeStamp(context,signature));
It contains the timestamp taken overs the documents seperately.
See IndividualDataObjectTimeStampAttribute.
IndividualDataObjectTimeStampAttribute
<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 into the signature and get the reference String ref1 = "#" + signature.addDocument("./sample.txt", "text/plain", true);
add another object String objId2 = signature.addPlainObject("Test Data 1", "text/plain", null); String ref2 = "#" + signature.addDocument("#"+objId2, null, 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())); create new individual data objects timestamp structure IndividualDataObjectsTimeStamp timestamp = new IndividualDataObjectsTimeStamp(context);
add objects to timestamp structure timestamp.addInclude(new Include(context, ref1, Boolean.TRUE)); timestamp.addInclude(new Include(context, ref2, Boolean.TRUE)); get encapsulated timestamp to individual data objects timestamp timestamp.addEncapsulatedTimeStamp(signature);
add individual data objects timestamp to signature signature.getQualifyingProperties().getSignedProperties().createOrGetSignedDataObjectProperties(). addIndividualDataObjectsTimeStamp(timestamp); optional - add timestamp validation data signature.addTimeStampValidationData(timestamp, Calendar.getInstance());
now sign it by using smart card signature.sign(JSmartCardManager.getInstance().getSigner(PIN, cert)); signature.write(new FileOutputStream(BASE_DIR + SIGNATURE_FILENAME)); </sxh>