In today’s digital age, document security has become a top priority for individuals and organizations alike. With the increasing reliance on electronic documents, it’s important to ensure that the files we share are authentic and haven’t been tampered with. Excel is one such tool that is widely used to store and share important data, making it crucial to have a reliable way of verifying the integrity of the file. This is where digital signatures come in – they provide a secure way to sign and validate electronic documents, ensuring that the file hasn’t been altered since it was signed. In this article, we’ll explore how to digitally sign Excel files using C# .NET.
- API to Digitally Sign Excel
- Add Electronic Signature using C#
- Add Excel Digital Signature using cURL Commands
API to Digitally Sign Excel
Aspose.Cells Cloud SDK for .NET is a powerful API that provides a range of features for working with Excel files in the cloud. One of its key capabilities is the ability to digitally sign Excel files, providing a secure way to authenticate and verify electronic documents. With Aspose.Cells Cloud SDK, users can easily sign their Excel files using a range of signature types including digital certificates). Let’s explore the capabilities of API and ensure the integrity and authenticity of electronic documents.
To get started, search Aspose.Cells-Cloud in NuGet packages manager and click the “Add Package” button. Also, if you do not have an account over Dashboard, please create a free account by using a valid email address.
Add Electronic Signature using C#
Please use the following code snippet to sign the Excel files digitally.
Given below are the details about the code snippet:
CellsApi cellsInstance = new CellsApi(clientID, clientSecret);
Create an object of CellsApi while passing client credentials as arguments.
cellsInstance.UploadFile(input_Excel, File.OpenRead(input_Excel));
cellsInstance.UploadFile(signature_File, File.OpenRead(signature_File));
Read the content of input Excel & digital signature from local drive and upload them to cloud storage.
var response = cellsInstance.CellsWorkbookPostDigitalSignature(input_Excel, signature_File, "test1234");
Call the API to digitally sign the Excel and save the output to cloud storage. Please note that last argument is password of certificate file.
The Excel used in the above example can be downloaded from myDocument.xlsx.
Add Excel Digital Signature using cURL Commands
There are several benefits of using cURL command and Aspose.Cells Cloud API for digital signature in Excel. This approach is efficient and easy to use, allowing you to sign your Excel files with few API requests. This saves your time and effort, when compared to manually signing of each document. Secondly, since this approach is cloud-based, so you can access it from anywhere and integrate it into your existing workflows with ease. Overall, using cURL command and Aspose.Cells Cloud API for digital signature in Excel is a powerful and flexible solution. It streamlines your signing process and enhances the security and reliability of your Excel files.
Now, you will need to have cURL installed on your system and then generate an accessToken based on client credentials:
curl -v "https://api.aspose.cloud/connect/token" \
-X POST \
-d "grant_type=client_credentials&client_id=bb959721-5780-4be6-be35-ff5c3a6aa4a2&client_secret=4d84d5f6584160cbd91dba1fe145db14" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Accept: application/json"
Use the following command to upload input Excel & Digital signature to cloud storage (you need to call this command twice to upload individual file):
curl -v "https://api.aspose.cloud/v3.0/cells/storage/file/{filePath}" \
-X PUT \
-F file=@{localFilePath} \
-H "Content-Type: multipart/form-data" \
-H "Authorization: Bearer {accessToken}"
Replace
{filePath}
with the path where you want to store the file in the cloud storage,{localFilePath}
with the path of an Excel on your local system, and{accessToken}
with your Aspose Cloud access token (generated above).
Finally, execute the following command to add digital signature to Excel file:
curl -v "https://api.aspose.cloud/v3.0/cells/{excelName}/digitalsignature?digitalsignaturefile={DigitalSignature}&password=test1234" \
-X POST \
-H "accept: application/json" \
-H "authorization: Bearer {accessToken}"
Replace
{excelName}
with the name of the Excel file in cloud storage,{DigitalSignature}
with name of digital certificate from cloud storage and,{accessToken}
with the access token generated above. After successful execution, the updated Excel will be stored in same cloud storage.
Concluding Remarks
In conclusion, digital signature in Excel is a critical aspect of ensuring the authenticity and integrity of your spreadsheets. So the cURL command and Aspose.Cells Cloud API provides a secure and reliable way to sign your Excel files programmatically, saving you time and effort while enhancing the security and reliability of your data. With Aspose.Cells Cloud, you can customize the signing process according to your specific requirements, whether it’s specifying the location, setting password protection, or other options. Overall, this approach to add a digital signature in Excel is an efficient, flexible, and secure solution that streamlines your workflow and gives you peace of mind knowing that your Excel files are trustworthy and accurate.
Useful Links
Recommended Articles
Please visit the following links to learn more about: