22.03.2015 Views

DLI Implementation and Reference Guide - Datalogics

DLI Implementation and Reference Guide - Datalogics

DLI Implementation and Reference Guide - Datalogics

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Digital Signatures 15.5<br />

dlpdfsignaturesetx509cert<br />

This call associates an x.509 v3 certificate with a DLPDFSIGNATURE object created as<br />

a dlpdfsigacrox509-certificate digital signature. Do not call this with a<br />

DLPDFSIGNATURE object created as a different certificate type.<br />

The certificate is passed as a binary buffer in the certificate parameter; <strong>DLI</strong> will read<br />

certLen bytes from this buffer <strong>and</strong> make a copy for the PDF file's digital signature.<br />

The last parameter is a required callback function, to be called during the<br />

dlpdfdocwritepdf function call. It will be passed a character string containing the<br />

SHA-1 hash for the PDF file being written, as a NULL-terminated string of<br />

hexadecimal digits using PKCS #1 padding, containing a BER OID (object identifier)<br />

for the SHA-1 algorithm. The buffer is 256 bytes long (not including the NULL<br />

terminator), <strong>and</strong> formatted as<br />

0001FFFF .. FF003021300906052B0E03021A05000414<br />

[ 40 hex digits for SHA-1 hash ]<br />

The callback function must encrypt this hash value with the private key corresponding<br />

to the public key in the signature's x.509 certificate, <strong>and</strong> fill the buffer passed in with<br />

256 hexadecimal digits representing the encrypted value for the supplied BER<br />

formatted hash. A 1024-bit key is used for encryption operations.<br />

NOTE: The signed hash will not have padding, <strong>and</strong> must be exactly 256<br />

hexadecimal digits. If necessary, use zeros to pad it to the required length.<br />

dlpdfsignaturesetpkcs7cert<br />

This function sets the certificate generation callback for DLPDFSIGNATUREs of type<br />

dlpdfsigacropkcs7 <strong>and</strong> dlpdfsigverisign. For these signature types, the<br />

application using <strong>DLI</strong> is required to generated a fully-formed PKCS #7 certificate<br />

with an MD5 checksum of the PDF document, encrypted with the private key

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!