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
35 lines (30 loc) · 1.26 KB
/
Copy pathencryption.cfc
File metadata and controls
35 lines (30 loc) · 1.26 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
32
33
34
35
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":
var info=javaloader.create( "org.apache.poi.poifs.crypt.EncryptionInfo" ).init( mode.agile );
break;
case "standard":
var info=javaloader.create( "org.apache.poi.poifs.crypt.EncryptionInfo" ).init( mode.standard );
break;
case "binaryRC4":
var info=javaloader.create( "org.apache.poi.poifs.crypt.EncryptionInfo" ).init( mode.binaryRC4 );
break;
}
return info;
}
function loadInfoWithSwitchedContextLoader(){
return switchThreadContextClassLoader( "loadInfo",javaLoader.getURLClassLoader() );
}
}