Skip to content
This repository was archived by the owner on Jul 7, 2020. It is now read-only.

pdf: Accept Identity encryption #25

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions read.go
Original file line number Diff line number Diff line change
Expand Up @@ -896,6 +896,9 @@ func (r *Reader) initEncrypt(password string) error {
if V != 1 && V != 2 && (V != 4 || !okayV4(encrypt)) {
return fmt.Errorf("unsupported PDF: encryption version V=%d; %v", V, objfmt(encrypt))
}
if V == 4 && encrypt["StmF"].(name) == name("Identity") {
return nil // No encryption applied.
}

ids, ok := r.trailer["ID"].(array)
if !ok || len(ids) < 1 {
Expand Down Expand Up @@ -1003,6 +1006,9 @@ func okayV4(encrypt dict) bool {
if stmf != strf {
return false
}
if stmf == name("Identity") {
return true // No encryption applied.
}
cfparam, ok := cf[stmf].(dict)
if cfparam["AuthEvent"] != nil && cfparam["AuthEvent"] != name("DocOpen") {
return false
Expand Down