Exception when trying to export to pdf with certificate

Stimulsoft Reports.NET discussion
Post Reply
stas.tolokolnikov
Posts: 3
Joined: Tue Mar 23, 2010 3:09 am
Location: Moscow

Exception when trying to export to pdf with certificate

Post by stas.tolokolnikov »

I'm trying to export my reports to pdf with digital signature (self-signed certificate)
and i'm getting following exeption

:dumb:


----------------------------
[Customer Explanation]



----------------------------
[General Info]

Application: UPE
Framework: v2.0.50727
Version: Version: 2009.3.600 from 1 December 2009
MachineName: USER-3
OSVersion: Microsoft Windows NT 6.0.6002 Service Pack 2
UserName: user

----------------------------
[Exception Info]
Message: DigitalSign error at step 3, code #80004005: Cannot find the certificate and private key for decryption
Source: Stimulsoft.Report

StackTrace:
в Stimulsoft.Report.Export.StiPdfExportService.ThrowDigitalSignError(Int32 step, String message, Boolean showCode)
в Stimulsoft.Report.Export.StiPdfExportService.CreateSignature(Byte[] buf, Boolean getCertificateFromCryptoUI, String certificateID, Boolean useLocalMachineCertificates)
в Stimulsoft.Report.Export.StiPdfExportService.ExportPdf(StiReport report, Stream stream, StiPdfExportSettings settings)
в Stimulsoft.Report.StiReport.ExportDocument(StiExportFormat exportFormat, StiExportService exportService, Stream stream, StiExportSettings settings)
в Stimulsoft.Report.Export.StiExportService.DoExport(StiExportInfo info)
в Stimulsoft.Report.Export.StiExportService.StartExport(StiReport report, Stream stream, StiExportSettings settings, Boolean sendEMail, Boolean openAfterExport, String fileName, StiGuiMode guiMode)
в Stimulsoft.Report.Export.StiPdfExportService.Export(StiReport report, String fileName, Boolean sendEMail, StiGuiMode guiMode)
в Stimulsoft.Report.Export.StiExportService.Export(StiReport report, String file, Boolean sendEMail)
в Stimulsoft.Report.Viewer.StiViewerControl.OnProcessExport(Object sender)
в Stimulsoft.Report.Viewer.StiViewerControl.InvokeProcessExport(StiExportService service)
в Stimulsoft.Report.Viewer.StiViewerControl.cmExport_Click(Object sender, EventArgs e)

----------------------------
[Assemblies]
BSC.BugReporting, Version = 1.2.0.3008
BSC.Common, Version = 1.2.0.3008
BSC.Common.Win, Version = 1.2.0.3008
BSC.Connector.Connect, Version = 1.2.0.3008
ChartFX.WinForms, Version = 7.0.2893.24916
ChartFX.WinForms.Annotation, Version = 7.0.2893.25191
ChartFX.WinForms.Base, Version = 7.0.2893.24781
ChartFX.WinForms.Statistical, Version = 7.0.2893.25240
DesktopEdition, Version = 3.0.0.0
DundasWinMap, Version = 1.1.1.100
ILOG.Views, Version = 3.0.3.0
ILOG.Views.Gantt, Version = 3.0.3.0
Infragistics2.Documents.v9.2, Version = 9.2.20092.1003
Infragistics2.Excel.v9.2, Version = 9.2.20092.1003
Infragistics2.Shared.v9.2, Version = 9.2.20092.1003
Infragistics2.Win.AppStylistSupport.v9.2, Version = 9.2.20092.1003
Infragistics2.Win.Misc.v9.2, Version = 9.2.20092.1003
Infragistics2.Win.UltraWinCalcManager.v9.2, Version = 9.2.20092.1003
Infragistics2.Win.UltraWinCalcManager.v9.2.FormulaBuilder, Version = 9.2.20092.1003
Infragistics2.Win.UltraWinChart.v9.2, Version = 9.2.20092.1003
Infragistics2.Win.UltraWinDataSource.v9.2, Version = 9.2.20092.1003
Infragistics2.Win.UltraWinDock.v9.2, Version = 9.2.20092.1003
Infragistics2.Win.UltraWinEditors.v9.2, Version = 9.2.20092.1003
Infragistics2.Win.UltraWinExplorerBar.v9.2, Version = 9.2.20092.1003
Infragistics2.Win.UltraWinGauge.v9.2, Version = 9.2.20092.1003
Infragistics2.Win.UltraWinGrid.DocumentExport.v9.2, Version = 9.2.20092.1003
Infragistics2.Win.UltraWinGrid.ExcelExport.v9.2, Version = 9.2.20092.1003
Infragistics2.Win.UltraWinGrid.v9.2, Version = 9.2.20092.1003
Infragistics2.Win.UltraWinListView.v9.2, Version = 9.2.20092.1003
Infragistics2.Win.UltraWinMaskedEdit.v9.2, Version = 9.2.20092.1003
Infragistics2.Win.UltraWinPrintPreviewDialog.v9.2, Version = 9.2.20092.1003
Infragistics2.Win.UltraWinSchedule.v9.2, Version = 9.2.20092.1003
Infragistics2.Win.UltraWinStatusBar.v9.2, Version = 9.2.20092.1003
Infragistics2.Win.UltraWinTabbedMdi.v9.2, Version = 9.2.20092.1003
Infragistics2.Win.UltraWinTabControl.v9.2, Version = 9.2.20092.1003
Infragistics2.Win.UltraWinToolbars.v9.2, Version = 9.2.20092.1003
Infragistics2.Win.UltraWinTree.v9.2, Version = 9.2.20092.1003
Infragistics2.Win.v9.2, Version = 9.2.20092.1003
Interop.Word, Version = 8.3.0.0
Lassalle.Flow, Version = 2.1.0.0
Lassalle.Flow.Layout.Hierarchic, Version = 1.1.0.2
Lassalle.Flow.Layout.Symmetric, Version = 2.1.0.2
Lassalle.Flow.Layout.Tree, Version = 2.1.0.2
MapSuiteCore, Version = 3.0.0.0
Microsoft.WindowsAPICodePack.Shell, Version = 1.0.0.0
mscorlib, Version = 2.0.0.0
Stimulsoft.Base, Version = 2009.3.600.0
Stimulsoft.Controls.Win, Version = 2009.3.600.0
Stimulsoft.Report, Version = 2009.3.600.0
Stimulsoft.Report.Design, Version = 2009.3.600.0
Stimulsoft.Report.Win, Version = 2009.3.600.0
System, Version = 2.0.0.0
System.Configuration, Version = 2.0.0.0
System.Core, Version = 3.5.0.0
System.Data, Version = 2.0.0.0
System.Drawing, Version = 2.0.0.0
System.Runtime.Serialization.Formatters.Soap, Version = 2.0.0.0
System.Windows.Forms, Version = 2.0.0.0
System.Xml, Version = 2.0.0.0
XDMessaging, Version = 2.0.3.0
Andrew
Posts: 4109
Joined: Fri Jun 09, 2006 3:58 am

Exception when trying to export to pdf with certificate

Post by Andrew »

Hello,

You get the error message: "Cannot find the certificate and private key for decryption".
This means:
- if you use CryptoUI: the selected key does not fit to the digital signature;
- if you do not use CryptoUI: you incorrectly put SubjectNameString or incorrectly specified SertificateStore
(please try to export from code by setting StiPdfExportSettings.UseLocalMachineCertificates = true)

Thank you.
stas.tolokolnikov
Posts: 3
Joined: Tue Mar 23, 2010 3:09 am
Location: Moscow

Exception when trying to export to pdf with certificate

Post by stas.tolokolnikov »

Thanks for Your response.

Andrew wrote: - if you use CryptoUI: the selected key does not fit to the digital signature;
What are requirements for digital signature?
I was trying to use certificate created in Adobe Reader.

Ivan
Posts: 960
Joined: Thu Aug 10, 2006 1:37 am

Exception when trying to export to pdf with certificate

Post by Ivan »

Hello,

[quote="stas".tolokolnikov]What are requirements for digital signature?
I was trying to use certificate created in Adobe Reader.[/quote]

The certificate created in Adobe Reader must work without problem.
Please, describe in details what you do to reproduce the error.

Please note that firewalls and security settings can block access to certificates. And this can be the reason of error.

Thank you.
stas.tolokolnikov
Posts: 3
Joined: Tue Mar 23, 2010 3:09 am
Location: Moscow

Exception when trying to export to pdf with certificate

Post by stas.tolokolnikov »

Ivan wrote: Please, describe in details what you do to reproduce the error.

Please note that firewalls and security settings can block access to certificates. And this can be the reason of error.
firewall is disabled
pc is not in domain

what security settings should I check?

to reproduce the error I do the folowwing:

- create any report
- open it in viewer
- save it as pdf
- set options Digital signature\Use DS & Use DS from CryptoUI to ON
- choose sertificate from list (only mine is avaliable)
- catch exception
Ivan
Posts: 960
Joined: Thu Aug 10, 2006 1:37 am

Exception when trying to export to pdf with certificate

Post by Ivan »

Hello,

Unfortunately, we couldn't reproduce this bug.
Please provide more details regarding your issue.
Which version of Windows Server 2008 do you use? 32 or 64 bit?
The issue appear only on this version of Windows or on all versions of Windows?
The issue appear only on one computer or on all computers?

Thank you.
Post Reply