> [EMAIL PROTECTED] Initializating the module
> [EMAIL PROTECTED] Initializating the module
> +
> +The encryption module must be initialized when Libgnupdf library was
> +loaded It is *NOT* safe-thread.
>
> What kind of global data will be maintained by the module? All the
> information related with the ciphers will be stored in the per-cipher
> data structure, isnt it?
>
Indeed. The module will not any data directly, it should be a wrapper
for `gcry_check_version' libgcrypt's function, which must be called
before anyother libgcrypt's function.
Ah ok. I forgot that gcrypt needs to hold a global state.
> [EMAIL PROTECTED] Encryption and decryption
> [EMAIL PROTECTED] Encryption and decryption
> +
> [EMAIL PROTECTED] pdf_status_t pdf_crypt_setkey (pdf_crypt_t @var{cipher},
pdf_char_t @var{*key}, pdf_size_t @var{length})
> +
> +Set the key which will be used to encrypt and decrypt data. This
> +function should be called each time @code{pdf_crypt_encrypt} or
> [EMAIL PROTECTED] are called.
>
> Is that restriction really needed?
>
Not really, although you must reset the key for each object. It is
original behavior of libgcrypt.
Do I remove the restriction?
Well, the restriction introduces a severe coupling between
pdf_crypt_setkey and pdf_crypt_[de|en]crypt, so if it is technically
possible would be good for pdf_crypt_cipher_t to be able to remember
the key, even if the user needs to reset it.
> BTW, how do we know the size of the de/ciphered text? As far as I
> understand it the *_crypt_size functions provides information about
> the minimum buffer space required to hold the de/ciphered text, but
> not the exact number of bytes.
>
I fix it: it is the number of bytes in order to hold the de/ciphered
text. I said the minimum buffer space because the user could want to
reserve a greater space.
Ah ok.
Thanks David.