public class PdfDigitalSignatureTimestampSettings
Example:
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.writeln("Signed PDF contents.");
// Create a "PdfSaveOptions" object that we can pass to the document's "Save" method
// to modify how that method converts the document to .PDF.
PdfSaveOptions options = new PdfSaveOptions();
// Create a digital signature, and assign it to our SaveOptions object to sign the document when we save it to PDF.
CertificateHolder certificateHolder = CertificateHolder.create(getMyDir() + "morzal.pfx", "aw");
options.setDigitalSignatureDetails(new PdfDigitalSignatureDetails(certificateHolder, "Test Signing", "Aspose Office", new Date()));
// Create a timestamp authority-verified timestamp.
options.getDigitalSignatureDetails().setTimestampSettings(new PdfDigitalSignatureTimestampSettings("https://freetsa.org/tsr", "JohnDoe", "MyPassword"));
// The default lifespan of the timestamp is 100 seconds.
Assert.assertEquals(options.getDigitalSignatureDetails().getTimestampSettings().getTimeout(), 100000);
// We can set our own timeout period via the constructor.
options.getDigitalSignatureDetails().setTimestampSettings(new PdfDigitalSignatureTimestampSettings("https://freetsa.org/tsr", "JohnDoe", "MyPassword", (long) 30.0));
Assert.assertEquals(options.getDigitalSignatureDetails().getTimestampSettings().getTimeout(), 30);
Assert.assertEquals(options.getDigitalSignatureDetails().getTimestampSettings().getServerUrl(), "https://freetsa.org/tsr");
Assert.assertEquals(options.getDigitalSignatureDetails().getTimestampSettings().getUserName(), "JohnDoe");
Assert.assertEquals(options.getDigitalSignatureDetails().getTimestampSettings().getPassword(), "MyPassword");
// The "Save" method will apply our signature to the output document at this time.
doc.save(getArtifactsDir() + "PdfSaveOptions.PdfDigitalSignatureTimestamp.pdf", options);
Constructor Summary |
---|
PdfDigitalSignatureTimestampSettings()
Initializes an instance of this class. |
PdfDigitalSignatureTimestampSettings(java.lang.StringserverUrl, java.lang.StringuserName, java.lang.Stringpassword)
Initializes an instance of this class. |
Property Getters/Setters Summary | ||
---|---|---|
java.lang.String | getPassword() | |
void | setPassword(java.lang.Stringvalue) | |
Timestamp server password. | ||
java.lang.String | getServerUrl() | |
void | setServerUrl(java.lang.Stringvalue) | |
Timestamp server URL. | ||
System.TimeSpan | getTimeout() | |
Time-out value in milliseconds for accessing timestamp server.
|
||
java.lang.String | getUserName() | |
void | setUserName(java.lang.Stringvalue) | |
Timestamp server user name. |
public PdfDigitalSignatureTimestampSettings()
Example:
Shows how to sign a saved PDF document digitally and timestamp it.Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); builder.writeln("Signed PDF contents."); // Create a "PdfSaveOptions" object that we can pass to the document's "Save" method // to modify how that method converts the document to .PDF. PdfSaveOptions options = new PdfSaveOptions(); // Create a digital signature, and assign it to our SaveOptions object to sign the document when we save it to PDF. CertificateHolder certificateHolder = CertificateHolder.create(getMyDir() + "morzal.pfx", "aw"); options.setDigitalSignatureDetails(new PdfDigitalSignatureDetails(certificateHolder, "Test Signing", "Aspose Office", new Date())); // Create a timestamp authority-verified timestamp. options.getDigitalSignatureDetails().setTimestampSettings(new PdfDigitalSignatureTimestampSettings("https://freetsa.org/tsr", "JohnDoe", "MyPassword")); // The default lifespan of the timestamp is 100 seconds. Assert.assertEquals(options.getDigitalSignatureDetails().getTimestampSettings().getTimeout(), 100000); // We can set our own timeout period via the constructor. options.getDigitalSignatureDetails().setTimestampSettings(new PdfDigitalSignatureTimestampSettings("https://freetsa.org/tsr", "JohnDoe", "MyPassword", (long) 30.0)); Assert.assertEquals(options.getDigitalSignatureDetails().getTimestampSettings().getTimeout(), 30); Assert.assertEquals(options.getDigitalSignatureDetails().getTimestampSettings().getServerUrl(), "https://freetsa.org/tsr"); Assert.assertEquals(options.getDigitalSignatureDetails().getTimestampSettings().getUserName(), "JohnDoe"); Assert.assertEquals(options.getDigitalSignatureDetails().getTimestampSettings().getPassword(), "MyPassword"); // The "Save" method will apply our signature to the output document at this time. doc.save(getArtifactsDir() + "PdfSaveOptions.PdfDigitalSignatureTimestamp.pdf", options);
public PdfDigitalSignatureTimestampSettings(java.lang.String serverUrl, java.lang.String userName, java.lang.String password)
serverUrl
- Timestamp server URL.userName
- Timestamp server user name.password
- Timestamp server password.Example:
Shows how to sign a saved PDF document digitally and timestamp it.Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); builder.writeln("Signed PDF contents."); // Create a "PdfSaveOptions" object that we can pass to the document's "Save" method // to modify how that method converts the document to .PDF. PdfSaveOptions options = new PdfSaveOptions(); // Create a digital signature, and assign it to our SaveOptions object to sign the document when we save it to PDF. CertificateHolder certificateHolder = CertificateHolder.create(getMyDir() + "morzal.pfx", "aw"); options.setDigitalSignatureDetails(new PdfDigitalSignatureDetails(certificateHolder, "Test Signing", "Aspose Office", new Date())); // Create a timestamp authority-verified timestamp. options.getDigitalSignatureDetails().setTimestampSettings(new PdfDigitalSignatureTimestampSettings("https://freetsa.org/tsr", "JohnDoe", "MyPassword")); // The default lifespan of the timestamp is 100 seconds. Assert.assertEquals(options.getDigitalSignatureDetails().getTimestampSettings().getTimeout(), 100000); // We can set our own timeout period via the constructor. options.getDigitalSignatureDetails().setTimestampSettings(new PdfDigitalSignatureTimestampSettings("https://freetsa.org/tsr", "JohnDoe", "MyPassword", (long) 30.0)); Assert.assertEquals(options.getDigitalSignatureDetails().getTimestampSettings().getTimeout(), 30); Assert.assertEquals(options.getDigitalSignatureDetails().getTimestampSettings().getServerUrl(), "https://freetsa.org/tsr"); Assert.assertEquals(options.getDigitalSignatureDetails().getTimestampSettings().getUserName(), "JohnDoe"); Assert.assertEquals(options.getDigitalSignatureDetails().getTimestampSettings().getPassword(), "MyPassword"); // The "Save" method will apply our signature to the output document at this time. doc.save(getArtifactsDir() + "PdfSaveOptions.PdfDigitalSignatureTimestamp.pdf", options);
public java.lang.String getPassword() / public void setPassword(java.lang.String value)
Example:
Shows how to sign a saved PDF document digitally and timestamp it.Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); builder.writeln("Signed PDF contents."); // Create a "PdfSaveOptions" object that we can pass to the document's "Save" method // to modify how that method converts the document to .PDF. PdfSaveOptions options = new PdfSaveOptions(); // Create a digital signature, and assign it to our SaveOptions object to sign the document when we save it to PDF. CertificateHolder certificateHolder = CertificateHolder.create(getMyDir() + "morzal.pfx", "aw"); options.setDigitalSignatureDetails(new PdfDigitalSignatureDetails(certificateHolder, "Test Signing", "Aspose Office", new Date())); // Create a timestamp authority-verified timestamp. options.getDigitalSignatureDetails().setTimestampSettings(new PdfDigitalSignatureTimestampSettings("https://freetsa.org/tsr", "JohnDoe", "MyPassword")); // The default lifespan of the timestamp is 100 seconds. Assert.assertEquals(options.getDigitalSignatureDetails().getTimestampSettings().getTimeout(), 100000); // We can set our own timeout period via the constructor. options.getDigitalSignatureDetails().setTimestampSettings(new PdfDigitalSignatureTimestampSettings("https://freetsa.org/tsr", "JohnDoe", "MyPassword", (long) 30.0)); Assert.assertEquals(options.getDigitalSignatureDetails().getTimestampSettings().getTimeout(), 30); Assert.assertEquals(options.getDigitalSignatureDetails().getTimestampSettings().getServerUrl(), "https://freetsa.org/tsr"); Assert.assertEquals(options.getDigitalSignatureDetails().getTimestampSettings().getUserName(), "JohnDoe"); Assert.assertEquals(options.getDigitalSignatureDetails().getTimestampSettings().getPassword(), "MyPassword"); // The "Save" method will apply our signature to the output document at this time. doc.save(getArtifactsDir() + "PdfSaveOptions.PdfDigitalSignatureTimestamp.pdf", options);
public java.lang.String getServerUrl() / public void setServerUrl(java.lang.String value)
Example:
Shows how to sign a saved PDF document digitally and timestamp it.Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); builder.writeln("Signed PDF contents."); // Create a "PdfSaveOptions" object that we can pass to the document's "Save" method // to modify how that method converts the document to .PDF. PdfSaveOptions options = new PdfSaveOptions(); // Create a digital signature, and assign it to our SaveOptions object to sign the document when we save it to PDF. CertificateHolder certificateHolder = CertificateHolder.create(getMyDir() + "morzal.pfx", "aw"); options.setDigitalSignatureDetails(new PdfDigitalSignatureDetails(certificateHolder, "Test Signing", "Aspose Office", new Date())); // Create a timestamp authority-verified timestamp. options.getDigitalSignatureDetails().setTimestampSettings(new PdfDigitalSignatureTimestampSettings("https://freetsa.org/tsr", "JohnDoe", "MyPassword")); // The default lifespan of the timestamp is 100 seconds. Assert.assertEquals(options.getDigitalSignatureDetails().getTimestampSettings().getTimeout(), 100000); // We can set our own timeout period via the constructor. options.getDigitalSignatureDetails().setTimestampSettings(new PdfDigitalSignatureTimestampSettings("https://freetsa.org/tsr", "JohnDoe", "MyPassword", (long) 30.0)); Assert.assertEquals(options.getDigitalSignatureDetails().getTimestampSettings().getTimeout(), 30); Assert.assertEquals(options.getDigitalSignatureDetails().getTimestampSettings().getServerUrl(), "https://freetsa.org/tsr"); Assert.assertEquals(options.getDigitalSignatureDetails().getTimestampSettings().getUserName(), "JohnDoe"); Assert.assertEquals(options.getDigitalSignatureDetails().getTimestampSettings().getPassword(), "MyPassword"); // The "Save" method will apply our signature to the output document at this time. doc.save(getArtifactsDir() + "PdfSaveOptions.PdfDigitalSignatureTimestamp.pdf", options);
public System.TimeSpan getTimeout()
Example:
Shows how to sign a saved PDF document digitally and timestamp it.Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); builder.writeln("Signed PDF contents."); // Create a "PdfSaveOptions" object that we can pass to the document's "Save" method // to modify how that method converts the document to .PDF. PdfSaveOptions options = new PdfSaveOptions(); // Create a digital signature, and assign it to our SaveOptions object to sign the document when we save it to PDF. CertificateHolder certificateHolder = CertificateHolder.create(getMyDir() + "morzal.pfx", "aw"); options.setDigitalSignatureDetails(new PdfDigitalSignatureDetails(certificateHolder, "Test Signing", "Aspose Office", new Date())); // Create a timestamp authority-verified timestamp. options.getDigitalSignatureDetails().setTimestampSettings(new PdfDigitalSignatureTimestampSettings("https://freetsa.org/tsr", "JohnDoe", "MyPassword")); // The default lifespan of the timestamp is 100 seconds. Assert.assertEquals(options.getDigitalSignatureDetails().getTimestampSettings().getTimeout(), 100000); // We can set our own timeout period via the constructor. options.getDigitalSignatureDetails().setTimestampSettings(new PdfDigitalSignatureTimestampSettings("https://freetsa.org/tsr", "JohnDoe", "MyPassword", (long) 30.0)); Assert.assertEquals(options.getDigitalSignatureDetails().getTimestampSettings().getTimeout(), 30); Assert.assertEquals(options.getDigitalSignatureDetails().getTimestampSettings().getServerUrl(), "https://freetsa.org/tsr"); Assert.assertEquals(options.getDigitalSignatureDetails().getTimestampSettings().getUserName(), "JohnDoe"); Assert.assertEquals(options.getDigitalSignatureDetails().getTimestampSettings().getPassword(), "MyPassword"); // The "Save" method will apply our signature to the output document at this time. doc.save(getArtifactsDir() + "PdfSaveOptions.PdfDigitalSignatureTimestamp.pdf", options);
public java.lang.String getUserName() / public void setUserName(java.lang.String value)
Example:
Shows how to sign a saved PDF document digitally and timestamp it.Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); builder.writeln("Signed PDF contents."); // Create a "PdfSaveOptions" object that we can pass to the document's "Save" method // to modify how that method converts the document to .PDF. PdfSaveOptions options = new PdfSaveOptions(); // Create a digital signature, and assign it to our SaveOptions object to sign the document when we save it to PDF. CertificateHolder certificateHolder = CertificateHolder.create(getMyDir() + "morzal.pfx", "aw"); options.setDigitalSignatureDetails(new PdfDigitalSignatureDetails(certificateHolder, "Test Signing", "Aspose Office", new Date())); // Create a timestamp authority-verified timestamp. options.getDigitalSignatureDetails().setTimestampSettings(new PdfDigitalSignatureTimestampSettings("https://freetsa.org/tsr", "JohnDoe", "MyPassword")); // The default lifespan of the timestamp is 100 seconds. Assert.assertEquals(options.getDigitalSignatureDetails().getTimestampSettings().getTimeout(), 100000); // We can set our own timeout period via the constructor. options.getDigitalSignatureDetails().setTimestampSettings(new PdfDigitalSignatureTimestampSettings("https://freetsa.org/tsr", "JohnDoe", "MyPassword", (long) 30.0)); Assert.assertEquals(options.getDigitalSignatureDetails().getTimestampSettings().getTimeout(), 30); Assert.assertEquals(options.getDigitalSignatureDetails().getTimestampSettings().getServerUrl(), "https://freetsa.org/tsr"); Assert.assertEquals(options.getDigitalSignatureDetails().getTimestampSettings().getUserName(), "JohnDoe"); Assert.assertEquals(options.getDigitalSignatureDetails().getTimestampSettings().getPassword(), "MyPassword"); // The "Save" method will apply our signature to the output document at this time. doc.save(getArtifactsDir() + "PdfSaveOptions.PdfDigitalSignatureTimestamp.pdf", options);