-
Notifications
You must be signed in to change notification settings - Fork 6
/
PDFEncryptionHandler.h
96 lines (61 loc) · 2.14 KB
/
PDFEncryptionHandler.h
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#import <Foundation/Foundation.h>
#import "PDFEncryptionUtils.h"
#import <XADMaster/CSHandle.h>
extern NSString *PDFUnsupportedEncryptionException;
@class PDFEncryptionAlgorithm;
@class PDFParser,PDFObjectReference,PDFString;
@interface PDFEncryptionHandler:NSObject
{
int version,revision;
NSDictionary *encrypt;
NSData *permanentid;
NSString *password;
BOOL needspassword;
NSMutableDictionary *keys,*algorithms;
PDFEncryptionAlgorithm *streamalgorithm,*stringalgorithm;
}
-(id)initWithParser:(PDFParser *)parser;
-(void)dealloc;
-(BOOL)needsPassword;
-(BOOL)setPassword:(NSString *)newpassword;
-(NSData *)documentKeyOfLength:(int)length;
-(NSData *)keyOfLength:(int)length forReference:(PDFObjectReference *)ref AES:(BOOL)aes;
-(NSData *)decryptString:(PDFString *)string;
-(CSHandle *)decryptStream:(PDFStream *)stream;
/*-(NSData *)keyForReference:(PDFObjectReference *)ref AES:(BOOL)aes;
-(NSData *)userKey;
-(void)calculateKeyForPassword:(NSString *)password;*/
@end
@interface PDFEncryptionAlgorithm:NSObject
{
}
-(NSData *)decryptedData:(NSData *)data reference:(PDFObjectReference *)ref;
-(CSHandle *)decryptedHandle:(CSHandle *)handle reference:(PDFObjectReference *)ref;
-(void)calculateKeyForPassword:(NSString *)password;
@end
@interface PDFNoAlgorithm:PDFEncryptionAlgorithm
{
}
-(NSData *)decryptedData:(NSData *)data reference:(PDFObjectReference *)ref;
-(CSHandle *)decryptedHandle:(CSHandle *)handle reference:(PDFObjectReference *)ref;
@end
@interface PDFStandardAlgorithm:PDFEncryptionAlgorithm
{
int keylength;
PDFEncryptionHandler *parent;
}
-(id)initWithLength:(int)length handler:(PDFEncryptionHandler *)handler;
-(NSData *)keyForReference:(PDFObjectReference *)ref AES:(BOOL)aes;
@end
@interface PDFRC4Algorithm:PDFStandardAlgorithm
{
}
-(NSData *)decryptedData:(NSData *)data reference:(PDFObjectReference *)ref;
-(CSHandle *)decryptedHandle:(CSHandle *)handle reference:(PDFObjectReference *)ref;
@end
@interface PDFAESAlgorithm:PDFStandardAlgorithm
{
}
-(NSData *)decryptedData:(NSData *)data reference:(PDFObjectReference *)ref;
-(CSHandle *)decryptedHandle:(CSHandle *)handle reference:(PDFObjectReference *)ref;
@end