Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure that a security handler is always initialised
For now, we have three handlers: * NullSecurityHandler for unencrypted files * StandardSecurityHandler for files encrypted with pdf-spec compatible RC4 encryption * UnimplementedSecurityHandler for files encrypted with unsupported algorithms, including PDF-spec compatible AES, and any proprietary algorithm (adobe ebooks, etc).
- Loading branch information
Showing
4 changed files
with
21 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# coding: utf-8 | ||
|
||
class PDF::Reader | ||
|
||
# Security handler for when we don't support the flavour of encryption | ||
# used in a PDF. | ||
class UnimplementedSecurityHandler | ||
def decrypt(buf, ref) | ||
raise PDF::Reader::EncryptedPDFError, "Unsupported encryption style" | ||
end | ||
end | ||
end |