Hi Aspose,
I am working with a client who requires that I send him an excel file that is digitally signed. I have successfully prototyped a solution using Aspose.Cells and been able to send him a .xlsx file. Unfortunately his users do not have Excel 2007 available on their desktops and when I attempt to save a signed Aspose.Cells.Workbook to FileFormatType.Excel97To2003 the signature gets removed.
Is there any way using your component, to save a signed workbook in a format earlier than Excel 2007 .xslx?
Best Regards,
Hi,
Hello and thanks for the reply. Here is an example (using your own code) where the digital signing fails. I have tried this with both the 6.1 and the v7.0.01 that you linked to:
using System;
using System.IO;
using Aspose.Cells;
using System.Collections;
using System.Text;
using System.Threading;
using Aspose.Cells.Rendering;
using System.Security.Cryptography;
using System.Diagnostics;
using Aspose.Cells.DigitalSignatures;
using System.Security.Cryptography.X509Certificates;
namespace Aspose.Cells.test
{
class MyTest
{
public MyTest()
{
}
[STAThread]
static void Main(string[] args)
{
MyTest test = new MyTest();
test.testSign();
test.testvalidateSign();
Console.ReadLine();
}
internal void testvalidateSign()
{
Workbook wb = new Workbook(@“c:\newfile.xls”);
System.Console.WriteLine(wb.IsDigitallySigned); //True -OK
DigitalSignatureCollection dsc = wb.GetDigitalSignature();
foreach (DigitalSignature ds in dsc)
{
System.Console.WriteLine(ds.Comments); //test for sign -OK
System.Console.WriteLine(ds.SignTime); //11/25/2010 1:22:01 PM -OK
System.Console.WriteLine(ds.IsValid); //True -OK
}
}
internal void testSign()
{
DigitalSignatureCollection dsc = new DigitalSignatureCollection();
DigitalSignature ds = new DigitalSignature(
FindCertificateFromSerial(“5d 88 3d d1 ab 8d 63 c2 eb 64 c2 fc 8a e7 fb bd”),
“test for sign”, DateTime.Now);
dsc.Add(ds);
Workbook wb = new Workbook();
wb.SetDigitalSignature(dsc);
wb.Save(@“c:\newfile.xls”, SaveFormat.Excel97To2003);
}
public static X509Certificate2 FindCertificateFromSerial(string serialNum)
{
X509Store localStore = new X509Store(StoreName.My, StoreLocation.CurrentUser);
localStore.Open(OpenFlags.ReadOnly | OpenFlags.OpenExistingOnly);
try
{
X509Certificate2Collection matches =
localStore.Certificates.Find(X509FindType.FindBySerialNumber, serialNum, false);
if (matches.Count > 0)
return matches[0];
else
return null;
}
finally
{ localStore.Close(); }
}
}
}
This code works perfectly for the Xslx format, but fails for Xls.
Hi,
Hi,
As mentioned in release notes, we only support adding digital signature on Ms-Excel 2007 or later formats. We will support it for Ms-Excel 2003 formats in later release versions.
Hi,
Is checking digital signature (Workbook.IsDigitallySigned) on Ms-Excel 2003 supported in the latest version (XLS files)?
Regards
Yes, Aspose.Cells does support digital signatures for XLS file format. Please try using our latest version/fix (Aspose.Cells v21.5.x). If you find any issue, kindly zip and share your sample digitally signed MS Excel 2003 XLS file, we will look into it soon.