forked from cfsimplicity/spreadsheet-cfml
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathencryption.cfc
More file actions
31 lines (26 loc) · 1.22 KB
/
Copy pathencryption.cfc
File metadata and controls
31 lines (26 loc) · 1.22 KB
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
component{
/*
I allow the POI JavaLoader instance to be maintained as the "contextLoader" and thereby used by POI objects when instantiating other POI classes. The EncryptionInfo class needs to load an EncryptionInfoBuilder class internally. For details of why this is so complex, see:
https://github.com/markmandel/JavaLoader/wiki/Switching-the-ThreadContextClassLoader
*/
function init( required javaloader, required string algorithm ){
variables.javaloader = javaloader;
variables.switchThreadContextClassLoader = javaloader.switchThreadContextClassLoader;
variables.algorithm = algorithm;
return this;
}
function loadInfo(){
var mode = javaloader.create( "org.apache.poi.poifs.crypt.EncryptionMode" );
switch( algorithm ){
case "agile":
return javaloader.create( "org.apache.poi.poifs.crypt.EncryptionInfo" ).init( mode.agile );
case "standard":
return javaloader.create( "org.apache.poi.poifs.crypt.EncryptionInfo" ).init( mode.standard );
case "binaryRC4":
return javaloader.create( "org.apache.poi.poifs.crypt.EncryptionInfo" ).init( mode.binaryRC4 );
}
}
function loadInfoWithSwitchedContextLoader(){
return switchThreadContextClassLoader( "loadInfo", javaLoader.getURLClassLoader() );
}
}