public class PdfDigitalSignatureTimestampSettings
Example:
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.writeln("Signed PDF contents.");
// Create a digital signature for the document that we will save
CertificateHolder certificateHolder = CertificateHolder.create(getMyDir() + "morzal.pfx", "aw");
PdfSaveOptions options = new PdfSaveOptions();
options.setDigitalSignatureDetails(new PdfDigitalSignatureDetails(certificateHolder, "Test Signing", "Aspose Office", new Date()));
// We can set a verified timestamp for our signature as well, with a valid timestamp authority
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");
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 generated PDF and timestamp it using Aspose.Words.Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); builder.writeln("Signed PDF contents."); // Create a digital signature for the document that we will save CertificateHolder certificateHolder = CertificateHolder.create(getMyDir() + "morzal.pfx", "aw"); PdfSaveOptions options = new PdfSaveOptions(); options.setDigitalSignatureDetails(new PdfDigitalSignatureDetails(certificateHolder, "Test Signing", "Aspose Office", new Date())); // We can set a verified timestamp for our signature as well, with a valid timestamp authority 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"); 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 generated PDF and timestamp it using Aspose.Words.Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); builder.writeln("Signed PDF contents."); // Create a digital signature for the document that we will save CertificateHolder certificateHolder = CertificateHolder.create(getMyDir() + "morzal.pfx", "aw"); PdfSaveOptions options = new PdfSaveOptions(); options.setDigitalSignatureDetails(new PdfDigitalSignatureDetails(certificateHolder, "Test Signing", "Aspose Office", new Date())); // We can set a verified timestamp for our signature as well, with a valid timestamp authority 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"); 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 generated PDF and timestamp it using Aspose.Words.Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); builder.writeln("Signed PDF contents."); // Create a digital signature for the document that we will save CertificateHolder certificateHolder = CertificateHolder.create(getMyDir() + "morzal.pfx", "aw"); PdfSaveOptions options = new PdfSaveOptions(); options.setDigitalSignatureDetails(new PdfDigitalSignatureDetails(certificateHolder, "Test Signing", "Aspose Office", new Date())); // We can set a verified timestamp for our signature as well, with a valid timestamp authority 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"); 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 generated PDF and timestamp it using Aspose.Words.Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); builder.writeln("Signed PDF contents."); // Create a digital signature for the document that we will save CertificateHolder certificateHolder = CertificateHolder.create(getMyDir() + "morzal.pfx", "aw"); PdfSaveOptions options = new PdfSaveOptions(); options.setDigitalSignatureDetails(new PdfDigitalSignatureDetails(certificateHolder, "Test Signing", "Aspose Office", new Date())); // We can set a verified timestamp for our signature as well, with a valid timestamp authority 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"); doc.save(getArtifactsDir() + "PdfSaveOptions.PdfDigitalSignatureTimestamp.pdf", options);
public System.TimeSpan getTimeout()
Example:
Shows how to sign a generated PDF and timestamp it using Aspose.Words.Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); builder.writeln("Signed PDF contents."); // Create a digital signature for the document that we will save CertificateHolder certificateHolder = CertificateHolder.create(getMyDir() + "morzal.pfx", "aw"); PdfSaveOptions options = new PdfSaveOptions(); options.setDigitalSignatureDetails(new PdfDigitalSignatureDetails(certificateHolder, "Test Signing", "Aspose Office", new Date())); // We can set a verified timestamp for our signature as well, with a valid timestamp authority 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"); 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 generated PDF and timestamp it using Aspose.Words.Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); builder.writeln("Signed PDF contents."); // Create a digital signature for the document that we will save CertificateHolder certificateHolder = CertificateHolder.create(getMyDir() + "morzal.pfx", "aw"); PdfSaveOptions options = new PdfSaveOptions(); options.setDigitalSignatureDetails(new PdfDigitalSignatureDetails(certificateHolder, "Test Signing", "Aspose Office", new Date())); // We can set a verified timestamp for our signature as well, with a valid timestamp authority 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"); doc.save(getArtifactsDir() + "PdfSaveOptions.PdfDigitalSignatureTimestamp.pdf", options);