File: pdfcrypt.mli

package info (click to toggle)
camlpdf 0.5-1
  • links: PTS, VCS
  • area: non-free
  • in suites: squeeze, wheezy
  • size: 1,516 kB
  • ctags: 2,689
  • sloc: ml: 18,229; ansic: 139; makefile: 139
file content (62 lines) | stat: -rw-r--r-- 2,068 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
(** 40-bit, 128-bit and AES Decryption *)

(** Note that encryption depends on fixed object and generation numbers: don't
change these (for example by calling [Pdf.remove_unreferenced] on the PDF)
before writing.

Encryption support is part of the [Pdfwrite] module.*)

(* Permissions. *)
type permission =
  | NoEdit 
  | NoPrint
  | NoCopy 
  | NoAnnot
  | NoForms
  | NoExtract
  | NoAssemble
  | NoHqPrint

(** Decrypt a PDF document, given the user password, returning the permissions
under which the document was encrypted. *)
val decrypt_pdf : string -> Pdf.pdfdoc -> Pdf.pdfdoc option * permission list

(** Decrypt a PDF document, given the owner password. *)
val decrypt_pdf_owner : string -> Pdf.pdfdoc -> Pdf.pdfdoc option

(** [recrypt_pdf original decrypted_and_modified] re-encrypts a PDF document
which was decrypted using the user password and owner password from the
original encrypted file and the same permissions and encryption parameters. *)
val recrypt_pdf : Pdf.pdfdoc -> Pdf.pdfdoc -> string -> Pdf.pdfdoc

(**/**)
(* only for the use of PDFWrite *)

(** Encrypt a PDF documnent, using 40 bit encryption, with given user and
owner passwords. *)
val encrypt_pdf_40bit : string -> string -> permission list -> Pdf.pdfdoc -> Pdf.pdfdoc

(** Ditto for 128 bit encryption *)
val encrypt_pdf_128bit : string -> string -> permission list -> Pdf.pdfdoc -> Pdf.pdfdoc

(** Encrypt a file using the AESV2 Crypt filter *)
val encrypt_pdf_AES : bool -> string -> string -> permission list -> Pdf.pdfdoc -> Pdf.pdfdoc

(** Is a PDF encrypted? *)
val is_encrypted : Pdf.pdfdoc -> bool

(* only for the use of Pdfread *)
val decrypt_single_stream :
  string -> Pdf.pdfdoc -> int -> int -> Pdf.pdfobject -> Pdf.pdfobject

type encryption =
  | ARC4 of int * int
  | AESV2

(* Don't call on an unencrypted PDF *)
val get_encryption_values : Pdf.pdfdoc -> encryption * string * string * int32 * string

val banlist_of_p : int32 -> permission list

val string_of_pdf : (Pdf.pdfobject -> string) ref