[pdftex] pdftex-pdfcrypt update

Ricardo Sanchez Carmenes carmenes at bioquimica.uniovi.es
Tue Mar 27 20:13:53 CEST 2001


On Tue, 27 Mar 2001, Hans Hagen wrote:

> At 03:27 PM 3/27/01 +0200, Ricardo Sanchez Carmenes wrote:
> 
> >> I think that looking at the other pdftex primitives 
> >>   
> >>   \pdfcrypt 
> >>      owner {...} 
> >>      user {...} 
> >>      noprint 
> >>      noedit 
> >
> >Maybe you are right. I'll study the case.
> >However, pdftex has also some primitives with the form
> >\pdfprimitive{ this and that }
> 
> yes, but the things between { } are either processed by tex or passed onto
> pdf directly, there is never a key/value syntax in there let alone the ""

It sounds reasonable.

> as delimiters [which will make german users crazy since they are often made
> into an active char there]. 

Well, I have " active in my macros, and I did not noticed troubles,
but you could be right.

> >Could you or anybody else provide pros and cons for each syntax ?
> 
> this key {} syntax conforms the annot and image inclusion syntax

It sounds reasonable too.

> >> would be better, or maybe the latter keywords should be replaced by access
> >> to the pdf dicts involved (i will look into that when i can test it).
> >
> >No. The PDF encryption dictionary is not suitable for direct use.
> >It has the form:
> >
> ><<
> >/Filter /Standard
> >/V 1
> >/R 2
> >/O <owner pw as a 32-byte key represented in hexadecimal>
> >/U < user pw as a 32-byte key represented in hexadecimal>
> >/P two-byte integer that controls permits
> >   with bits 1-2=0, 7-32=1, 3=print, 4=edit, 5=copy, 6=annotations
> >>>
> >
> >/Filter /Standard /V 1 /R 2 are fixed, unless you use a custom-made
> >encryption filter. The /O and /U 32-byte keys are calculated from the
> >provided passwords and the "unique" file ID stored added to the trailer:
> >/ID [<16-byte id1><1-6byte id2>], therefore unsuitable for direct human
> >consum.
> 
> Hm. If i read this all right, it would match the rest of pdftex's syntax to
> have a 
> 
>   attr {} 
> 
> so that one should say [as happens with for instance widgets]
> 
>   attr {/P 1256} 
> 
> depending on the protection needed. During the developmen tof pdftex, thanh
> has made sure that anything that shoul dnot necessarily be hard coded, was
> not coded at all and passed by the user (or macro package). That way pdftex
> can keep up with developments without the need to adapt the source.

And leave to the user or the macros to take care of calculating the right
permission value ? Maybe a mixed solution could be useful.

Anyway, browsing through the pdftex sources I found more than one place
where this principle was not strictly followed.

In short, your suggestions about syntax sound reasonable, but I still
would like to hear others. The current syntax works fine for me, and
I must recognize that coding the primitive was not the easiest part for me
(it was my first incursion in web sources -- I feel confortable with C 
and pascal, but know little of web/tangle subtilities). I will make a try,
but I will mainly concentrate in solving the difficulties directly related
to the encryption process itself, stream output and so on, and leave
syntax-related stuff to others better placed if necessary.

BTW, did you try it already ? You have pretty complicated pdf files that
make use of niceties that I do not realy use, and they would be a good
test.

Regards.




More information about the pdftex mailing list