-
Notifications
You must be signed in to change notification settings - Fork 6
API
🥚🥚🥚
- Type: number
Name | Value | Description |
---|---|---|
RC4_40 | 0 | 40bit RC4 Encryption |
RC4_128 | 1 | 128bit RC4 Encryption |
AES_128 | 2 | 128bit AES Encryption |
AES_256 | 3 | 256bit AES Encryption |
🌮🌮🌮
Name | Type | Attributes | Description |
---|---|---|---|
certs | Array<forge_cert> | optional | An array of necessary certificates. |
ocsps | Array<Uint8Array> | optional | An array of OCSPs' response. |
crls | Array<Uint8Array> | optional | The array of CRLs. |
🌮🌮🌮
Name | Type | Attributes | Description |
---|---|---|---|
mode | Crypto.Mode | required | The mode of encryption |
permissions | Array<string> | optional | The set of permissions to be blocked 1️⃣ |
userpwd | string | optional | User password. Used when opening the pdf. |
ownerpwd | string | optional | Owner password. If not specified, a random value is used. |
pubkeys | Array<PubKeyInfo> | optional | An array of recipients containing public-key certificates ('c') and permissions ('p'). |
1️⃣ permissions
can be the values listed blow.
-
copy
: (Only valid on public-key mode) Copy text and graphics from the document; -
print
: Print the document; -
modify
: Modify the contents of the document by operations other than those controlled by 'fill-forms', 'extract' and 'assemble'; -
copy-extract
: Copy or otherwise extract text and graphics from the document; -
annot-forms
: Add or modify text annotations, fill in interactive form fields, and, if 'modify' is also set, create or modify interactive form fields (including signature fields); -
fill-forms
: Fill in existing interactive form fields (including signature fields), even if 'annot-forms' is not specified; -
extract
: Extract text and graphics (in support of accessibility to users with disabilities or for other purposes); -
assemble
: Assemble the document (insert, rotate, or delete pages and create bookmarks or thumbnail images), even if 'modify' is not set; -
print-high
: Print the document to a representation from which a faithful digital copy of the PDF content could be generated. When this is not set, printing is limited to a low-level representation of the appearance, possibly of degraded quality.
🌮🌮🌮
Name | Type | Attributes | Description |
---|---|---|---|
c | Array<number> 🍴Uint8Array 🍴ArrayBuffer 🍴string 🍴forge_cert |
optional | A certificate. |
p | Array<string> | optional | An array of permissions you want to block. Valid values see EncryptOption |
🌮🌮🌮
Name | Type | Attributes | Description |
---|---|---|---|
x | number | required | Distance from left |
y | number | required | Distance from top |
w | number | required | Width |
h | number | required | Height |
🌮🌮🌮
Name | Type | Attributes | Description |
---|---|---|---|
area | SignAreaInfo | required | The signature's drawing area, these numbers are dots on 72dpi. |
pageidx | number | optional | The index of a page where the signature will be drawn. Default is 0. |
imgData | Array<number> 🍴Uint8Array 🍴ArrayBuffer 🍴string |
optional | The image's data. |
imgType | string | optional | The image's type, only support jpg and png |
text | string | optional | A text drawing for the signature, not implemented yet |
fontData | PDFLib.StandardFonts 🍴Array<number> 🍴Uint8Array 🍴ArrayBuffer 🍴string |
optional | The font's data for drawing text, not implemented yet |
🌮🌮🌮
Name | Type | Attributes | Description |
---|---|---|---|
p12cert | Array<number> 🍴Uint8Array 🍴ArrayBuffer 🍴string |
optional | Certificate's data. In the case of adding a document timestamp, it must be omitted. |
pwd | string | optional | The passphrase of the certificate. In the case of adding a document timestamp, it must be omitted. |
permission | number | optional | The modification permissions granted for this document. 1️⃣ |
reason | string | optional | The reason for signing |
location | string | optional | Your location |
contact | string | optional | Your contact information |
signdate |
TsaServiceInfo 🍴string 🍴Date |
optional | In the case of adding a document timestamp, it can't be omitted and can't be a Date. 2️⃣ |
signame | string | optional | The name of the signature |
drawinf | SignDrawInfo | optional | Visible signature's information |
ltv | number | optional | The method of how to enable LTV 3️⃣ |
debug | boolean | optional | To output debug informations or not |
1️⃣ permission
is a setting of DocMDP. Valid values are:
- 1: No changes to the document are permitted; any change to the document invalidates the signature.
- 2: Permitted changes are filling in forms, instantiating page templates, and signing; other changes invalidate the signature.
- 3: Permitted changes are the same as for 2, as well as annotation creation, deletion, and modification; other changes invalidate the signature.
2️⃣ signdate
- When it is a Date, it means the date and time of signing.
- When it is a string, it can be an url of TSA or an index of the preset TSAs as below:
- When it is a TsaServiceInfo, it means a full customized information of a TSA.
- When it is omitted, the system timestamp will be used.
3️⃣ ltv
's valid values are:
- 1: auto; Try using OCSP only to enable the LTV first; If can't, try using CRL to enable the LTV.
- 2: crl only; Only try using CRL to enable the LTV.
🌮🌮🌮
Name | Type | Attributes | Description |
---|---|---|---|
url | string | required | The url of TSA. |
len | number | optional | The length of signature's placeholder. |
headers | Object<string, *> | optional | The customized headers for sending to tsa server. |
🫕🫕🫕
Converts an Uint8Array to a raw string.
Name | Type | Attributes | Description |
---|---|---|---|
uarr | Uint8Array | required | The target Uint8Array |
🫕🫕🫕
Converts a raw string to an Uint8Array.
Name | Type | Attributes | Description |
---|---|---|---|
raw | string | required | The target string |
🥐🥐🥐
Name | Type | Attributes | Description |
---|---|---|---|
certs | Array<forge_cert> 🍴Array<forge.asn1> 🍴Array<string> |
optional | An array of certificates. |
Build the certificates chain from the specified certificate, and returns true if this operation is successful.
Name | Type | Attributes | Description |
---|---|---|---|
cert | forge_cert | required | A certificate to start build by looking for it's issuer. |
Returns an array of all certificates.
Returns the certificate for signing.
Returns true if the certificate for signing is a self-signed certificate.
prepareDSSInf(crlOnlyopt) ➡️ Promise<DSSInfo>
Returns the informations of DSS.
Name | Type | Attributes | Description |
---|---|---|---|
crlOnly | boolean | optional | Query CRL only or try query OCSP first. |
🥐🥐🥐
Name | Type | Attributes | Description |
---|---|---|---|
encopt | EncryptOption | required | Infomations of encryption. |
Encrypts the content of the specified pdf object.
Name | Type | Attributes | Description |
---|---|---|---|
num | number | required | The object number. |
val | PDFLib.PDFObject | required | The target object. |
Encrypts the contents in the pdf and returns the pdf document.
Name | Type | Attributes | Description |
---|---|---|---|
PDFLib.PDFDocument 🍴Array<number> 🍴Uint8Array 🍴ArrayBuffer 🍴string |
required | The target pdf. | |
ref | PDFLib.PDFRef | optional | The unique reference will be assigned to the encryption information. |
🥐🥐🥐
Name | Type | Attributes | Description |
---|---|---|---|
signopt | SignOption | required | Infomations of signing. |
Sign the pdf and returns the binary data.
Name | Type | Attributes | Description |
---|---|---|---|
PDFLib.PDFDocument | Array<number> | Uint8Array | |
cypopt | EncryptOption | optional | The informations of encryption. |
🥐🥐🥐
Name | Type | Attributes | Description |
---|---|---|---|
inf | TsaServiceInfo | required | Infomations of TSA. |
Name | Type | Description |
---|---|---|
url | string | The url of TSA. |
len | number | The length of signature which is generated by the TSA. |
getCertsChain() ➡️ CertsChain
Get the certificates' chain from the response of TSA.
Get the token data in response from TSA.
Name | Type | Attributes | Description |
---|---|---|---|
forP7 | boolean | optional | To create an asn1 for appending to a pkcs#7 signature or not. |
Query TSA to sign the data and returns error message if error occured.
Name | Type | Attributes | Description |
---|---|---|---|
data | string | required | The data needs to be signed. |
- CRL📢 Certificate Revocation List
- DDS📢 Document Security Store
- DocMDP📢 Document Modification Detection and Prevention
- LTV📢 Long-Term Validation
- OCSP📢 Online Certificate Status Protocol
- TSA📢 Time Stamp Authority