Hi there,
I’m getting this error while trying to use the certificate constructed manually (C#) … I’m trying to avoid the popup that comes up in a solution 1 that is working,
The code that is working is here:
Stream excel_content;
MemoryStream cert_content;
        MemoryStream outStream = new MemoryStream();
using (Signature signature = new Signature(excel_content))
{
DigitalSignOptions options = new DigitalSignOptions(cert_content)
{
// certificate password
Password = “*****”,
// digital certificate details
Reason = “Approved”,
Contact = “John Smith”,
Location = “New York”,
                Appearance = new DigitalSignatureAppearance("rajoi", "Manager", "abcd@fdgs.com"),
                //                    
                AllPages = false,
                Width = 460,
                Height = 100,
                VerticalAlignment = VerticalAlignment.Center,
                HorizontalAlignment = HorizontalAlignment.Left,
                Margin = new Padding() { Bottom = 10, Right = 10 },
            };                // sign document to file
            SignResult signResult = signature.Sign(outStream, options);
            StreamWriter writer = new StreamWriter(outStream);
            //You have to rewind the MemoryStream before copying
            outStream.Seek(0, SeekOrigin.Begin);
            using (FileStream fs = new FileStream("signed.xlsx", FileMode.OpenOrCreate))
            {
                outStream.CopyTo(fs);
                fs.Flush();
            }
        }
The code that comes back with this error is below …
Error: GroupDocsSignatureException: Digital certificate for Spreadsheets has wrong format. Description: Certificate object can not be created from this Guid and password path is not set.
Stream excel_content;
MemoryStream cert_content;
MemoryStream outStream = new MemoryStream();
using (Signature signature = new Signature(excel_content))
{
DigitalSignOptions options = new DigitalSignOptions()
{
Signature = new DigitalSignature()
{
Certificate = new X509Certificate2(cert_content.ToArray(),
“*",
X509KeyStorageFlags.EphemeralKeySet),
},
// certificate password
// Password = "”,
// digital certificate details
Reason = “Approved”,
Contact = “John Smith”,
Location = “New York”,
                Appearance = new DigitalSignatureAppearance("Rajoi", "Manager", "abcd@fdgs.com"),
                //                    
                AllPages = false,
                Width = 460,
                Height = 100,
                VerticalAlignment = VerticalAlignment.Center,
                HorizontalAlignment = HorizontalAlignment.Left,
                Margin = new Padding() { Bottom = 10, Right = 10 },
            };                // sign document to file
            SignResult signResult = signature.Sign(outStream, options);
            StreamWriter writer = new StreamWriter(outStream);
            //You have to rewind the MemoryStream before copying
            outStream.Seek(0, SeekOrigin.Begin);
            using (FileStream fs = new FileStream("signed.xlsx", FileMode.OpenOrCreate))
            {
                outStream.CopyTo(fs);
                fs.Flush();
            }
        }
Thanks!