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:

This example shows how to sign document with secure QR-code signature text.

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();
// set custom object to serialize to QR Code
options.setText("This is private text to be secured.");
// QR-code type
options.setEncodeType(QrCodeTypes.QR);
// specify serialization encryption
options.setDataEncryption(encryption);
// locate and aligh signature
options.setHeight(100);
options.setWidth(100);
options.setVerticalAlignment(VerticalAlignment.Bottom);
options.setHorizontalAlignment(HorizontalAlignment.Right);
Padding padding = new Padding() ;
padding.setRight(10);
padding.setBottom(10);
options.setMargin(padding);
 
// sign document to file
SignResult signResult = signature.sign("QRCodeEncryptedText.pdf", options);
// analyzing result
System.out.print("List of newly created signatures:");
int number = 1;
for(BaseSignature temp : signResult.getSucceeded())
{
    System.out.print("Signature #"+ number++ +": Type: "+temp.getSignatureType()+" Id:"+temp.getSignatureId()+
            ",Location: "+temp.getLeft()+"x"+temp.getTop()+". Size: "+temp.getWidth()+"x"+temp.getHeight());
}

More resources

GitHub Examples 

You may easily run the code above and see the feature in action in our GitHub examples:

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.