Sign documents with encrypted QR-code text
Leave feedback
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
This example shows how to sign document with secure QR-code signature text.
Signaturesignature=newSignature("sample.pdf");// setup key and passphrase
Stringkey="1234567890";Stringsalt="1234567890";// create data encryption
IDataEncryptionencryption=newSymmetricEncryption(SymmetricAlgorithmType.Rijndael,key,salt);// setup QR-Code options
QrCodeSignOptionsoptions=newQrCodeSignOptions();// 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);Paddingpadding=newPadding();padding.setRight(10);padding.setBottom(10);options.setMargin(padding);// sign document to file
SignResultsignResult=signature.sign("QRCodeEncryptedText.pdf",options);// analyzing result
System.out.print("List of newly created signatures:");intnumber=1;for(BaseSignaturetemp: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:
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.
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.