[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [pdf-devel] Crypt module discussion
From: |
jemarch |
Subject: |
Re: [pdf-devel] Crypt module discussion |
Date: |
Wed, 30 Jul 2008 23:58:23 +0200 |
User-agent: |
Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (Shijō) APEL/10.6 Emacs/23.0.60 (i686-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) |
Hello David.
I think pdf-crypt should offer V2 and AESV2 methods, which involve all
low level options (i.e: algorithm, key size, etc).
Agreed.
/* Initialize module */
pdf_status_t pdf_crypt_init (void);
Please remember in this point that, since the library should be
thread-safe, you cannot maintain any global state.
/* Create a new cipher */
pdf_crypt_t pdf_crypt_new (int method);
Our current convention is to always return a pdf_status_t value in
pdf_*_new functions, such as:
pdf_status_t pdf_crypt_new (int method, pdf_crypt_t *crypt);
/* Set initialization vector (Only for AESV2) */
pdf_status_t pdf_crypt_setiv (pdf_crypt_t cipher, const void * key,
size_t size);
I agree with Ralph in that we can assume that the initialization
vector will be contained in the beginning of the buffer when calling
'pdf_crypt_encrypt' or 'pdf_crypt_decrypt'.
/* Encrypt and decrypt buffers. This functions allow in-place encryption
too */
pdf_status_t pdf_crypt_encrypt (pdf_crypt_t cipher, void *out,
size_t outsize, const void *in, size_t insize);
pdf_status_t pdf_crypt_decrypt (pdf_crypt_t cipher, void *out,
size_t outsize, const void *in, size_t insize);
For these functions maybe would be good to return the number of bytes
actually generated by the operation. Something like:
pdf_size_t pdf_crypt_encrypt (pdf_crypt_t cipher,
pdf_char_t *in,
pdf_size_t in_size,
pdf_char_t *out,
pdf_size_t bytes);
where BYTES is the number of bytes we want to generate. I dont know if
that is feasible with the block-oriented cypher.
Will we store the ciphertext in a pdf_text_t again? It doesn't seem
smart for me. Since pdf_text_t functions has not sense in a block
cipher. Aleks, what do you think?
We have functions to initialize a pdf_text_t object from an ASCII
string but I dont know if we can set an arbitrary ("binary") string as
the value of a pdf_text_t. It is interesting since we may want to
store encrypted strings in pdf_text_t when generating pdf content. On
the other hand it is not critical since we for sure will be able to
tell the writer module to use raw strings. Aleks wi
In summary, I think pdf-crypt should export buffer encryption
functions and we build up stream and string functions from stream
and text module respectively.
I agree.
Thanks.
RE: [pdf-devel] Crypt module discussion, Leonard Rosenthol, 2008/07/30