Aspose::Words::DigitalSignatures::SignOptions class
Contents
[
Hide
]SignOptions class
Allows to specify options for document signing. To learn more, visit the Work with Digital Signatures documentation article.
class SignOptions : public System::Object
Methods
Method | Description |
---|---|
get_Comments() const | Specifies comments on the digital signature. Default value is empty string. |
get_DecryptionPassword() const | The password to decrypt source document. Default value is empty string. |
get_ProviderId() const | Specifies the class ID of the signature provider. Default value is Empty (all zeroes) Guid. |
get_SignatureLineId() const | Signature line identifier. Default value is Empty (all zeroes) Guid. |
get_SignatureLineImage() const | The image that will be shown in associated SignatureLine. Default value is null. |
get_SignTime() const | The date of signing. Default value is current time (Now) |
get_XmlDsigLevel() const | Specifies the level of a digital signature based on XML-DSig standard. The default value is XmlDSig. |
GetType() const override | |
Is(const System::TypeInfo&) const override | |
set_Comments(const System::String&) | Setter for Aspose::Words::DigitalSignatures::SignOptions::get_Comments. |
set_DecryptionPassword(const System::String&) | Setter for Aspose::Words::DigitalSignatures::SignOptions::get_DecryptionPassword. |
set_ProviderId(System::Guid) | Setter for Aspose::Words::DigitalSignatures::SignOptions::get_ProviderId. |
set_SignatureLineId(System::Guid) | Signature line identifier. Default value is Empty (all zeroes) Guid. |
set_SignatureLineImage(const System::ArrayPtr<uint8_t>&) | The image that will be shown in associated SignatureLine. Default value is null. |
set_SignTime(System::DateTime) | Setter for Aspose::Words::DigitalSignatures::SignOptions::get_SignTime. |
set_XmlDsigLevel(Aspose::Words::DigitalSignatures::XmlDsigLevel) | Setter for Aspose::Words::DigitalSignatures::SignOptions::get_XmlDsigLevel. |
SignOptions() | |
static Type() |
Examples
Shows how to digitally sign documents.
// Create an X.509 certificate from a PKCS#12 store, which should contain a private key.
System::SharedPtr<Aspose::Words::DigitalSignatures::CertificateHolder> certificateHolder = Aspose::Words::DigitalSignatures::CertificateHolder::Create(get_MyDir() + u"morzal.pfx", u"aw");
// Create a comment and date which will be applied with our new digital signature.
auto signOptions = System::MakeObject<Aspose::Words::DigitalSignatures::SignOptions>();
signOptions->set_Comments(u"My comment");
signOptions->set_SignTime(System::DateTime::get_Now());
// Take an unsigned document from the local file system via a file stream,
// then create a signed copy of it determined by the filename of the output file stream.
{
System::SharedPtr<System::IO::Stream> streamIn = System::MakeObject<System::IO::FileStream>(get_MyDir() + u"Document.docx", System::IO::FileMode::Open);
{
System::SharedPtr<System::IO::Stream> streamOut = System::MakeObject<System::IO::FileStream>(get_ArtifactsDir() + u"DigitalSignatureUtil.SignDocument.docx", System::IO::FileMode::OpenOrCreate);
Aspose::Words::DigitalSignatures::DigitalSignatureUtil::Sign(streamIn, streamOut, certificateHolder, signOptions);
}
}
See Also
- Namespace Aspose::Words::DigitalSignatures
- Library Aspose.Words for C++