EldoS | Feel safer!

Software components for data protection, secure storage and transfer

PAdES LTV creation and verification

Also by EldoS: CallbackProcess
A component to control process creation and termination in Windows and .NET applications.
Posted: 11/22/2012 05:47:36
by ingbabic  (Standard support level)
Joined: 09/27/2011
Posts: 114

I am using TElPDFAdvancedPublicKeySecurityHandler to sign PDF documents with PAdES. I set TSPClient and set PAdESSignatureType to pastEnhanced. Documents are signed OK and I can verify them using Adobe Reader, but how can I asure that this is PAdES LTV? Also how can I verify that signed PDF is PAdES LTV and not for example PAdES BES using SBB product, even if document is not signed with SBB?
Posted: 11/22/2012 06:18:52
by Ken Ivanov (EldoS Corp.)


The 'LTV' term does not have the exact meaning and is fairly subjective. Normally, a document is an LTV if it contains enough validation-related information to be verifiable in long term future. As validation information expires with time, there might be a need to update the signed document periodically with up-to-date validation information. For how long in the future should the document be verifiable and how often should the validation information be updated depends on security policy being used, which introduces a subjective factor.

As a minimum, the document must be verifiable without referring a verifier to external sources of validation information (neither online sources nor local system storage). That is, it must contain all the certificates, CRLs and OCSP responses needed to establish the validity of the signature. The signature must also contain a timestamp produced by a trusted TSA.

Every piece of validation information added to the signed document in future must be certified by a document timestamp produced by a trusted TSA. The document timestamp must also include all the needed validation information to allow its 'offline' validation.

You can check if the document contains all the needed validation information by trying to validate the signatures without referring to external sources. This can be done by setting the DeepValidation and ForceCompleteChainValidation properties of the PAdES handler to true, setting the OfflineMode of the used TElX509CertificateValidator objects to true, and setting its UseSystemStores property to false. Please remember however to provide the trusted CA certificates to the validator separately via AddTrustedCertificates() method not to come across a trust problem during the validation.

You will probably also need to check whether the validation information is updated regularly and up-to-date. However, this task can be hardly automated, so you will need to implement this by yourselves.
Posted: 11/22/2012 08:23:11
by ingbabic  (Standard support level)
Joined: 09/27/2011
Posts: 114

Thank you Innokentiy
Could you please tell me from where to get CA Certificates in order to add them via AddTrustedCertificates()? I read them from my system store but I wonder if it is good sollution. Also, I would like to ask, if I do everything what you said and I get handler.ValidationDetails = casvValid, after I invoked Validate method on my signature, does this mean that it is a LTV form of PAdES? Excuse me for being persistive on this question, but this one I have to answer to my client.
Posted: 11/22/2012 08:30:00
by Vsevolod Ievgiienko (EldoS Corp.)


You can take root certificates from the system store. If you got casvValid after you've done all that Innokentiy wrote above then you can say that your PDF is singed using PAdES-LTV signature but don't forget that "The 'LTV' term does not have the exact meaning and is fairly subjective", so its PAdES-LTV only if it complies with your local security policy.
Posted: 12/27/2012 03:17:46
by Ari Urkullu (Basic support level)
Joined: 11/26/2012
Posts: 26

Good Morning,

I have some doubts about PAdES-LTV. I used your sample PAdES. I modified it this way:

In Form1:

In Sub handler_OnCertValidatorPrepared:

I added this two lines just before the End Sub:

CertValidator.OfflineMode = True
CertValidator.UseSystemStorages = False

In Sub RefreshSignatureInfo:

I added this two lines:

handler.ForceCompleteChainValidation = True
handler.DeepValidation = True

just before this part of the code:

If (handler.ValidationDetails =

SBPKICommon.TSBCMSAdvancedSignatureValidity.casvUnknown) OrElse revalidate

Catch ex As Exception
s = ex.Message
End Try
End If

Afterwards, I added a signature to a pdf, filling the AddSigForm this way:

Use certificate from system certificate storage: I used the sample certificate of your demo wich was installed in ".\EldoS\SecureBlackbox.NET\Extra\Certificates"
Visible signature checked
Create enhaced (PAdES) signature checked
Request a timestamp from TSA server checked: http://ocsp.izenpe.com:8093
Include local revocation information to the signature checked

Later, I revalidated that signature with the PAdES sample, with the signature root certificate (the sample one, wich I added as trusted) and the tsa root certificate checked as trusted certificates and I got a "Valid".

Then, I updated the signature filling the UpSigForm this way:
Timestamping server: http://ocsp.izenpe.com:8093
Include local revocation information checked

After updating the signature, I revalidated the first signature (enhaced long-term) and the second signature (Document timestamp), having for the first the two root certificates mentioned above as trusted certificates and having for the second one only the tsa root certificate as trusted certificate. In both validations I got a "Valid".

My principal doubt is, is this enough for PAdES-LTV?

As I understand PAdES-LTV works like this:

In the first signature enough validation information is added (CA certificates, CRLs and OCSP responses) to an empty DSS (Document Security Store). Also, a Timestamp is added to an empty Document Time-Stamp, wich stamps the pdf including the DSS. Afterwards, the signature can be updated, before the first Timestamp expires. In this case, the DSS dictionary contains the validation data of the first time-stamp, and the Document Time-stamp dictionary contains a second time-stamp that, again, covers the entire document. Thus, by repeating the addition of a DSS dictionary that contains the validation data of the last time-stamp and the addition of the Document Time-stamp dictionary, the validity of digital signatures in PDF documents can be maintained for any length of time.

I wonder if, with your sample modified the way I did and getting the results I got, it is enough to accomplish what I mentioned in the last paragraph?

Sorry for writting this question that long, but I must ensure that we are doing PAdES-LTV before attempting the next step.

For your time and your effort, Thank you a lot!
Posted: 12/27/2012 04:12:54
by Ken Ivanov (EldoS Corp.)

Hello Ari,

Your understanding of the LTV approach is absolutely correct. A minor addition is that there is no requirement for the first signer to put the validation information to the DSS - instead, they can (and usually do) insert it right to the signature blob.

Now, to your code-specific questions.

It only makes sense to set OfflineMode to true and refuse from using system stores when *validating* LTV signatures. If a security handler is configured in this way, it only uses validation information stored in the document (and not online or on local PC). Validation in offline mode ensures that the validation process is not affected by local environment; it can also be used as a test that the document includes all the needed validation information (if it doesn't, the validation will end up with 'incomplete' status).

Your amendments of the ForceCompleteChainValidation and DeepValidation properties are correct.

Although the steps you performed are also generally correct, we recommend that you perform similar checks for the environment you need to deploy PAdES functionality in. A PKI environment represented by the sample certificate shipped with SecureBlackbox is fairly basic (as it consists of a single self-signed certificate with no references to CRL/OCSP sources). Different environments may imply special processing of the validation sources (for example, they might require private access to revocation responders or provide certificates in a non-standard way). Therefore it is important that you check the code in your particular environment and ensure that the created documents are LTV (by processing them in the 'offline validation' mode) and are actually validated correctly in this mode.
Also by EldoS: RawDisk
Access locked and protected files in Windows, read and write disks and partitions and more.



Topic viewed 2969 times

Number of guests: 1, registered members: 0, in total hidden: 0


Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!