Utilities

enum IOStrategyType

Specifies the I/O strategy used for file access.

Controls how the library accesses file data:

  • IOStrategy_Undefined: Uses the default implementation (currently fstream)

  • IOStrategy_Memory: Loads entire file into memory (not yet supported)

  • IOStrategy_MemoryMapped: Uses memory-mapped file access (not yet supported)

  • IOStrategy_FileStream: Uses FILE*-based streaming I/O

Values:

enumerator IOStrategy_Undefined

Uses the default implementation (currently fstream).

enumerator IOStrategy_Memory

Loads entire file into memory.

Not yet supported, returns NotSupported error.

enumerator IOStrategy_MemoryMapped

Uses memory-mapped file access.

Not yet supported, returns NotSupported error.

enumerator IOStrategy_FileStream

Uses FILE*-based streaming I/O.

enum MessageDigestAlgorithmType

Supported digest algorithms used as hash functions.

Values:

enumerator MessageDigestAlgorithmType_Undefined

Undefined unitialized default value, triggers error when used.

enumerator MessageDigestAlgorithmType_MDNULL

“null” message digest that does nothing: i.e. the hash it returns is of zero length.

enumerator MessageDigestAlgorithmType_MD2

The MD2 Message - Digest Algorithm is a cryptographic hash function developed by Ronald Rivest in 1989.

enumerator MessageDigestAlgorithmType_MD4

The MD4 Message - Digest Algorithm is a cryptographic hash function developed by Ronald Rivest in 1990.

enumerator MessageDigestAlgorithmType_MD5

MD5 is one in a series of message digest algorithms designed by Professor Ronald Rivest of MIT (Rivest, 1992).

enumerator MessageDigestAlgorithmType_SHA1

A 160-bit hash function which resembles the earlier MD5 algorithm.

enumerator MessageDigestAlgorithmType_SHA224

SHA-2 (Secure Hash Algorithm 2) is a set of cryptographic hash functions designed by the United States National Security Agency (NSA).

enumerator MessageDigestAlgorithmType_SHA256

SHA-2 (Secure Hash Algorithm 2) is a set of cryptographic hash functions designed by the United States National Security Agency (NSA).

enumerator MessageDigestAlgorithmType_SHA384

SHA-2 (Secure Hash Algorithm 2) is a set of cryptographic hash functions designed by the United States National Security Agency (NSA).

enumerator MessageDigestAlgorithmType_SHA512

SHA-2 (Secure Hash Algorithm 2) is a set of cryptographic hash functions designed by the United States National Security Agency (NSA).

enumerator MessageDigestAlgorithmType_MDC2

MDC - 2 (Modification Detection Code 2, sometimes called Meyer - Schilling) is a cryptographic hash function.

enumerator MessageDigestAlgorithmType_RIPEMD160

RIPEMD (RACE Integrity Primitives Evaluation Message Digest) is an improved, 160-bit version of the original RIPEMD, and the most common version in the family.

enumerator MessageDigestAlgorithmType_WHIRLPOOL

WHIRLPOOL is a cryptographic hash function designed by Vincent Rijmen.

enum PDFVersion

Range of available PDF versions.

Values:

enumerator PDFVersion_Undefined
enumerator PDFVersion_10

PDF version 1.0.

enumerator PDFVersion_11

PDF version 1.1.

enumerator PDFVersion_12

PDF version 1.2.

enumerator PDFVersion_13

PDF version 1.3.

enumerator PDFVersion_14

PDF version 1.4.

enumerator PDFVersion_15

PDF version 1.5.

enumerator PDFVersion_16

PDF version 1.6.

enumerator PDFVersion_17

PDF version 1.7.

enumerator PDFVersion_20

PDF version 2.0.

enum SignatureVerificationStatusType

Overall status of signature verification.

Values:

enumerator SignatureStatus_Undefined

Status not set (uninitialized)

enumerator SignatureStatus_Valid

Signature is cryptographically valid

enumerator SignatureStatus_Invalid

Signature verification failed

enumerator SignatureStatus_CertificateExpired

Certificate has expired

enumerator SignatureStatus_CertificateNotYetValid

Certificate not yet valid

enumerator SignatureStatus_CertificateRevoked

Certificate has been revoked

enumerator SignatureStatus_CertificateUntrusted

Certificate chain not trusted

enumerator SignatureStatus_DocumentModified

Document modified after signing

enumerator SignatureStatus_WeakAlgorithm

Weak digest algorithm (MD5, SHA1)

enumerator SignatureStatus_MissingCertificate

Signature missing certificate

enumerator SignatureStatus_Unknown

Unable to determine status

error_type TextStringEncoding_Detect(string_type data, size_type size, TextStringEncodingType *result)

Detect the encoding of a PDF text string from its raw bytes.

Parameters:
  • data[in] Pointer to the raw PDF text string bytes.

  • size[in] Number of bytes in data.

  • result[out] The detected encoding type.

error_type TextStringEncoding_PDFDocEncodingByteToUnicode(uint8_t byte, uint32_t *codepoint)

Map a single PDFDocEncoding byte to its Unicode code point.

Parameters:
  • byte[in] The PDFDocEncoding byte value (0x00–0xFF).

  • codepoint[out] The corresponding Unicode code point. Undefined bytes (e.g. 0x00–0x07) map to U+FFFD (replacement character).

class BufferHandle : public IUnknownHandle
#include <c_buffer.h>

Represents memory stored data.

Unnamed Group

error_type Buffer_Create(BufferHandle **result)

Creates a new buffer instance.

error_type Buffer_CreateFromData(string_type data, size_type size, BufferHandle **result)

Creates a new buffer instance with specified data.

error_type Buffer_GetData(const BufferHandle *handle, string_type *data, size_type *size)

Get data content from buffer.

error_type Buffer_SetData(BufferHandle *handle, string_type data, size_type size)

Set new data content.

error_type Buffer_CopyTo(BufferHandle *handle, byte_array_type data, size_type size)

Copy buffer data to the memory provided by the caller.

error_type Buffer_ToInputStream(const BufferHandle *handle, InputStreamHandle **result)

Converts current buffer state to input stream.

error_type Buffer_Equals(const BufferHandle *handle, const BufferHandle *other, boolean_type *result)

Compares two buffers by their value.

error_type Buffer_Hash(const BufferHandle *handle, size_type *result)

Get object hash code.

error_type Buffer_ToUnknown(BufferHandle *handle, IUnknownHandle **result)

Reinterpret current object as IUnknownHandle.

error_type Buffer_FromUnknown(IUnknownHandle *handle, BufferHandle **result)

Convert IUnknownHandle to BufferHandle.

error_type Buffer_Release(BufferHandle *handle)

Decrement the internal reference counter.

When the internal counter reaches zero the object is deleted. Releasing already disposed object causes undefined behavior.

See also

IUnknown_Release

class BufferArrayHandle : public IUnknownHandle
#include <c_buffer_array.h>

Represents a list of BufferHandle.

Unnamed Group

error_type BufferArray_Create(BufferArrayHandle **result)

Creates a new buffer array instance.

error_type BufferArray_GetSize(BufferArrayHandle *handle, size_type *result)

Return size of an array.

error_type BufferArray_At(BufferArrayHandle *handle, size_type at, BufferHandle **result)

Get element at location at.

error_type BufferArray_Append(BufferArrayHandle *handle, BufferHandle *value)

Insert new element at the end of the array.

error_type BufferArray_Insert(BufferArrayHandle *handle, size_type at, BufferHandle *value)

Insert new element at location at.

error_type BufferArray_Remove(BufferArrayHandle *handle, size_type at)

Remove element from location at.

error_type BufferArray_ToUnknown(BufferArrayHandle *handle, IUnknownHandle **result)

Reinterpret current object as IUnknownHandle.

error_type BufferArray_FromUnknown(IUnknownHandle *handle, BufferArrayHandle **result)

Convert IUnknownHandle to BufferArrayHandle.

error_type BufferArray_Release(BufferArrayHandle *handle)

Decrement the internal reference counter.

When the internal counter reaches zero the object is deleted. Releasing already disposed object causes undefined behavior.

class EncryptionKeyHandle : public IUnknownHandle
#include <c_encryption.h>

Represents encryption key other than password.

Subclassed by PKCS12KeyHandle

Unnamed Group

typedef void (*EncryptionKeyInitializeFunction)(void)

Function pointer used to initialize dependencies in order to provide decryption.

This function currently cannot fail. In order to indicate failure on initialization return error code in the decrypt function itself.

typedef void (*EncryptionKeyCleanupFunction)(void)

Cleanup all dependencies after the decryption process has finished.

This function is called when the last reference to the EncryptionKeyHandle has been disposed.

typedef error_type (*EncryptionKeyDecryptFunction)(const BufferHandle *data, BufferHandle **result)

User provided function used for decrypting data.

This function is only called when EncryptionKeyContainsFunction sets the result to true.

Param data:

a pointer to source buffer containing the PKCS#7 encrypted data

Param result:

an output pointer which has to be set with the decrypted data on success. Otherwise leave unchanged.

typedef error_type (*EncryptionKeyContainsFunction)(const BufferHandle *issuer, const BufferHandle *serial, boolean_type *result)

Function used to determine whether the private key for certificate issued by issuer with serial is present.

Param issuer:

a pointer to X509 NAME structure containning the certificate issuer

Param issuer:

a pointer to ASN.1 structure containning the certificate serial

Param result:

a pointer to boolean. Set to true, if the private key for issuer and serial is present. Otherwise set to false.

error_type EncryptionKey_CreateCustom(EncryptionKeyInitializeFunction initialize, EncryptionKeyCleanupFunction cleanup, EncryptionKeyDecryptFunction decrypt, EncryptionKeyContainsFunction contains, EncryptionKeyHandle **result)

Creates a custom EncryptionKeyHandle to provide custom decrypt operation.

error_type EncryptionKey_ToUnknown(EncryptionKeyHandle *handle, IUnknownHandle **result)

Reinterpret current object as IUnknownHandle.

error_type EncryptionKey_FromUnknown(IUnknownHandle *handle, EncryptionKeyHandle **result)

Convert IUnknownHandle to EncryptionKeyHandle.

error_type EncryptionKey_Release(EncryptionKeyHandle *handle)

Decrement the internal reference counter.

When the internal counter reaches zero the object is deleted. Releasing already disposed object causes undefined behavior.

See also

IUnknown_Release

class Errors
#include <c_errors.h>

This class contains additional informations about last error occurred.

The error code and message is stored in the thread-local storage and does not clear until another error occurrs on the same thread.

Unnamed Group

error_type Errors_GetLastError(error_type *result)

Obtain the last error code that occurred.

error_type Errors_GetPrintableErrorTextLength(error_type value, size_type *size)

Get length of the name returned by Errors_GetPrintableErrorText including the trailing NULL character.

error_type Errors_GetPrintableErrorText(error_type value, char *data, size_type size)

Obtain a human readable text of the error code including the trailing NULL character.

error_type Errors_GetLastErrorMessageLength(size_type *result)

Obtain length of the additional error message including the trailing NULL character.

error_type Errors_GetLastErrorMessage(char *data, size_type size)

Obtain the additional NULL terminated text message about the last error.

class InputOutputStreamHandle : public InputStreamHandle, public OutputStreamHandle, public IUnknownHandle
#include <c_input_output_stream.h>

Input stream can read and interpret input from sequences of characters.

Unnamed Group

error_type InputOutputStream_CreateFromFile(string_type filename, InputOutputStreamHandle **result)

Opens an existing file at filename for read and write.

error_type InputOutputStream_CreateFromMemory(InputOutputStreamHandle **result)

Creates a memory buffer for data manipulation.

error_type InputOutputStream_Read(InputOutputStreamHandle *handle, bigint_type length, char *result, bigint_type *read_length)

Reads data from input stream and stores them in the resulting array.

The allocation and deallocation of the resulting data is responsibility of the caller

error_type InputOutputStream_ReadBuffer(InputOutputStreamHandle *handle, bigint_type length, BufferHandle **result)

Reads data from input stream and stores them in the resulting buffer.

error_type InputOutputStream_GetInputPosition(InputOutputStreamHandle *handle, offset_type *result)

Gets current offset in the input stream.

error_type InputOutputStream_SetInputPosition(InputOutputStreamHandle *handle, offset_type value)

Sets current offset in the input stream.

error_type InputOutputStream_GetOutputPosition(InputOutputStreamHandle *handle, offset_type *result)

Gets current offset in the output stream.

error_type InputOutputStream_SetOutputPosition(InputOutputStreamHandle *handle, offset_type value)

Sets current offset in the output stream.

error_type InputOutputStream_WriteString(InputOutputStreamHandle *handle, string_type data)

Appends null terminated string data to current output stream instance.

error_type InputOutputStream_WriteBuffer(InputOutputStreamHandle *handle, BufferHandle *data)

Appends buffer data to current output stream instance.

error_type InputOutputStream_Flush(InputOutputStreamHandle *handle)

Flushes all pending data from the stream to it’s destination.

error_type InputOutputStream_ToInputStream(InputOutputStreamHandle *handle, InputStreamHandle **result)

Reinterpret current object as InputStreamHandle.

error_type InputOutputStream_FromInputStream(InputStreamHandle *handle, InputOutputStreamHandle **result)

Convert InputStreamHandle to InputOutputStreamHandle.

error_type InputOutputStream_ToOutputStream(InputOutputStreamHandle *handle, OutputStreamHandle **result)

Reinterpret current object as OutputStreamHandle.

error_type InputOutputStream_FromOutputStream(OutputStreamHandle *handle, InputOutputStreamHandle **result)

Convert InputStreamHandle to InputOutputStreamHandle.

error_type InputOutputStream_ToUnknown(InputOutputStreamHandle *handle, IUnknownHandle **result)

Reinterpret current object as IUnknownHandle.

error_type InputOutputStream_FromUnknown(IUnknownHandle *handle, InputOutputStreamHandle **result)

Convert IUnknownHandle to InputOutputStreamHandle.

error_type InputOutputStream_Release(InputOutputStreamHandle *handle)

Decrement the internal reference counter.

When the internal counter reaches zero the object is deleted. Releasing already disposed object causes undefined behavior.

See also

IUnknown_Release

class InputStreamHandle : public IUnknownHandle
#include <c_input_stream.h>

Input stream can read and interpret input from sequences of characters.

Subclassed by InputOutputStreamHandle

Unnamed Group

error_type InputStream_CreateFromFile(string_type filename, InputStreamHandle **result)

Opens an existing file at filename for read.

error_type InputStream_CreateFromBuffer(BufferHandle *data, InputStreamHandle **result)

Reads all data from buffer and stores them for later use.

This method does not reflect buffer updates after it has been called. Only current snapshot of the buffer state is stored in the stream.

error_type InputStream_Read(InputStreamHandle *handle, bigint_type length, char *result, bigint_type *read_length)

Reads data from input stream and stores them in the resulting array.

The allocation and deallocation of the resulting data is responsibility of the caller

error_type InputStream_ReadBuffer(InputStreamHandle *handle, bigint_type length, BufferHandle **result)

Reads data from input stream and stores them in the resulting buffer.

error_type InputStream_ToBuffer(InputStreamHandle *handle, BufferHandle **result)

Reads all data from the input stream and returns them as a single large buffer.

This method is not recommended for large files, as the process might not have enough memory.

error_type InputStream_GetInputPosition(InputStreamHandle *handle, offset_type *result)

Gets current offset in the input stream.

error_type InputStream_SetInputPosition(InputStreamHandle *handle, offset_type value)

Sets current offset in the input stream.

error_type InputStream_ToUnknown(InputStreamHandle *handle, IUnknownHandle **result)

Reinterpret current object as IUnknownHandle.

error_type InputStream_FromUnknown(IUnknownHandle *handle, InputStreamHandle **result)

Convert IUnknownHandle to InputStreamHandle.

error_type InputStream_Release(InputStreamHandle *handle)

Decrement the internal reference counter.

When the internal counter reaches zero the object is deleted. Releasing already disposed object causes undefined behavior.

See also

IUnknown_Release

class LibraryInfo
#include <c_library_info.h>

Informations about library version and author.

Unnamed Group

error_type LibraryInfo_GetVersionMajor(integer_type *result)

Get library major version.

A change in the library major version indicates backward incompatibility.

error_type LibraryInfo_GetVersionMinor(integer_type *result)

Get library minor version.

A change in the library minor version indicates backward compatibility, while some new features were added.

error_type LibraryInfo_GetVersionPatch(integer_type *result)

Get library patch version.

A change in the library minor version indicates no interface changes, only bugfixes.

error_type LibraryInfo_GetVersionBuild(integer_type *result)

Get library build version.

A change in the library build version should not affect any kind of functionality.

error_type LibraryInfo_GetAuthor(string_type *result)

Get library author name.

error_type LibraryInfo_GetBuildDay(integer_type *result)

Get day of month, when the library was built.

error_type LibraryInfo_GetBuildMonth(integer_type *result)

Get month of the year, when the library was built.

error_type LibraryInfo_GetBuildYear(integer_type *result)

Get year, when the library was built.

class LicenseInfo
#include <c_license_info.h>

Licensing utilities, determining whether this library is running in trial mode.

Unnamed Group

error_type LicenseInfo_SetLicenseFile(string_type filename)

Set path to license file.

error_type LicenseInfo_SetLicenseBuffer(BufferHandle *data)

Set content of the license file in case it is used as embedded resource.

error_type LicenseInfo_IsValid(boolean_type *result)

Determine whether a valid license has been presented.

error_type LicenseInfo_IsTemporary(boolean_type *result)

Determine whether the current license is temporary.

class Logging
#include <c_logging.h>

The library can provide some additional debug and error messages.

This class controls the logging switch which enables and disables the logging entirely. Additionally, the verbosity of the logging output can be adjusted as well.

This feature is enabled by default, with log_level info and logging output to console.

Unnamed Group

error_type Logging_SetCallbackLogger(Sink_Log_Function sink_callback, Sink_Flush_Function sink_flush_callback, void *user_data)

Set a logger, that will invoke sink_callback and sink_flush_callback passing user_data.

error_type Logging_SetRotatingFileLogger(string_type filename, integer_type max_file_size, integer_type max_files)

Set a logger using rotating file sink based on size.

error_type Logging_SetPattern(string_type pattern)

Set logging pattern to be used for each logging entry.

Pattern flags

Pattern flags are in the form of flag and resembles the strftime function:

Flag

Meaning

Example

v

The actual text to log

“some user text”

t

Thread id

“1232”

P

Process id

“3456”

n

Logger’s name

“some logger name”

l

The log level of the message

“debug”, “info”, etc

L

Short log level of the message

“D”, “I”, etc

a

Abbreviated weekday name

“Thu”

A

Full weekday name

“Thursday”

b

Abbreviated month name

“Aug”

B

Full month name

“August”

c

Date and time representation

“Thu Aug 23 15:35:46 2014”

C

Year in 2 digits

“14”

Y

Year in 4 digits

“2014”

D or x

Short MM/DD/YY date

“08/23/14”

m

Month 01-12

“11”

d

Day of month 01-31

“29”

H

Hours in 24 format 00-23

“23”

I

Hours in 12 format 01-12

“11”

M

Minutes 00-59

“59”

S

Seconds 00-59

“58”

e

Millisecond part of the current second 000-999

“678”

f

Microsecond part of the current second 000000-999999

“056789”

F

Nanosecond part of the current second 000000000-999999999

“256789123”

p

AM/PM

“AM”

r

12 hour clock

“02:55:02 PM”

R

24-hour HH:MM time, equivalent to H:M

“23:55”

T or X

ISO 8601 time format (HH:MM:SS), equivalent to H:M:S

“23:55:59”

z

ISO 8601 offset from UTC in timezone ([+/-]HH:MM)

“+02:00”

E

Seconds since the epoch

“1528834770”

%%

The % sign

“%”

%+

spdlog’s default format

“[2014-10-31 23:46:59.678] [mylogger] [info] Some message”

%^

start color range (can be used only once)

“[mylogger] [info(green)] Some message”

$

end color range (for example %^[+++]$ v) (can be used only once)

“[+++] Some message”

%@

Source file and line (use SPDLOG_TRACE(..), SPDLOG_INFO(…) etc. instead of spdlog::trace(…)) Same as g:%#

/some/dir/my_file.cpp:123

s

Basename of the source file (use SPDLOG_TRACE(..), SPDLOG_INFO(…) etc.)

“my_file.cpp”

g

Full or relative path of the source file as appears in spdlog::source_loc (use SPDLOG_TRACE(..), SPDLOG_INFO(…) etc.)

“/some/dir/my_file.cpp”

%#

Source line (use SPDLOG_TRACE(..), SPDLOG_INFO(…) etc.)

“123”

%!

Source function (use SPDLOG_TRACE(..), SPDLOG_INFO(…) etc. see tweakme for pretty-print)

“my_func”

o

Elapsed time in milliseconds since previous message

“456”

i

Elapsed time in microseconds since previous message

“456”

u

Elapsed time in nanoseconds since previous message

“11456”

O

Elapsed time in seconds since previous message

“4”

Aligning

Each pattern flag can be aligned by prepending a width number(up to 64).

Use - (left align) or = (center align) to control the align side:

Align

Meaning

Example

Result

%<width><flag>

Right align

%8l

“ info”

%-<width><flag>

Left align

%-8l

“info “

%=<width><flag>

Center align

%=8l

“ info “

Optionally add ! to truncate the result if its size exceeds the specified width:

Align

Meaning

Example

Result

%<width>!<flag>

Right align or truncate

%3!l

“inf”

%-<width>!<flag>

Left align or truncate

%-2!l

“in”

%=<width>!<flag>

Center align or truncate

%=1!l

“i”

error_type Logging_GetSeverity(LoggingSeverity *level)

Get actual logging severity.

error_type Logging_SetSeverity(LoggingSeverity level)

Set new logging severity.

error_type Logging_Shutdown()

Gracefully terminate the entire logging ecosystem.

typedef void (1 *Sink_Log_Function)(void *user_data

This function is invoked for every log entry when custom callback logger is used.

This function is invoked when the data are about to be flushed to the persistent storage.

class MemoryBufferOutputStreamHandle : public IUnknownHandle
#include <c_memory_buffer_output_stream.h>

An output stream that writes data to an internal memory buffer.

This stream implementation uses fmt::memory_buffer internally to accumulate character or binary data. It is typically used when dynamically collecting output into a contiguous memory block, for later retrieval or further processing.

The data written to this stream is stored in a resizable buffer, which can be accessed or converted to a BufferHandle after writing is complete.

Note

This stream is not thread-safe.

Unnamed Group

error_type MemoryBufferOutputStream_Create(MemoryBufferOutputStreamHandle **result)

Creates a new file at filename location and opens it for writing.

error_type MemoryBufferOutputStream_GetOutputPosition(MemoryBufferOutputStreamHandle *handle, offset_type *result)

Gets current offset in the output stream.

error_type MemoryBufferOutputStream_SetOutputPosition(MemoryBufferOutputStreamHandle *handle, offset_type value)

Sets current offset in the output stream.

error_type MemoryBufferOutputStream_WriteString(MemoryBufferOutputStreamHandle *handle, string_type data)

Appends null terminated string data to current output stream instance.

error_type MemoryBufferOutputStream_WriteBuffer(MemoryBufferOutputStreamHandle *handle, BufferHandle *data)

Appends buffer data to current output stream instance.

error_type MemoryBufferOutputStream_WriteBufferRange(MemoryBufferOutputStreamHandle *handle, BufferHandle *data, offset_type length)

Appends buffer data to current output stream instance up to length specified.

error_type MemoryBufferOutputStream_Flush(MemoryBufferOutputStreamHandle *handle)

Flushes all pending data from the stream to it’s destination.

error_type MemoryBufferOutputStream_ToUnknown(MemoryBufferOutputStreamHandle *handle, IUnknownHandle **result)

Reinterpret current object as IUnknownHandle.

error_type MemoryBufferOutputStream_FromUnknown(IUnknownHandle *handle, MemoryBufferOutputStreamHandle **result)

Convert IUnknownHandle to OutputStreamHandle.

error_type MemoryBufferOutputStream_Release(MemoryBufferOutputStreamHandle *handle)

Decrement the internal reference counter.

When the internal counter reaches zero the object is deleted. Releasing already disposed object causes undefined behavior.

See also

IUnknown_Release

class MiscUtils
#include <c_misc_utils.h>

Static utility class for OpenSSL initialization and cleanup.

Unnamed Group

error_type MiscUtils_InitializeOpenSSL()

Initialize OpenSSL providers and algorithms.

error_type MiscUtils_CleanupOpenSSL()

Cleanup OpenSSL providers and algorithms.

class ObjectDiagnostics
#include <c_object_diagnostics.h>

Provides runtime introspection of the object lifecycle.

All objects in the library derive from IUnknown and are reference-counted. This class exposes thread-safe counters that track the number of live objects, which can be used to detect memory leaks or monitor allocation patterns.

Typical usage: check that ActiveObjectCount returns to its baseline after releasing all handles to verify that no objects were leaked.

Unnamed Group

error_type ObjectDiagnostics_GetActiveObjectCount(bigint_type *result)

Get the number of currently live IUnknown-derived objects.

error_type ObjectDiagnostics_GetPeakObjectCount(bigint_type *result)

Get the peak number of simultaneously live objects since startup or last reset.

error_type ObjectDiagnostics_GetTotalObjectsCreated(bigint_type *result)

Get the total number of objects created since startup or last reset.

error_type ObjectDiagnostics_ResetCounters()

Reset peak and total counters to current active count.

class OutputStreamHandle : public IUnknownHandle
#include <c_output_stream.h>

Output stream can write sequences of characters and represent other kinds of data.

Subclassed by InputOutputStreamHandle

Unnamed Group

error_type OutputStream_CreateFromFile(string_type filename, OutputStreamHandle **result)

Creates a new file at filename location and opens it for writing.

error_type OutputStream_GetOutputPosition(OutputStreamHandle *handle, offset_type *result)

Gets current offset in the output stream.

error_type OutputStream_SetOutputPosition(OutputStreamHandle *handle, offset_type value)

Sets current offset in the output stream.

error_type OutputStream_WriteString(OutputStreamHandle *handle, string_type data)

Appends null terminated string data to current output stream instance.

error_type OutputStream_WriteBuffer(OutputStreamHandle *handle, BufferHandle *data)

Appends buffer data to current output stream instance.

error_type OutputStream_Flush(OutputStreamHandle *handle)

Flushes all pending data from the stream to it’s destination.

error_type OutputStream_ToUnknown(OutputStreamHandle *handle, IUnknownHandle **result)

Reinterpret current object as IUnknownHandle.

error_type OutputStream_FromUnknown(IUnknownHandle *handle, OutputStreamHandle **result)

Convert IUnknownHandle to OutputStreamHandle.

error_type OutputStream_Release(OutputStreamHandle *handle)

Decrement the internal reference counter.

When the internal counter reaches zero the object is deleted. Releasing already disposed object causes undefined behavior.

See also

IUnknown_Release

class PKCS12KeyHandle : public EncryptionKeyHandle, public SigningKeyHandle
#include <c_pkcs12_key.h>

PKCS#12 container is often used in cryptography to store asymmetric key pair.

It can used for encryption/decryption and signing as well.

Unnamed Group

error_type PKCS12Key_CreateFromFile(string_type path, string_type password, PKCS12KeyHandle **result)

Uses PKCS#12 standard format to access asymmetric keys.

Parameters:
  • path – a string path to file containing the PKCS#12 data structure

  • password – a protection password to the data structure. If there is no password use NULL.

  • result – a pointer to library allocated PKCS12KeyHandle

error_type PKCS12Key_CreateFromBuffer(BufferHandle *data, string_type password, PKCS12KeyHandle **result)

Uses PKCS#12 standard format to access asymmetric keys.

Parameters:
  • data – a buffer containing PKCS#12 data structure

  • password – a protection password to the data structure. If there is no password use NULL.

  • result – a pointer to library allocated PKCS12KeyHandle

error_type PKCS12Key_ToEncryptionKey(PKCS12KeyHandle *handle, EncryptionKeyHandle **result)

Reinterpret current object as EncryptionKeyHandle.

error_type PKCS12Key_FromEncryptionKey(EncryptionKeyHandle *handle, PKCS12KeyHandle **result)

Convert SigningKeyHandle to EncryptionKeyHandle.

error_type PKCS12Key_ToSigningKey(PKCS12KeyHandle *handle, SigningKeyHandle **result)

Reinterpret current object as SigningKeyHandle.

error_type PKCS12Key_FromSigningKey(SigningKeyHandle *handle, PKCS12KeyHandle **result)

Convert SigningKeyHandle to PKCS12KeyHandle.

error_type PKCS12Key_GetCertificate(PKCS12KeyHandle *handle, BufferHandle **result)

Get the certificate from the PKCS12 key.

Note

Returns the first certificate from the PKCS12 certificate chain

Parameters:
  • handle – The PKCS12 key handle

  • result – Output buffer containing DER-encoded certificate

Returns:

Error code

error_type PKCS12Key_Release(PKCS12KeyHandle *handle)

Decrement the internal reference counter.

When the internal counter reaches zero the object is deleted. Releasing already disposed object causes undefined behavior.

See also

IUnknown_Release

class SignatureVerificationSettingsHandle : public IUnknownHandle
#include <c_signature_verification_settings.h>

Configuration settings for signature verification.

Unnamed Group

error_type SignatureVerificationSettings_Create(SignatureVerificationSettingsHandle **result)

Create new signature verification settings with default values.

Parameters:

result – Output handle to created settings

Returns:

Error code

error_type SignatureVerificationSettings_GetSkipCertificateValidation(SignatureVerificationSettingsHandle *handle, boolean_type *result)

Get skip certificate validation flag.

When enabled, signature verification will skip X509 certificate chain validation. The cryptographic signature is still verified, but the certificate chain is not validated against the trust store.

The IsCertificateTrusted flag remains false because the certificate chain was not actually verified - we cannot claim trust for something we did not check. This provides transparency: a Valid status with IsCertificateTrusted=false indicates that validation was bypassed rather than successfully completed.

Note

Effect on verification result when enabled:

  • SignatureVerificationResult_GetStatus() returns SignatureStatus_Valid (assuming the cryptographic signature is correct)

  • SignatureVerificationResult_IsSignatureValid() returns VANILLAPDF_RV_TRUE

  • SignatureVerificationResult_IsCertificateTrusted() returns VANILLAPDF_RV_FALSE

Warning

This is a security bypass intended for testing/debugging only. In production, certificates should be properly added to the trust store.

Parameters:
  • handle – The settings handle

  • result – Output flag value

Returns:

Error code

error_type SignatureVerificationSettings_SetSkipCertificateValidation(SignatureVerificationSettingsHandle *handle, boolean_type value)

Set skip certificate validation flag.

When set to true, certificate chain validation is bypassed entirely. The cryptographic signature is still verified, but no X509 chain validation is performed. This allows signatures with expired, self-signed, or untrusted certificates to pass verification.

Note

When validation is skipped, SignatureVerificationResult_IsCertificateTrusted() will return VANILLAPDF_RV_FALSE, even though the overall status may be Valid. This accurately reflects that trust was not established through verification.

Warning

Setting this to true bypasses important security checks including: certificate expiration, trust chain validation, and root CA verification. Only use for testing or when you explicitly trust the signer through out-of-band means.

Parameters:
  • handle – The settings handle

  • value – Flag value to set (true to skip validation, false for full validation)

Returns:

Error code

error_type SignatureVerificationSettings_GetCheckSigningTimeFlag(SignatureVerificationSettingsHandle *handle, boolean_type *result)

Get check signing time flag.

Parameters:
  • handle – The settings handle

  • result – Output flag value

Returns:

Error code

error_type SignatureVerificationSettings_SetCheckSigningTimeFlag(SignatureVerificationSettingsHandle *handle, boolean_type value)

Set check signing time flag.

Parameters:
  • handle – The settings handle

  • value – Flag value to set

Returns:

Error code

error_type SignatureVerificationSettings_GetAllowWeakAlgorithmsFlag(SignatureVerificationSettingsHandle *handle, boolean_type *result)

Get allow weak algorithms flag.

Parameters:
  • handle – The settings handle

  • result – Output flag value

Returns:

Error code

error_type SignatureVerificationSettings_SetAllowWeakAlgorithmsFlag(SignatureVerificationSettingsHandle *handle, boolean_type value)

Set allow weak algorithms flag (MD5, SHA-1, RSA < 2048 bits)

Parameters:
  • handle – The settings handle

  • value – Flag value to set

Returns:

Error code

error_type SignatureVerificationSettings_ToUnknown(SignatureVerificationSettingsHandle *handle, IUnknownHandle **result)

Reinterpret current object as IUnknownHandle.

error_type SignatureVerificationSettings_FromUnknown(IUnknownHandle *handle, SignatureVerificationSettingsHandle **result)

Convert IUnknownHandle to SignatureVerificationSettingsHandle.

error_type SignatureVerificationSettings_Release(SignatureVerificationSettingsHandle *handle)

Decrement the internal reference counter.

When the internal counter reaches zero the object is deleted. Releasing already disposed object causes undefined behavior.

See also

IUnknown_Release

class TrustedCertificateStoreHandle : public IUnknownHandle
#include <c_signature_verifier.h>

Collection of trusted certificates for signature verification.

Unnamed Group

error_type TrustedCertificateStore_Create(TrustedCertificateStoreHandle **result)

Create an empty trusted certificate store.

error_type TrustedCertificateStore_AddCertificateFromPEM(TrustedCertificateStoreHandle *handle, const BufferHandle *pem_data)

Add a certificate from PEM format.

Parameters:
  • handle – The certificate store

  • pem_data – PEM-encoded certificate data (null-terminated UTF-8 string)

error_type TrustedCertificateStore_AddCertificateFromDER(TrustedCertificateStoreHandle *handle, const BufferHandle *der_data)

Add a certificate from DER format.

Parameters:
  • handle – The certificate store

  • der_data – DER-encoded certificate data

error_type TrustedCertificateStore_LoadFromDirectory(TrustedCertificateStoreHandle *handle, string_type directory_path)

Load certificates from directory (e.g., /etc/ssl/certs)

Parameters:
  • handle – The certificate store

  • directory_path – Path to directory containing certificates (UTF-8 encoded)

error_type TrustedCertificateStore_LoadSystemDefaults(TrustedCertificateStoreHandle *handle)

Load system default trusted certificates.

On Windows: Uses Windows Certificate Store On Linux/macOS: Uses OpenSSL default paths

Parameters:

handle – The certificate store

error_type TrustedCertificateStore_ToUnknown(TrustedCertificateStoreHandle *handle, IUnknownHandle **result)

Reinterpret current object as IUnknownHandle.

error_type TrustedCertificateStore_FromUnknown(IUnknownHandle *handle, TrustedCertificateStoreHandle **result)

Convert IUnknownHandle to TrustedCertificateStoreHandle.

error_type TrustedCertificateStore_Release(TrustedCertificateStoreHandle *handle)

Decrement the internal reference counter.

When the internal counter reaches zero the object is deleted. Releasing already disposed object causes undefined behavior.

See also

IUnknown_Release

class SignatureVerificationResultHandle : public IUnknownHandle
#include <c_signature_verifier.h>

Result of signature verification operation.

Unnamed Group

error_type SignatureVerificationResult_GetStatus(SignatureVerificationResultHandle *handle, SignatureVerificationStatusType *result)

Get overall verification status.

error_type SignatureVerificationResult_GetMessage(SignatureVerificationResultHandle *handle, BufferHandle **result)

Get human-readable message describing verification result.

error_type SignatureVerificationResult_IsSignatureValid(SignatureVerificationResultHandle *handle, boolean_type *result)

Check if signature is cryptographically valid.

error_type SignatureVerificationResult_IsDocumentIntact(SignatureVerificationResultHandle *handle, boolean_type *result)

Check if document bytes are intact (ByteRange matches)

error_type SignatureVerificationResult_IsCertificateTrusted(SignatureVerificationResultHandle *handle, boolean_type *result)

Check if certificate chain is trusted.

error_type SignatureVerificationResult_GetSignerCertificate(SignatureVerificationResultHandle *handle, BufferHandle **result)

Get signer’s certificate (DER-encoded)

error_type SignatureVerificationResult_GetCertificateChainCount(SignatureVerificationResultHandle *handle, size_type *result)

Get number of certificates in the chain.

Parameters:
  • handle – The verification result

  • result – Output certificate count (0 = signer, 1+ = intermediate/root)

error_type SignatureVerificationResult_GetCertificateChainAt(SignatureVerificationResultHandle *handle, size_type index, BufferHandle **result)

Get certificate from chain at index.

Parameters:
  • handle – The verification result

  • index – Certificate index (0 = signer, 1+ = intermediate/root)

  • result – Output DER-encoded certificate

error_type SignatureVerificationResult_GetSignerCommonName(SignatureVerificationResultHandle *handle, BufferHandle **result)

Get signer’s common name from certificate.

error_type SignatureVerificationResult_ToUnknown(SignatureVerificationResultHandle *handle, IUnknownHandle **result)

Reinterpret current object as IUnknownHandle.

error_type SignatureVerificationResult_FromUnknown(IUnknownHandle *handle, SignatureVerificationResultHandle **result)

Convert IUnknownHandle to SignatureVerificationResultHandle.

error_type SignatureVerificationResult_Release(SignatureVerificationResultHandle *handle)

Decrement the internal reference counter.

When the internal counter reaches zero the object is deleted. Releasing already disposed object causes undefined behavior.

See also

IUnknown_Release

class SignatureVerifier
#include <c_signature_verifier.h>

Static utility class for PKCS#7 signature verification.

Unnamed Group

error_type SignatureVerifier_Verify(const BufferHandle *signed_data, const BufferHandle *signature_contents, TrustedCertificateStoreHandle *trusted_store, SignatureVerificationSettingsHandle *settings, SignatureVerificationResultHandle **result)

Verify digital signature (low-level API)

This is a low-level API that operates on raw bytes extracted from PDF. If settings is NULL, default settings are used (all flags disabled).

Parameters:
  • signed_data – The raw bytes that were signed

  • signature_contents – The PKCS#7 signature blob

  • trusted_store – Trusted certificate store (required)

  • settings – Verification settings (optional, can be NULL for defaults)

  • result – Output verification result

class SigningKeyHandle : public IUnknownHandle
#include <c_signing_key.h>

Used for document signing.

Standard routine for message signing is Initialize, (single or multiple) Update, Final.

Subclassed by PKCS12KeyHandle

Unnamed Group

error_type SigningKey_CreateCustom(SigningKey_Initialize_Function sign_init, SigningKey_Update_Function sign_update, SigningKey_Final_Function sign_final, SigningKey_Cleanup_Function sign_cleanup, void *user_data, SigningKeyHandle **result)

Creates a custom SigningKeyHandle to provide custom sign operation.

error_type SigningKey_ToUnknown(SigningKeyHandle *handle, IUnknownHandle **result)

Reinterpret current object as IUnknownHandle.

error_type SigningKey_FromUnknown(IUnknownHandle *handle, SigningKeyHandle **result)

Convert IUnknownHandle to BufferHandle.

error_type SigningKey_SignInitialize(SigningKeyHandle *handle, MessageDigestAlgorithmType algorithm)

Initialize signing operation with specified digest algorithm.

Parameters:
  • handle – The signing key

  • algorithm – Message digest algorithm to use for signing

error_type SigningKey_SignUpdate(SigningKeyHandle *handle, const BufferHandle *data)

Update signing operation with data to be signed.

Parameters:
  • handle – The signing key

  • data – Data to include in signature

error_type SigningKey_SignFinal(SigningKeyHandle *handle, BufferHandle **result)

Finalize signing operation and return signature.

Parameters:
  • handle – The signing key

  • result – Output buffer containing PKCS#7 signature

error_type SigningKey_SignCleanup(SigningKeyHandle *handle)

Cleanup signing operation resources.

Parameters:

handle – The signing key

error_type SigningKey_Release(SigningKeyHandle *handle)

Decrement the internal reference counter.

When the internal counter reaches zero the object is deleted. Releasing already disposed object causes undefined behavior.

See also

IUnknown_Release

typedef error_type (1 *SigningKey_Initialize_Function)(void *user_data

Initialize signing engine using selected digest algorithm.

Cleanup all dependencies after the signing process has finished.

Finish the digest calculation and return signed hash.

Insert data into engine for digest calculation.

This function should reset all previous settings and prepare for future SigningKey_Update_Function to be called.

This function can be called multiple times, if there are more data for signing that would fit in a single buffer.

This function should allocate buffer, filled with data. The data should be hash value according to algorithm in SigningKey_Initialize_Function.

Hash should be signed and the result should be either a DER-encoded PKCS#1 binary data object or a DER-encoded PKCS#7 binary data object.

This function is called when the signing of a file has been finished

class IUnknownHandle
#include <c_unknown_interface.h>

Base class for reference counting.

Subclassed by ActionHandle, AnnotationHandle, BaseFontRangeHandle, BaseObjectAttributeHandle, BufferArrayHandle, BufferHandle, ByteRangeCollectionHandle, ByteRangeHandle, CatalogHandle, CharacterMapHandle, ColorHandle, ContentInstructionCollectionHandle, ContentInstructionCollectionIteratorHandle, ContentInstructionHandle, ContentOperatorHandle, ContentParserHandle, DateHandle, DestinationHandle, DestinationNameTreeHandle, DestinationNameTreeIteratorHandle, DeveloperExtensionHandle, DeveloperExtensionsHandle, DeveloperExtensionsIteratorHandle, DictionaryObjectIteratorHandle, DigitalSignatureHandle, DocumentEncryptionSettingsHandle, DocumentHandle, DocumentInfoHandle, DocumentSignatureSettingsHandle, EncryptionKeyHandle, FieldCollectionHandle, FieldHandle, FileHandle, FileStructureIssueHandle, FileStructureValidationResultHandle, FileWriterHandle, FileWriterObserverHandle, FilterBaseHandle, FontHandle, FontMapHandle, InputOutputStreamHandle, InputStreamHandle, InteractiveFormHandle, MemoryBufferOutputStreamHandle, NameDictionaryHandle, NamedDestinationsHandle, ObjectAttributeListHandle, ObjectHandle, OutlineBaseHandle, OutlineItemColorHandle, OutlineItemFlagsHandle, OutputStreamHandle, PageAnnotationsHandle, PageContentsHandle, PageLabelHandle, PageLabelsHandle, PageObjectHandle, PageRangeHandle, PageSubRangeHandle, PageTreeHandle, RectangleHandle, ResourceDictionaryHandle, SignatureVerificationResultHandle, SignatureVerificationSettingsHandle, SigningKeyHandle, TrustedCertificateStoreHandle, ViewerPreferencesHandle, XrefChainHandle, XrefChainIteratorHandle, XrefEntryHandle, XrefHandle, XrefIteratorHandle

Unnamed Group

error_type IUnknown_AddRef(IUnknownHandle *handle)

Increment the internal reference counter.

error_type IUnknown_Release(IUnknownHandle *handle)

Decrement the internal reference counter.

When the internal counter reaches zero the object is deleted. Releasing already disposed object causes undefined behavior.