Sign documents with encrypted QR-code text
GroupDocs.Signature provides ability to secure QR-code signature text with standard or custom encryption. Standard encryption is implemented over class SymmetricEncryption class. Creation of this object expects 3 arguments like encryption algorithm enumeration SymmetricAlgorithmType with one of following values (DES, TripleDES, RC2, Rijndael), string value key and string value salt.
Here are the steps to secure QR-code text with standard encryption with GroupDocs.Signature:
- Create new instance of Signature class and pass source document path or stream as a constructor parameter.
- Compose object of SymmetricEncryption class with required algorithm and secure pair key/salt
- Create objects of QrCodeSignOptions class and setup property DataEncryption with object of SymmetricEncryption
- Call Sign method of Signature class instance and pass QrCodeSignOptions to it.
This example shows how to sign document with secure QR-code signature text.
using (Signature signature = new Signature("sample.pdf"))
{
// setup key and passphrase
string key = "1234567890";
string salt = "1234567890";
// create data encryption
IDataEncryption encryption = new SymmetricEncryption(SymmetricAlgorithmType.Rijndael, key, salt);
// setup QR-Code options
QrCodeSignOptions options = new QrCodeSignOptions()
{
//setup text to be secured
Text = "This is private text to be secured.",
EncodeType = QrCodeTypes.QR,
// specify text encryption
DataEncryption = encryption,
// locate and aligh signature
Height = 100,
Width = 100,
VerticalAlignment = VerticalAlignment.Bottom,
HorizontalAlignment = HorizontalAlignment.Right,
Margin = new Padding() { Right = 10, Bottom = 10}
};
// sign document to file
signature.Sign("QRCodeEncryptedText.pdf", options);
}
More resources
GitHub Examples
You may easily run the code above and see the feature in action in our GitHub examples:
- GroupDocs.Signature for .NET examples, plugins, and showcase
- GroupDocs.Signature for Java examples, plugins, and showcase
- Document Signature for .NET MVC UI Example
- Document Signature for .NET App WebForms UI Example
- Document Signature for Java App Dropwizard UI Example
- Document Signature for Java Spring UI Example
Free Online App
Along with full-featured .NET library we provide simple, but powerful free Apps.
You are welcome to eSign PDF, Word, Excel, PowerPoint documents with free to use online GroupDocs Signature App.