We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Error when create PdfCertificcate

PdfSignature is giving the error _CastError (Null check operator used on a null value)

11 Replies

RO robert.jones April 25, 2023 08:55 PM UTC

Here is an image of the error. 

Attachment: 20230425_154430.png_ddf033ff.zip

IJ Irfana Jaffer Sadhik Syncfusion Team April 26, 2023 09:56 AM UTC

We have checked the reported behavior with the provided details on our end. We were unable to reproduce the reported behavior on our end. we request you to share the complete code snippet, and call stack details to replicate the issue on our end. So that we can assist with you further in this

RO robert.jones April 26, 2023 01:51 PM UTC

I am pulling a file from the database and then applying it to the Signature.

Future readCertFile() async {
var parameters = {
'qp_stn_name': 'paperwork_digital_signature_certificate',
String path = '/apps/any/queries/read__tbl__settings';
var response = await ref
.sendRequest('post', path, parameters);
if (!response.keys.contains('error')) {
await getCertFile(response['objects'][0]['stn_linked_id']);
} else {
await showAlertDialog(
title: 'Error', text: response['message'].toString());

PdfSignature signature = PdfSignature(
signedDate: DateTime.now(),
signedName: 'Signature');
signature.certificate = PdfCertificate(

IJ Irfana Jaffer Sadhik Syncfusion Team April 27, 2023 09:49 AM UTC

We were unable to reproduce the reported issue from our side referring to the provided code snippet. We suspect that the issue may be due to certificate data. Kindly share the certificate file or a working sample and issue call stack for analyzing further in this.

RO robert.jones April 27, 2023 01:21 PM UTC

Here is a copy of the cert. 

Attachment: certificate.pfx_b2a36aea.zip

RO robert.jones May 1, 2023 12:00 PM UTC

I have not heard back about if our certificate is not correct.

IJ Irfana Jaffer Sadhik Syncfusion Team May 2, 2023 07:36 AM UTC

The provided password for the certificate is not working. we have tried the password previously given in the previous code snippet, it is not working. Can you please share a valid password and error call stack to reproduce the issue on our end?

RO robert.jones May 2, 2023 01:34 PM UTC

Here is a new certificate to test.  Password is 'password'

Attachment: certificate_6ed5f3dd.zip

IJ Irfana Jaffer Sadhik Syncfusion Team May 3, 2023 07:16 AM UTC

We are unable to load the provided certificate end, facing an incorrect password exception. can you please check this and share details to replicate the issue? so that we can assist with you further in this


RO robert.jones May 3, 2023 01:40 PM UTC

Here are the passwords. 

Attachment: password_6e25a45d.zip

IJ Irfana Jaffer Sadhik Syncfusion Team May 4, 2023 11:05 AM UTC

We found no issues in the provided certificate data. We were able to sign the PDF document using the certificate file without any issues.


Kindly use the following link to download the sample and signed document for reference.

Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/pdf_demo_sample_(1)2077448482


If the issue is still reproduced, Kindly provide us with a working sample to reproduce the issue and analyze it further in this.

Live Chat Icon For mobile
Up arrow icon