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

Commit

Permalink
pdf: Accept Identity encryption
Browse files Browse the repository at this point in the history
Identity encryption means there is no encryption at all.
  • Loading branch information
aykevl committed May 24, 2018
1 parent 48d0402 commit 19819cd
Showing 1 changed file with 6 additions and 0 deletions.
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

0 comments on commit 19819cd

Please sign in to comment.