diff --git a/FOSSLicense.txt b/FOSSLicense.txt
new file mode 100644
index 0000000..e69de29
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..743f263
--- /dev/null
+++ b/README.md
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+# Seclore Server SDK Examples
+
+Welcome to the Seclore Server SDK Examples repository! Here, you'll find a curated collection of example projects showcasing the robust capabilities of the [Seclore Software Development Kit](https://repo.seclore.com/public/-/packages/generic/seclore-java-sdk/4.4.16.0).
+
+## Table of Contents
+
+1. [About this Repo](#About)
+2. [Examples](#Examples)
+3. [Learning Resources](#Learning)
+
+## About this Repo
+
+This repository serves as a comprehensive guide to leveraging the powerful Web Service APIs exposed by the Seclore Policy Server. It includes an official list of meticulously crafted SDK examples (see ["Examples"](#Examples)) tailored to empower developers in seamlessly integrating the SDK into their applications. Each example provides practical demonstrations of common service implementations and essential infrastructure patterns, ensuring a smooth integration experience with the Seclore Server SDK.
+
+## Examples
+
+Refer the examples in Java language, fully supported by the Seclore Server SDK. Explore the intricacies of secure data management, access controls, and much more by visiting the following link: [Examples](https://repo.seclore.com/public/seclore-java-sdk/src/branch/initial-setup/examples)
+
+## Learning Resources
+
+While this is an excellent learning resource for the SDK, there are other resources that can be referenced to assist with your learning/development process.
+
+### Official Resources
+
+- [Developer Guide](https://git-link-of-Seclore-Server-SDK-Java-Guide.pdf)
+- [API Reference](http://seclore-sdk.secloredevops.com/4.4.16.0/)
+- [Seclore Server SDK Package](https://repo.seclore.com/public/-/packages/generic/seclore-java-sdk/4.4.16.0)
diff --git a/config-files/log4j2.xml b/config-files/log4j2.xml
new file mode 100644
index 0000000..e69de29
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Protect and Wrap Sample Code Walkthrough.mp4 b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Protect and Wrap Sample Code Walkthrough.mp4
new file mode 100644
index 0000000..6384ea3
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Protect and Wrap Sample Code Walkthrough.mp4 differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/Readme.txt b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/Readme.txt
new file mode 100644
index 0000000..c798d20
--- /dev/null
+++ b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/Readme.txt
@@ -0,0 +1,24 @@
+
+Protect With Hot Folder and Wrap Sample App
+============================================
+
+Deployment Steps:
+------------------
+
+1. make sure your policy server is running . This app requires java 8 or above to run so make
+ sure java 8 or above is installed.
+
+2. go inside 'bin/Protect With Hot Folder and Wrap Sample App'
+
+3. Configure the 'tenant config.xml' in 'config/'
+ a. Policy Server Details:
+ server : Server name on which Policy Server is running
+ port : Server Port on which Policy Server is running
+ app-name : Policy Server application name
+
+ b. fill hot folder details i.e id and passphrase
+
+4. If you are using java 8 , put libs present inside 'doc/JCE Files/java8' into
+ 'bin/Protect With Hot Folder and Wrap Sample App/lib'
+
+5. click on run.bat to start sample app , follow instruction on terminal
\ No newline at end of file
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/config/config.xml b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/config/config.xml
new file mode 100644
index 0000000..b148308
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/config/config.xml differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/config/log4j.properties b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/config/log4j.properties
new file mode 100644
index 0000000..8293be6
--- /dev/null
+++ b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/config/log4j.properties
@@ -0,0 +1,15 @@
+
+log4j.category.WSCLIENT=debug, WSCLIENT
+
+# If we want to change the Appender, we have to change
+# UtilFunction.initializeLoggers() too, because it assumes that the appender
+# is 'org.apache.log4j.RollingFileAppender' and changes path of the file by
+# getting appender from this logger.
+log4j.appender.WSCLIENT=com.seclore.fs.ws.client.logger.DailyZippedRollingFileAppender
+# Path of the file should be relative to application ROOT
+log4j.appender.WSCLIENT.File=logs/WSClient.log
+log4j.appender.WSCLIENT.MaxFileSize=10MB
+#log4j.appender.REQUEST_LOGGER.MaxBackupIndex=10
+log4j.appender.WSCLIENT.DatePattern='_'yyyy-MM-dd
+log4j.appender.WSCLIENT.layout=org.apache.log4j.PatternLayout
+log4j.appender.WSCLIENT.layout.ConversionPattern=%d{MMM dd, yyyy HH:mm:ss.SSS} %F:%L%n%p: %m%n
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/config/log4j2.xml b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/config/log4j2.xml
new file mode 100644
index 0000000..6902efe
--- /dev/null
+++ b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/config/log4j2.xml
@@ -0,0 +1,43 @@
+
+
+
+
+
+ ${ctx:applicationPath}/logs
+
+
+
+
+
+
+
+
+
+
+
+
+ UTF-8
+ %d{MMM dd, yyyy HH:mm:ss.SSS} :%t %n%p: %m%n
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/config/tenant config.xml b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/config/tenant config.xml
new file mode 100644
index 0000000..a88ffcc
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/config/tenant config.xml differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/bc-fips-1.0.0.jar b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/bc-fips-1.0.0.jar
new file mode 100644
index 0000000..321e563
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/bc-fips-1.0.0.jar differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/commons-codec-1.6.jar b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/commons-codec-1.6.jar
new file mode 100644
index 0000000..ee1bc49
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/commons-codec-1.6.jar differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/disruptor-3.3.7.jar b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/disruptor-3.3.7.jar
new file mode 100644
index 0000000..1777a37
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/disruptor-3.3.7.jar differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/fs-smaillibrary.jar b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/fs-smaillibrary.jar
new file mode 100644
index 0000000..aa95e22
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/fs-smaillibrary.jar differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/fs-ws-client-4.4.7.jar b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/fs-ws-client-4.4.7.jar
new file mode 100644
index 0000000..bf2adcf
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/fs-ws-client-4.4.7.jar differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/juniversalchardet-1.0.3.jar b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/juniversalchardet-1.0.3.jar
new file mode 100644
index 0000000..1af703f
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/juniversalchardet-1.0.3.jar differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/log4j-1.2.14.jar b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/log4j-1.2.14.jar
new file mode 100644
index 0000000..6251307
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/log4j-1.2.14.jar differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/log4j-api-2.10.0.jar b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/log4j-api-2.10.0.jar
new file mode 100644
index 0000000..9603b1b
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/log4j-api-2.10.0.jar differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/log4j-core-2.10.0.jar b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/log4j-core-2.10.0.jar
new file mode 100644
index 0000000..1be9e67
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/log4j-core-2.10.0.jar differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/sample-app.jar b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/sample-app.jar
new file mode 100644
index 0000000..c818696
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/sample-app.jar differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/xercesImpl-X.jar b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/xercesImpl-X.jar
new file mode 100644
index 0000000..38fca83
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/xercesImpl-X.jar differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/logs/WSClient.log b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/logs/WSClient.log
new file mode 100644
index 0000000..d2f66ca
--- /dev/null
+++ b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/logs/WSClient.log
@@ -0,0 +1,7 @@
+FileSecure Version is 4.4.7.0
+Jul 19, 2021 12:12:16.897 :main
+INFO: WSCLIENT logger is initialized
+Jul 19, 2021 12:12:16.903 :main
+INFO: -1SDK Logger is initialized
+Jul 19, 2021 12:12:16.904 :main
+INFO: -1FSHelperLibrary::initializeSuccessfully Initialized helper library.
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/run.bat b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/run.bat
new file mode 100644
index 0000000..45ecf70
--- /dev/null
+++ b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/run.bat
@@ -0,0 +1,18 @@
+@echo off
+set "CURRENT_DIR=%cd%"
+echo ---------------------------------------------------------
+echo Seclore 'Protect with Hot Folder Wrap Sample App' Utility
+echo ---------------------------------------------------------
+echo.
+
+rem if your want to run on a different jdk or java path is not configured uncomment below line
+rem for example ,
+rem set path="C:\Program Files\Java\jdk-11.0.1\bin";
+java -version
+echo.
+
+REM uncomment below line to see the version of sample app i.e( remove REM mentioned below)
+REM java -cp "./lib/sample-app.jar"; com.seclore.fs.protect.example.Version
+
+ java -cp "./lib/*"; com.seclore.fs.protect.example.main.SecloreMain
+pause
\ No newline at end of file
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/doc/Developer_s Reference.txt b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/doc/Developer_s Reference.txt
new file mode 100644
index 0000000..d49ade4
--- /dev/null
+++ b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/doc/Developer_s Reference.txt
@@ -0,0 +1,37 @@
+FileSecure Interfaces integration source code reference.
+
+FS Helper Initialization
+------------------------
+ - At application startup initializing FSHelperlibrary and FSHelper
+ - Below classes are used for the same
+ - SecloreMain
+ - static block :-
+ InitializeWSClient.initializeHelperLibrary((FSHELPERLIBRARY_CONFIG_XML_PATH, ););
+ InitializeWSClient.initializeHelper(HELPER_INSTANCE_KEY, FSHELPER_RESOURCE_PATH, FSHELPER_CONFIG_XML_PATH, );
+ - InitializeWSClient
+ - initializeHelperLibrary( ... )
+ - initializeHelper( ... )
+
+
+
+Main Class
+------------
+ - com.seclore.fs.protect.example.main
+ - SecloreMain class
+
+Note:
+=====
+while preparing xml string for request or response. please escape below spacial character for the string which will be written within xml tag.
+ "&" -> "&"
+ "<" -> "<"
+ ">", -> ">"
+ "\"" -> """
+ "'" -> "'";
+
+ Refer: com.seclore.fs.protect.example.util.XMLUtil class and
+ - escapeForXML () method
+
+Example: sample xml is "Sample Sales & purchase report.pdf"
+ here "Sample Sales and purchase report" should be escaped.
+ Use: String fileName = XMLHelper.escapeForXML( "Sample Sales & purchase report" );
+ ""+fileName+""
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/doc/JCE Files/Java7/US_export_policy.jar b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/doc/JCE Files/Java7/US_export_policy.jar
new file mode 100644
index 0000000..7173213
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/doc/JCE Files/Java7/US_export_policy.jar differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/doc/JCE Files/Java7/local_policy.jar b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/doc/JCE Files/Java7/local_policy.jar
new file mode 100644
index 0000000..c34d036
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/doc/JCE Files/Java7/local_policy.jar differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/doc/JCE Files/Java8/US_export_policy.jar b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/doc/JCE Files/Java8/US_export_policy.jar
new file mode 100644
index 0000000..251b102
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/doc/JCE Files/Java8/US_export_policy.jar differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/doc/JCE Files/Java8/local_policy.jar b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/doc/JCE Files/Java8/local_policy.jar
new file mode 100644
index 0000000..1c58939
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/doc/JCE Files/Java8/local_policy.jar differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/.classpath b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/.classpath
new file mode 100644
index 0000000..8960a2e
--- /dev/null
+++ b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/.classpath
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/.project b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/.project
new file mode 100644
index 0000000..5160502
--- /dev/null
+++ b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/.project
@@ -0,0 +1,17 @@
+
+
+ Protect With Hot Folder and Wrap Sample App Code
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+
+
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/.settings/org.eclipse.jdt.core.prefs b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..3a21537
--- /dev/null
+++ b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,11 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/bin/com/seclore/fs/protect/example/Version.class b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/bin/com/seclore/fs/protect/example/Version.class
new file mode 100644
index 0000000..694b590
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/bin/com/seclore/fs/protect/example/Version.class differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/bin/com/seclore/fs/protect/example/core/InitializeWSClient.class b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/bin/com/seclore/fs/protect/example/core/InitializeWSClient.class
new file mode 100644
index 0000000..7229984
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/bin/com/seclore/fs/protect/example/core/InitializeWSClient.class differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/bin/com/seclore/fs/protect/example/main/SecloreMain.class b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/bin/com/seclore/fs/protect/example/main/SecloreMain.class
new file mode 100644
index 0000000..692e504
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/bin/com/seclore/fs/protect/example/main/SecloreMain.class differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/config/config.xml b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/config/config.xml
new file mode 100644
index 0000000..610e0c5
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/config/config.xml differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/config/log4j.properties b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/config/log4j.properties
new file mode 100644
index 0000000..8293be6
--- /dev/null
+++ b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/config/log4j.properties
@@ -0,0 +1,15 @@
+
+log4j.category.WSCLIENT=debug, WSCLIENT
+
+# If we want to change the Appender, we have to change
+# UtilFunction.initializeLoggers() too, because it assumes that the appender
+# is 'org.apache.log4j.RollingFileAppender' and changes path of the file by
+# getting appender from this logger.
+log4j.appender.WSCLIENT=com.seclore.fs.ws.client.logger.DailyZippedRollingFileAppender
+# Path of the file should be relative to application ROOT
+log4j.appender.WSCLIENT.File=logs/WSClient.log
+log4j.appender.WSCLIENT.MaxFileSize=10MB
+#log4j.appender.REQUEST_LOGGER.MaxBackupIndex=10
+log4j.appender.WSCLIENT.DatePattern='_'yyyy-MM-dd
+log4j.appender.WSCLIENT.layout=org.apache.log4j.PatternLayout
+log4j.appender.WSCLIENT.layout.ConversionPattern=%d{MMM dd, yyyy HH:mm:ss.SSS} %F:%L%n%p: %m%n
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/config/log4j2.xml b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/config/log4j2.xml
new file mode 100644
index 0000000..b6b5b0e
--- /dev/null
+++ b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/config/log4j2.xml
@@ -0,0 +1,43 @@
+
+
+
+
+
+ ${ctx:applicationPath}/logs
+
+
+
+
+
+
+
+
+
+
+
+
+ UTF-8
+ %d{MMM dd, yyyy HH:mm:ss.SSS}: %t: %p: %m%n
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/config/tenant config.xml b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/config/tenant config.xml
new file mode 100644
index 0000000..44e9b77
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/config/tenant config.xml differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/lib/bc-fips-1.0.2.3.jar b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/lib/bc-fips-1.0.2.3.jar
new file mode 100644
index 0000000..1a8c5de
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/lib/bc-fips-1.0.2.3.jar differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/lib/commons-codec-1.6.jar b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/lib/commons-codec-1.6.jar
new file mode 100644
index 0000000..ee1bc49
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/lib/commons-codec-1.6.jar differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/lib/disruptor-3.3.7.jar b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/lib/disruptor-3.3.7.jar
new file mode 100644
index 0000000..1777a37
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/lib/disruptor-3.3.7.jar differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/lib/fs-smaillibrary.jar b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/lib/fs-smaillibrary.jar
new file mode 100644
index 0000000..0cb2298
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/lib/fs-smaillibrary.jar differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/lib/fs-ws-client.jar b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/lib/fs-ws-client.jar
new file mode 100644
index 0000000..cbda191
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/lib/fs-ws-client.jar differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/lib/juniversalchardet-1.0.3.jar b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/lib/juniversalchardet-1.0.3.jar
new file mode 100644
index 0000000..1af703f
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/lib/juniversalchardet-1.0.3.jar differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/lib/log4j-api-2.17.1.jar b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/lib/log4j-api-2.17.1.jar
new file mode 100644
index 0000000..1aae243
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/lib/log4j-api-2.17.1.jar differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/lib/log4j-core-2.17.1.jar b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/lib/log4j-core-2.17.1.jar
new file mode 100644
index 0000000..4682527
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/lib/log4j-core-2.17.1.jar differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/lib/seclore-io-1.0.0.0.jar b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/lib/seclore-io-1.0.0.0.jar
new file mode 100644
index 0000000..365237b
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/lib/seclore-io-1.0.0.0.jar differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/lib/xercesImpl-X.jar b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/lib/xercesImpl-X.jar
new file mode 100644
index 0000000..38fca83
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/lib/xercesImpl-X.jar differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/src/com/seclore/fs/protect/example/Version.java b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/src/com/seclore/fs/protect/example/Version.java
new file mode 100644
index 0000000..df17df2
--- /dev/null
+++ b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/src/com/seclore/fs/protect/example/Version.java
@@ -0,0 +1,23 @@
+package com.seclore.fs.protect.example;
+
+/**
+ * Represents the Sample App version.
+ */
+public class Version
+{
+ /**
+ * The version of the Sample App.
+ */
+ public static final String Version = "3.0.0.0";
+
+ /**
+ * Displays the version of the Sample App
+ *
+ * @param args
+ */
+ public static void main(String[] args)
+ {
+ System.out.println("Sample App version : " + Version);
+ System.out.println("Copyright (c) 2008 Seclore Technology Pvt. Ltd.");
+ }
+}
\ No newline at end of file
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/src/com/seclore/fs/protect/example/core/InitializeWSClient.java b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/src/com/seclore/fs/protect/example/core/InitializeWSClient.java
new file mode 100644
index 0000000..2a5e4c2
--- /dev/null
+++ b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/src/com/seclore/fs/protect/example/core/InitializeWSClient.java
@@ -0,0 +1,238 @@
+package com.seclore.fs.protect.example.core;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringWriter;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.mozilla.universalchardet.UniversalDetector;
+import org.w3c.dom.Document;
+import org.xml.sax.InputSource;
+
+import com.seclore.fs.helper.exception.FSHelperException;
+import com.seclore.fs.helper.library.FSHelperLibrary;
+
+public class InitializeWSClient
+{
+ /**
+ * @param configPath
+ * Takes the application config file path as input
+ * @throws Exception
+ */
+ public static void initializeHelperLibrary(String configPath) throws Exception
+ {
+ try
+ {
+ String configContentXMLString = getConfigFileContent(configPath);
+ // Initialize method takes WSClient config content not the config file path.
+ FSHelperLibrary.initialize(configContentXMLString);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @param helperId
+ * Tenant Id
+ * @param helperResourcePath
+ * Resource Path for files of Seclore Policy Server. To be left empty here.
+ * @param helperConfigPath
+ * File path for 'tenant config.xml' file
+ * @throws Exception
+ * Code snippet won't run if any exception is thrown in this block
+ */
+ public static void initializeHelper(String helperId, String helperResourcePath, String helperConfigPath) throws Exception
+ {
+ try
+ {
+ String configContentXMLString = getConfigFileContent( helperConfigPath );
+ // Initialize method takes WSClient config content not the config file path.
+ FSHelperLibrary.initializeHelper(helperId, helperResourcePath, configContentXMLString);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * This method reads an XML file and returns the content of the XML file in string format
+ * @param appPath
+ * XML file path
+ * @return File content in string format
+ * @throws Exception
+ */
+ private static String getConfigFileContent( String appPath ) throws Exception
+ {
+ validateConfigFile( appPath );
+
+ InputStream inputStream = null;
+ try
+ {
+ String lstrEncoding = detectEncoding(appPath);
+ if( lstrEncoding == null || lstrEncoding.trim().isEmpty() )
+ {
+ lstrEncoding = "UTF-8";
+ }
+
+ DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
+ builderFactory.setNamespaceAware(false);
+ builderFactory.setValidating(false);
+ DocumentBuilder builder = builderFactory.newDocumentBuilder();
+ inputStream = new FileInputStream(appPath);
+ InputSource lInputSource = new InputSource( inputStream );
+ lInputSource.setEncoding(lstrEncoding);
+ Document document = builder.parse( lInputSource );
+
+
+ TransformerFactory lTransFactory = TransformerFactory.newInstance();
+ Transformer lTrans = lTransFactory.newTransformer();
+ DOMSource lSource = new DOMSource(document);
+ StringWriter lStringWriter = new StringWriter();
+ lTrans.transform( lSource, new StreamResult( lStringWriter ) );
+ return lStringWriter.toString();
+ }
+ catch (Exception e)
+ {
+ System.out.println("*** Config file should be in UTF-16LE encoding ***");
+ e.printStackTrace();
+ System.exit(0);
+ }
+ finally
+ {
+ if(inputStream != null)
+ {
+ try{
+ inputStream.close();
+ }
+ catch(IOException ioException)
+ {
+ //ignore
+ }
+ }
+ }
+ return "";
+ }
+
+ /**
+ * Validates whether the file exists at the given location & has valid BOM format
+ * @param configFilePath
+ * @throws Exception
+ * @return The file object representing the configFilePath
+ */
+ private static File validateConfigFile(String configFilePath) throws Exception
+ {
+
+ if ( configFilePath == null || configFilePath.trim().isEmpty() )
+ {
+ throw new Exception("Configuration File path is not provided.");
+ }
+
+ File file = new File(configFilePath);
+ if ( !file.exists() )
+ {
+ throw new Exception("Configuration File does not exist at '"+ file.getAbsolutePath() + "'");
+ }
+
+ if( !file.isFile() )
+ {
+ throw new Exception("'" + file.getAbsolutePath() + "' is not a file.");
+ }
+
+ // Length 3 is checked to make sure that enough bytes are available for
+ // BOM reading.
+ if (file.length() < 3)
+ {
+ throw new Exception("'" + file.getAbsolutePath() + "' is not a valid configuration file.");
+ }
+ return file;
+ }
+
+ /**
+ * Detect encoding format of file
+ * @param pConfigXmlPath
+ * File path whose encoding type is to be detected
+ * @return encoding format (eg: utf-8, utf-16)
+ */
+ private static String detectEncoding(String configXmlPath)
+ {
+ FileInputStream fis = null;
+ try
+ {
+ fis = new FileInputStream(configXmlPath);
+ UniversalDetector detector = new UniversalDetector(null);
+ byte[] buffer = new byte[512];
+ int read;
+ while( (read = fis.read(buffer)) > 0 && !detector.isDone() )
+ {
+ detector.handleData(buffer, 0, read);
+ }
+ detector.dataEnd();
+ String encoding = detector.getDetectedCharset();
+ detector.reset();
+ return encoding;
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ finally
+ {
+ if ( fis != null)
+ {
+ try
+ {
+ fis.close();
+ } catch (IOException e)
+ {
+ // Igniore
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Terminate the created session and reset the initialized Server SDK library.
+ */
+ public static void terminateWSClient()
+ {
+ try
+ {
+ FSHelperLibrary.logInfo("Terminating FSHelper Library");
+ if(FSHelperLibrary.isTerminated() == false)
+ {
+ System.out.println("FSHelperLibrary.isTerminated(): " + FSHelperLibrary.isTerminated());
+ FSHelperLibrary.terminate();
+ }
+ }
+ catch (FSHelperException e)
+ {
+ FSHelperLibrary.logError(e.getMessage(), e);
+ }
+ }
+
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/src/com/seclore/fs/protect/example/main/SecloreMain.java b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/src/com/seclore/fs/protect/example/main/SecloreMain.java
new file mode 100644
index 0000000..1019a6c
--- /dev/null
+++ b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/src/com/seclore/fs/protect/example/main/SecloreMain.java
@@ -0,0 +1,185 @@
+package com.seclore.fs.protect.example.main;
+
+import java.util.Scanner;
+
+import com.seclore.fs.helper.core.ProtectedFile;
+import com.seclore.fs.helper.enums.ProtectionType;
+import com.seclore.fs.helper.exception.FSHelperException;
+import com.seclore.fs.helper.library.FSHelper;
+import com.seclore.fs.helper.library.FSHelperLibrary;
+import com.seclore.fs.protect.example.core.InitializeWSClient;
+
+public class SecloreMain
+{
+ //# FS Helper library is multi-tenant. Use unique tenant identifier for each tenant
+ private static String tenantID = "Tenant-1";
+
+ //# This file contains information about the Application into which this code snippet is to be integrated.
+ private static final String appConfigXMLFilePath = "config/config.xml";
+
+ //# This file contains info for creating session with Seclore Policy Server and initializing Server SDK library
+ private static final String tenantConfigXMLFilePath = "config/tenant config.xml";
+
+ //# Used to take user input
+ private static Scanner scanner = null;
+
+ /**
+ *
This block initializes the Server SDK library and creates a session with Seclore Policy Server
+ * @exception Code snippet won't run if any exception is thrown in this block.
+ */
+ static
+ {
+ try
+ {
+ InitializeWSClient.initializeHelperLibrary(appConfigXMLFilePath);
+ InitializeWSClient.initializeHelper(tenantID, "", tenantConfigXMLFilePath);
+ scanner = new Scanner(System.in);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ System.exit(0);
+ }
+ }
+
+ //# Entry point to run this application
+ public static void main(String[] args)
+ {
+ try
+ {
+ String outputFilePath = protectAndWrapFile();
+
+ if( outputFilePath != null && !outputFilePath.trim().isEmpty() )
+ {
+
+ System.out.println("File '" + outputFilePath + "' is protected and wrapped successfully");
+ }
+ else
+ {
+ throw new Exception("Unexpected error");
+ }
+
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ finally
+ {
+ if( scanner != null )
+ {
+ scanner.close();
+ }
+
+ InitializeWSClient.terminateWSClient();
+ }
+ }
+
+ /**
+ * Protect and wrap a file using Seclore SDK
+ * @return the absolute file path of protected file
+ * @throws Exception
+ */
+ public static String protectAndWrapFile() throws Exception
+ {
+ System.out.println("Enter absolute path of the file to be protected and wrapped:");
+ String filePath = scanner.nextLine();
+
+ //# get the FSHelper object by specifying the tenantId.
+ //note: This tenant id should be same which was used during initialization of Seclore SDK
+ FSHelper tenantObj = FSHelperLibrary.getHelper(tenantID);
+
+ //# does basic validation checks to see if the file is supported by SDK and is not already protected
+ validateIfFileSupportsProtection(tenantObj, filePath);
+
+ //# used to change display name of file in activity log
+ String displayFileName = filePath;
+ //# get XML structure to protect with hot folder
+ String protectionDetails = getProtectDetailsXML();
+ //# show details about protector
+ String protectorDetails = "";
+ //# activity comments to be shown
+ String actvityComments = "Protected by using FS Helper Library's protectAndWrap method";
+
+ ProtectedFile protectedWrappedFile = tenantObj.protectAndWrap(null,
+ filePath,
+ displayFileName,
+ ProtectionType.PROTECT_WITH_HF,
+ protectionDetails,
+ protectorDetails,
+ actvityComments);
+ System.out.println("Protected File Id: " + protectedWrappedFile.getFileId());
+
+ return protectedWrappedFile.getFilePath();
+ }
+
+ /**
+ * Validates if the file supports Seclore protection
+ *
+ * @param tenantObj - FSHelper object created for the tenant.
+ * @param filePath - Absolute path of the file to be protected.
+ * @throws Exception
+ */
+ private static void validateIfFileSupportsProtection(FSHelper tenantObj, String filePath)
+ throws FSHelperException, Exception
+ {
+ //check if file is already Seclore protected
+ if(tenantObj.isProtectedFile(filePath) || tenantObj.isHTMLWrapped(filePath) )
+ {
+ throw new Exception("File '"+filePath+"' is already protected");
+ }
+
+ //check if file extension is supported by Seclore FS Helper Library
+ if(tenantObj.isSupportedFile(filePath) == false && tenantObj.isBasicProtectionSupported(filePath) == false )
+ {
+ String fileExt = filePath.substring( filePath.lastIndexOf(".")+1 );
+ //note: if file is not of standard format and does not support basic protection then throw error
+ throw new Exception("File with extention '"+fileExt+"' is not supported by Seclore FS Helper Library");
+ }
+
+ //check if file extension is supported for HTML wrapping by Seclore FS Helper Library
+ if(tenantObj.isHTMLWrapSupported(filePath) == false)
+ {
+ //note: file is of standard format but not supported for HTML wrapping
+ throw new Exception("File '"+filePath+"' does not support HTML wrapping");
+ }
+ }
+
+ /**
+ * Forms the protection XML request string to be sent to PS.
+ *
+ * @return protection request XML structure
+ */
+ public static String getProtectDetailsXML() throws Exception
+ {
+ System.out.println("Enter Hot Folder id:");
+ String HFid = scanner.nextLine();
+ String protectionDetailsXML = "" + HFid + "";
+ return protectionDetailsXML;
+ }
+
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Start Here - Protect and Wrap with HF - Enterprise Policy Server.pptx b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Start Here - Protect and Wrap with HF - Enterprise Policy Server.pptx
new file mode 100644
index 0000000..fae909c
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/Start Here - Protect and Wrap with HF - Enterprise Policy Server.pptx differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/scripts/build.sh b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/scripts/build.sh
new file mode 100644
index 0000000..9656467
--- /dev/null
+++ b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/scripts/build.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+set -e
+
+# Set the project root directory
+PROJECT_ROOT=$(dirname "$0")/..
+
+# Clean all bin folders
+rm -rf "$PROJECT_ROOT/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/config"/*
+rm -rf "$PROJECT_ROOT/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib"/*
+
+# Clear the src/bin dir containing compiled class files
+rm -rf "$PROJECT_ROOT/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/bin"/*
+
+#find and compile all java files
+find "$PROJECT_ROOT/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/src" -name "*.java" -exec javac -d "$PROJECT_ROOT/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/bin" -cp "$PROJECT_ROOT/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/lib/*" {} +
+
+# Package the compiled classes into a JAR file
+jar cvf "$PROJECT_ROOT/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/sample-app.jar" -C "$PROJECT_ROOT/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/bin" .
+
+# Copy all libs and config files to bin
+cp -r "$PROJECT_ROOT/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/lib"/* "$PROJECT_ROOT/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib"
+cp -r "$PROJECT_ROOT/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/config"/* "$PROJECT_ROOT/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/config"
\ No newline at end of file
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/scripts/test.sh b/examples/Java/1. Protect & Wrap with Hot Folder/Using Enterprise Policy Server/scripts/test.sh
new file mode 100644
index 0000000..e69de29
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Protect and Wrap Sample Code Walkthrough.mp4 b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Protect and Wrap Sample Code Walkthrough.mp4
new file mode 100644
index 0000000..6384ea3
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Protect and Wrap Sample Code Walkthrough.mp4 differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code Configuration Details.xlsx b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code Configuration Details.xlsx
new file mode 100644
index 0000000..97632a6
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code Configuration Details.xlsx differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/Readme.txt b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/Readme.txt
new file mode 100644
index 0000000..c798d20
--- /dev/null
+++ b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/Readme.txt
@@ -0,0 +1,24 @@
+
+Protect With Hot Folder and Wrap Sample App
+============================================
+
+Deployment Steps:
+------------------
+
+1. make sure your policy server is running . This app requires java 8 or above to run so make
+ sure java 8 or above is installed.
+
+2. go inside 'bin/Protect With Hot Folder and Wrap Sample App'
+
+3. Configure the 'tenant config.xml' in 'config/'
+ a. Policy Server Details:
+ server : Server name on which Policy Server is running
+ port : Server Port on which Policy Server is running
+ app-name : Policy Server application name
+
+ b. fill hot folder details i.e id and passphrase
+
+4. If you are using java 8 , put libs present inside 'doc/JCE Files/java8' into
+ 'bin/Protect With Hot Folder and Wrap Sample App/lib'
+
+5. click on run.bat to start sample app , follow instruction on terminal
\ No newline at end of file
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/config/config.xml b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/config/config.xml
new file mode 100644
index 0000000..b148308
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/config/config.xml differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/config/log4j.properties b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/config/log4j.properties
new file mode 100644
index 0000000..8293be6
--- /dev/null
+++ b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/config/log4j.properties
@@ -0,0 +1,15 @@
+
+log4j.category.WSCLIENT=debug, WSCLIENT
+
+# If we want to change the Appender, we have to change
+# UtilFunction.initializeLoggers() too, because it assumes that the appender
+# is 'org.apache.log4j.RollingFileAppender' and changes path of the file by
+# getting appender from this logger.
+log4j.appender.WSCLIENT=com.seclore.fs.ws.client.logger.DailyZippedRollingFileAppender
+# Path of the file should be relative to application ROOT
+log4j.appender.WSCLIENT.File=logs/WSClient.log
+log4j.appender.WSCLIENT.MaxFileSize=10MB
+#log4j.appender.REQUEST_LOGGER.MaxBackupIndex=10
+log4j.appender.WSCLIENT.DatePattern='_'yyyy-MM-dd
+log4j.appender.WSCLIENT.layout=org.apache.log4j.PatternLayout
+log4j.appender.WSCLIENT.layout.ConversionPattern=%d{MMM dd, yyyy HH:mm:ss.SSS} %F:%L%n%p: %m%n
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/config/log4j2.xml b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/config/log4j2.xml
new file mode 100644
index 0000000..6902efe
--- /dev/null
+++ b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/config/log4j2.xml
@@ -0,0 +1,43 @@
+
+
+
+
+
+ ${ctx:applicationPath}/logs
+
+
+
+
+
+
+
+
+
+
+
+
+ UTF-8
+ %d{MMM dd, yyyy HH:mm:ss.SSS} :%t %n%p: %m%n
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/config/tenant config.xml b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/config/tenant config.xml
new file mode 100644
index 0000000..a88ffcc
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/config/tenant config.xml differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/bc-fips-1.0.0.jar b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/bc-fips-1.0.0.jar
new file mode 100644
index 0000000..321e563
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/bc-fips-1.0.0.jar differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/commons-codec-1.6.jar b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/commons-codec-1.6.jar
new file mode 100644
index 0000000..ee1bc49
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/commons-codec-1.6.jar differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/disruptor-3.3.7.jar b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/disruptor-3.3.7.jar
new file mode 100644
index 0000000..1777a37
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/disruptor-3.3.7.jar differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/fs-smaillibrary.jar b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/fs-smaillibrary.jar
new file mode 100644
index 0000000..aa95e22
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/fs-smaillibrary.jar differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/fs-ws-client-4.4.7.jar b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/fs-ws-client-4.4.7.jar
new file mode 100644
index 0000000..bf2adcf
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/fs-ws-client-4.4.7.jar differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/juniversalchardet-1.0.3.jar b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/juniversalchardet-1.0.3.jar
new file mode 100644
index 0000000..1af703f
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/juniversalchardet-1.0.3.jar differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/log4j-1.2.14.jar b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/log4j-1.2.14.jar
new file mode 100644
index 0000000..6251307
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/log4j-1.2.14.jar differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/log4j-api-2.10.0.jar b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/log4j-api-2.10.0.jar
new file mode 100644
index 0000000..9603b1b
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/log4j-api-2.10.0.jar differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/log4j-core-2.10.0.jar b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/log4j-core-2.10.0.jar
new file mode 100644
index 0000000..1be9e67
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/log4j-core-2.10.0.jar differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/sample-app.jar b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/sample-app.jar
new file mode 100644
index 0000000..c818696
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/sample-app.jar differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/xercesImpl-X.jar b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/xercesImpl-X.jar
new file mode 100644
index 0000000..38fca83
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/xercesImpl-X.jar differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/logs/WSClient.log b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/logs/WSClient.log
new file mode 100644
index 0000000..d2f66ca
--- /dev/null
+++ b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/logs/WSClient.log
@@ -0,0 +1,7 @@
+FileSecure Version is 4.4.7.0
+Jul 19, 2021 12:12:16.897 :main
+INFO: WSCLIENT logger is initialized
+Jul 19, 2021 12:12:16.903 :main
+INFO: -1SDK Logger is initialized
+Jul 19, 2021 12:12:16.904 :main
+INFO: -1FSHelperLibrary::initializeSuccessfully Initialized helper library.
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/run.bat b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/run.bat
new file mode 100644
index 0000000..45ecf70
--- /dev/null
+++ b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/run.bat
@@ -0,0 +1,18 @@
+@echo off
+set "CURRENT_DIR=%cd%"
+echo ---------------------------------------------------------
+echo Seclore 'Protect with Hot Folder Wrap Sample App' Utility
+echo ---------------------------------------------------------
+echo.
+
+rem if your want to run on a different jdk or java path is not configured uncomment below line
+rem for example ,
+rem set path="C:\Program Files\Java\jdk-11.0.1\bin";
+java -version
+echo.
+
+REM uncomment below line to see the version of sample app i.e( remove REM mentioned below)
+REM java -cp "./lib/sample-app.jar"; com.seclore.fs.protect.example.Version
+
+ java -cp "./lib/*"; com.seclore.fs.protect.example.main.SecloreMain
+pause
\ No newline at end of file
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/doc/Developer_s Reference.txt b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/doc/Developer_s Reference.txt
new file mode 100644
index 0000000..d49ade4
--- /dev/null
+++ b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/doc/Developer_s Reference.txt
@@ -0,0 +1,37 @@
+FileSecure Interfaces integration source code reference.
+
+FS Helper Initialization
+------------------------
+ - At application startup initializing FSHelperlibrary and FSHelper
+ - Below classes are used for the same
+ - SecloreMain
+ - static block :-
+ InitializeWSClient.initializeHelperLibrary((FSHELPERLIBRARY_CONFIG_XML_PATH, ););
+ InitializeWSClient.initializeHelper(HELPER_INSTANCE_KEY, FSHELPER_RESOURCE_PATH, FSHELPER_CONFIG_XML_PATH, );
+ - InitializeWSClient
+ - initializeHelperLibrary( ... )
+ - initializeHelper( ... )
+
+
+
+Main Class
+------------
+ - com.seclore.fs.protect.example.main
+ - SecloreMain class
+
+Note:
+=====
+while preparing xml string for request or response. please escape below spacial character for the string which will be written within xml tag.
+ "&" -> "&"
+ "<" -> "<"
+ ">", -> ">"
+ "\"" -> """
+ "'" -> "'";
+
+ Refer: com.seclore.fs.protect.example.util.XMLUtil class and
+ - escapeForXML () method
+
+Example: sample xml is "Sample Sales & purchase report.pdf"
+ here "Sample Sales and purchase report" should be escaped.
+ Use: String fileName = XMLHelper.escapeForXML( "Sample Sales & purchase report" );
+ ""+fileName+""
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/doc/JCE Files/Java7/US_export_policy.jar b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/doc/JCE Files/Java7/US_export_policy.jar
new file mode 100644
index 0000000..7173213
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/doc/JCE Files/Java7/US_export_policy.jar differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/doc/JCE Files/Java7/local_policy.jar b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/doc/JCE Files/Java7/local_policy.jar
new file mode 100644
index 0000000..c34d036
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/doc/JCE Files/Java7/local_policy.jar differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/doc/JCE Files/Java8/US_export_policy.jar b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/doc/JCE Files/Java8/US_export_policy.jar
new file mode 100644
index 0000000..251b102
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/doc/JCE Files/Java8/US_export_policy.jar differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/doc/JCE Files/Java8/local_policy.jar b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/doc/JCE Files/Java8/local_policy.jar
new file mode 100644
index 0000000..1c58939
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/doc/JCE Files/Java8/local_policy.jar differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/.classpath b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/.classpath
new file mode 100644
index 0000000..8960a2e
--- /dev/null
+++ b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/.classpath
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/.project b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/.project
new file mode 100644
index 0000000..5160502
--- /dev/null
+++ b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/.project
@@ -0,0 +1,17 @@
+
+
+ Protect With Hot Folder and Wrap Sample App Code
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+
+
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/.settings/org.eclipse.jdt.core.prefs b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..3a21537
--- /dev/null
+++ b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,11 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/bin/com/seclore/fs/protect/example/Version.class b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/bin/com/seclore/fs/protect/example/Version.class
new file mode 100644
index 0000000..694b590
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/bin/com/seclore/fs/protect/example/Version.class differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/bin/com/seclore/fs/protect/example/core/InitializeWSClient.class b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/bin/com/seclore/fs/protect/example/core/InitializeWSClient.class
new file mode 100644
index 0000000..7229984
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/bin/com/seclore/fs/protect/example/core/InitializeWSClient.class differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/bin/com/seclore/fs/protect/example/main/SecloreMain.class b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/bin/com/seclore/fs/protect/example/main/SecloreMain.class
new file mode 100644
index 0000000..692e504
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/bin/com/seclore/fs/protect/example/main/SecloreMain.class differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/config/config.xml b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/config/config.xml
new file mode 100644
index 0000000..610e0c5
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/config/config.xml differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/config/log4j.properties b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/config/log4j.properties
new file mode 100644
index 0000000..8293be6
--- /dev/null
+++ b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/config/log4j.properties
@@ -0,0 +1,15 @@
+
+log4j.category.WSCLIENT=debug, WSCLIENT
+
+# If we want to change the Appender, we have to change
+# UtilFunction.initializeLoggers() too, because it assumes that the appender
+# is 'org.apache.log4j.RollingFileAppender' and changes path of the file by
+# getting appender from this logger.
+log4j.appender.WSCLIENT=com.seclore.fs.ws.client.logger.DailyZippedRollingFileAppender
+# Path of the file should be relative to application ROOT
+log4j.appender.WSCLIENT.File=logs/WSClient.log
+log4j.appender.WSCLIENT.MaxFileSize=10MB
+#log4j.appender.REQUEST_LOGGER.MaxBackupIndex=10
+log4j.appender.WSCLIENT.DatePattern='_'yyyy-MM-dd
+log4j.appender.WSCLIENT.layout=org.apache.log4j.PatternLayout
+log4j.appender.WSCLIENT.layout.ConversionPattern=%d{MMM dd, yyyy HH:mm:ss.SSS} %F:%L%n%p: %m%n
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/config/log4j2.xml b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/config/log4j2.xml
new file mode 100644
index 0000000..b6b5b0e
--- /dev/null
+++ b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/config/log4j2.xml
@@ -0,0 +1,43 @@
+
+
+
+
+
+ ${ctx:applicationPath}/logs
+
+
+
+
+
+
+
+
+
+
+
+
+ UTF-8
+ %d{MMM dd, yyyy HH:mm:ss.SSS}: %t: %p: %m%n
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/config/tenant config.xml b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/config/tenant config.xml
new file mode 100644
index 0000000..44e9b77
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/config/tenant config.xml differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/lib/bc-fips-1.0.2.3.jar b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/lib/bc-fips-1.0.2.3.jar
new file mode 100644
index 0000000..1a8c5de
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/lib/bc-fips-1.0.2.3.jar differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/lib/commons-codec-1.6.jar b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/lib/commons-codec-1.6.jar
new file mode 100644
index 0000000..ee1bc49
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/lib/commons-codec-1.6.jar differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/lib/disruptor-3.3.7.jar b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/lib/disruptor-3.3.7.jar
new file mode 100644
index 0000000..1777a37
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/lib/disruptor-3.3.7.jar differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/lib/fs-smaillibrary.jar b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/lib/fs-smaillibrary.jar
new file mode 100644
index 0000000..0cb2298
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/lib/fs-smaillibrary.jar differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/lib/fs-ws-client.jar b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/lib/fs-ws-client.jar
new file mode 100644
index 0000000..cbda191
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/lib/fs-ws-client.jar differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/lib/juniversalchardet-1.0.3.jar b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/lib/juniversalchardet-1.0.3.jar
new file mode 100644
index 0000000..1af703f
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/lib/juniversalchardet-1.0.3.jar differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/lib/log4j-api-2.17.1.jar b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/lib/log4j-api-2.17.1.jar
new file mode 100644
index 0000000..1aae243
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/lib/log4j-api-2.17.1.jar differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/lib/log4j-core-2.17.1.jar b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/lib/log4j-core-2.17.1.jar
new file mode 100644
index 0000000..4682527
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/lib/log4j-core-2.17.1.jar differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/lib/seclore-io-1.0.0.0.jar b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/lib/seclore-io-1.0.0.0.jar
new file mode 100644
index 0000000..365237b
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/lib/seclore-io-1.0.0.0.jar differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/lib/xercesImpl-X.jar b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/lib/xercesImpl-X.jar
new file mode 100644
index 0000000..38fca83
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/lib/xercesImpl-X.jar differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/src/com/seclore/fs/protect/example/Version.java b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/src/com/seclore/fs/protect/example/Version.java
new file mode 100644
index 0000000..df17df2
--- /dev/null
+++ b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/src/com/seclore/fs/protect/example/Version.java
@@ -0,0 +1,23 @@
+package com.seclore.fs.protect.example;
+
+/**
+ * Represents the Sample App version.
+ */
+public class Version
+{
+ /**
+ * The version of the Sample App.
+ */
+ public static final String Version = "3.0.0.0";
+
+ /**
+ * Displays the version of the Sample App
+ *
+ * @param args
+ */
+ public static void main(String[] args)
+ {
+ System.out.println("Sample App version : " + Version);
+ System.out.println("Copyright (c) 2008 Seclore Technology Pvt. Ltd.");
+ }
+}
\ No newline at end of file
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/src/com/seclore/fs/protect/example/core/InitializeWSClient.java b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/src/com/seclore/fs/protect/example/core/InitializeWSClient.java
new file mode 100644
index 0000000..2a5e4c2
--- /dev/null
+++ b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/src/com/seclore/fs/protect/example/core/InitializeWSClient.java
@@ -0,0 +1,238 @@
+package com.seclore.fs.protect.example.core;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringWriter;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.mozilla.universalchardet.UniversalDetector;
+import org.w3c.dom.Document;
+import org.xml.sax.InputSource;
+
+import com.seclore.fs.helper.exception.FSHelperException;
+import com.seclore.fs.helper.library.FSHelperLibrary;
+
+public class InitializeWSClient
+{
+ /**
+ * @param configPath
+ * Takes the application config file path as input
+ * @throws Exception
+ */
+ public static void initializeHelperLibrary(String configPath) throws Exception
+ {
+ try
+ {
+ String configContentXMLString = getConfigFileContent(configPath);
+ // Initialize method takes WSClient config content not the config file path.
+ FSHelperLibrary.initialize(configContentXMLString);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @param helperId
+ * Tenant Id
+ * @param helperResourcePath
+ * Resource Path for files of Seclore Policy Server. To be left empty here.
+ * @param helperConfigPath
+ * File path for 'tenant config.xml' file
+ * @throws Exception
+ * Code snippet won't run if any exception is thrown in this block
+ */
+ public static void initializeHelper(String helperId, String helperResourcePath, String helperConfigPath) throws Exception
+ {
+ try
+ {
+ String configContentXMLString = getConfigFileContent( helperConfigPath );
+ // Initialize method takes WSClient config content not the config file path.
+ FSHelperLibrary.initializeHelper(helperId, helperResourcePath, configContentXMLString);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * This method reads an XML file and returns the content of the XML file in string format
+ * @param appPath
+ * XML file path
+ * @return File content in string format
+ * @throws Exception
+ */
+ private static String getConfigFileContent( String appPath ) throws Exception
+ {
+ validateConfigFile( appPath );
+
+ InputStream inputStream = null;
+ try
+ {
+ String lstrEncoding = detectEncoding(appPath);
+ if( lstrEncoding == null || lstrEncoding.trim().isEmpty() )
+ {
+ lstrEncoding = "UTF-8";
+ }
+
+ DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
+ builderFactory.setNamespaceAware(false);
+ builderFactory.setValidating(false);
+ DocumentBuilder builder = builderFactory.newDocumentBuilder();
+ inputStream = new FileInputStream(appPath);
+ InputSource lInputSource = new InputSource( inputStream );
+ lInputSource.setEncoding(lstrEncoding);
+ Document document = builder.parse( lInputSource );
+
+
+ TransformerFactory lTransFactory = TransformerFactory.newInstance();
+ Transformer lTrans = lTransFactory.newTransformer();
+ DOMSource lSource = new DOMSource(document);
+ StringWriter lStringWriter = new StringWriter();
+ lTrans.transform( lSource, new StreamResult( lStringWriter ) );
+ return lStringWriter.toString();
+ }
+ catch (Exception e)
+ {
+ System.out.println("*** Config file should be in UTF-16LE encoding ***");
+ e.printStackTrace();
+ System.exit(0);
+ }
+ finally
+ {
+ if(inputStream != null)
+ {
+ try{
+ inputStream.close();
+ }
+ catch(IOException ioException)
+ {
+ //ignore
+ }
+ }
+ }
+ return "";
+ }
+
+ /**
+ * Validates whether the file exists at the given location & has valid BOM format
+ * @param configFilePath
+ * @throws Exception
+ * @return The file object representing the configFilePath
+ */
+ private static File validateConfigFile(String configFilePath) throws Exception
+ {
+
+ if ( configFilePath == null || configFilePath.trim().isEmpty() )
+ {
+ throw new Exception("Configuration File path is not provided.");
+ }
+
+ File file = new File(configFilePath);
+ if ( !file.exists() )
+ {
+ throw new Exception("Configuration File does not exist at '"+ file.getAbsolutePath() + "'");
+ }
+
+ if( !file.isFile() )
+ {
+ throw new Exception("'" + file.getAbsolutePath() + "' is not a file.");
+ }
+
+ // Length 3 is checked to make sure that enough bytes are available for
+ // BOM reading.
+ if (file.length() < 3)
+ {
+ throw new Exception("'" + file.getAbsolutePath() + "' is not a valid configuration file.");
+ }
+ return file;
+ }
+
+ /**
+ * Detect encoding format of file
+ * @param pConfigXmlPath
+ * File path whose encoding type is to be detected
+ * @return encoding format (eg: utf-8, utf-16)
+ */
+ private static String detectEncoding(String configXmlPath)
+ {
+ FileInputStream fis = null;
+ try
+ {
+ fis = new FileInputStream(configXmlPath);
+ UniversalDetector detector = new UniversalDetector(null);
+ byte[] buffer = new byte[512];
+ int read;
+ while( (read = fis.read(buffer)) > 0 && !detector.isDone() )
+ {
+ detector.handleData(buffer, 0, read);
+ }
+ detector.dataEnd();
+ String encoding = detector.getDetectedCharset();
+ detector.reset();
+ return encoding;
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ finally
+ {
+ if ( fis != null)
+ {
+ try
+ {
+ fis.close();
+ } catch (IOException e)
+ {
+ // Igniore
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Terminate the created session and reset the initialized Server SDK library.
+ */
+ public static void terminateWSClient()
+ {
+ try
+ {
+ FSHelperLibrary.logInfo("Terminating FSHelper Library");
+ if(FSHelperLibrary.isTerminated() == false)
+ {
+ System.out.println("FSHelperLibrary.isTerminated(): " + FSHelperLibrary.isTerminated());
+ FSHelperLibrary.terminate();
+ }
+ }
+ catch (FSHelperException e)
+ {
+ FSHelperLibrary.logError(e.getMessage(), e);
+ }
+ }
+
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/src/com/seclore/fs/protect/example/main/SecloreMain.java b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/src/com/seclore/fs/protect/example/main/SecloreMain.java
new file mode 100644
index 0000000..1019a6c
--- /dev/null
+++ b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/src/com/seclore/fs/protect/example/main/SecloreMain.java
@@ -0,0 +1,185 @@
+package com.seclore.fs.protect.example.main;
+
+import java.util.Scanner;
+
+import com.seclore.fs.helper.core.ProtectedFile;
+import com.seclore.fs.helper.enums.ProtectionType;
+import com.seclore.fs.helper.exception.FSHelperException;
+import com.seclore.fs.helper.library.FSHelper;
+import com.seclore.fs.helper.library.FSHelperLibrary;
+import com.seclore.fs.protect.example.core.InitializeWSClient;
+
+public class SecloreMain
+{
+ //# FS Helper library is multi-tenant. Use unique tenant identifier for each tenant
+ private static String tenantID = "Tenant-1";
+
+ //# This file contains information about the Application into which this code snippet is to be integrated.
+ private static final String appConfigXMLFilePath = "config/config.xml";
+
+ //# This file contains info for creating session with Seclore Policy Server and initializing Server SDK library
+ private static final String tenantConfigXMLFilePath = "config/tenant config.xml";
+
+ //# Used to take user input
+ private static Scanner scanner = null;
+
+ /**
+ *
This block initializes the Server SDK library and creates a session with Seclore Policy Server
+ * @exception Code snippet won't run if any exception is thrown in this block.
+ */
+ static
+ {
+ try
+ {
+ InitializeWSClient.initializeHelperLibrary(appConfigXMLFilePath);
+ InitializeWSClient.initializeHelper(tenantID, "", tenantConfigXMLFilePath);
+ scanner = new Scanner(System.in);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ System.exit(0);
+ }
+ }
+
+ //# Entry point to run this application
+ public static void main(String[] args)
+ {
+ try
+ {
+ String outputFilePath = protectAndWrapFile();
+
+ if( outputFilePath != null && !outputFilePath.trim().isEmpty() )
+ {
+
+ System.out.println("File '" + outputFilePath + "' is protected and wrapped successfully");
+ }
+ else
+ {
+ throw new Exception("Unexpected error");
+ }
+
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ finally
+ {
+ if( scanner != null )
+ {
+ scanner.close();
+ }
+
+ InitializeWSClient.terminateWSClient();
+ }
+ }
+
+ /**
+ * Protect and wrap a file using Seclore SDK
+ * @return the absolute file path of protected file
+ * @throws Exception
+ */
+ public static String protectAndWrapFile() throws Exception
+ {
+ System.out.println("Enter absolute path of the file to be protected and wrapped:");
+ String filePath = scanner.nextLine();
+
+ //# get the FSHelper object by specifying the tenantId.
+ //note: This tenant id should be same which was used during initialization of Seclore SDK
+ FSHelper tenantObj = FSHelperLibrary.getHelper(tenantID);
+
+ //# does basic validation checks to see if the file is supported by SDK and is not already protected
+ validateIfFileSupportsProtection(tenantObj, filePath);
+
+ //# used to change display name of file in activity log
+ String displayFileName = filePath;
+ //# get XML structure to protect with hot folder
+ String protectionDetails = getProtectDetailsXML();
+ //# show details about protector
+ String protectorDetails = "";
+ //# activity comments to be shown
+ String actvityComments = "Protected by using FS Helper Library's protectAndWrap method";
+
+ ProtectedFile protectedWrappedFile = tenantObj.protectAndWrap(null,
+ filePath,
+ displayFileName,
+ ProtectionType.PROTECT_WITH_HF,
+ protectionDetails,
+ protectorDetails,
+ actvityComments);
+ System.out.println("Protected File Id: " + protectedWrappedFile.getFileId());
+
+ return protectedWrappedFile.getFilePath();
+ }
+
+ /**
+ * Validates if the file supports Seclore protection
+ *
+ * @param tenantObj - FSHelper object created for the tenant.
+ * @param filePath - Absolute path of the file to be protected.
+ * @throws Exception
+ */
+ private static void validateIfFileSupportsProtection(FSHelper tenantObj, String filePath)
+ throws FSHelperException, Exception
+ {
+ //check if file is already Seclore protected
+ if(tenantObj.isProtectedFile(filePath) || tenantObj.isHTMLWrapped(filePath) )
+ {
+ throw new Exception("File '"+filePath+"' is already protected");
+ }
+
+ //check if file extension is supported by Seclore FS Helper Library
+ if(tenantObj.isSupportedFile(filePath) == false && tenantObj.isBasicProtectionSupported(filePath) == false )
+ {
+ String fileExt = filePath.substring( filePath.lastIndexOf(".")+1 );
+ //note: if file is not of standard format and does not support basic protection then throw error
+ throw new Exception("File with extention '"+fileExt+"' is not supported by Seclore FS Helper Library");
+ }
+
+ //check if file extension is supported for HTML wrapping by Seclore FS Helper Library
+ if(tenantObj.isHTMLWrapSupported(filePath) == false)
+ {
+ //note: file is of standard format but not supported for HTML wrapping
+ throw new Exception("File '"+filePath+"' does not support HTML wrapping");
+ }
+ }
+
+ /**
+ * Forms the protection XML request string to be sent to PS.
+ *
+ * @return protection request XML structure
+ */
+ public static String getProtectDetailsXML() throws Exception
+ {
+ System.out.println("Enter Hot Folder id:");
+ String HFid = scanner.nextLine();
+ String protectionDetailsXML = "" + HFid + "";
+ return protectionDetailsXML;
+ }
+
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Start Here - Protect and Wrap with HF - Seclore Cloud Policy Server.pptx b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Start Here - Protect and Wrap with HF - Seclore Cloud Policy Server.pptx
new file mode 100644
index 0000000..dc91b64
Binary files /dev/null and b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/Start Here - Protect and Wrap with HF - Seclore Cloud Policy Server.pptx differ
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/scripts/build.sh b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/scripts/build.sh
new file mode 100644
index 0000000..9656467
--- /dev/null
+++ b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/scripts/build.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+set -e
+
+# Set the project root directory
+PROJECT_ROOT=$(dirname "$0")/..
+
+# Clean all bin folders
+rm -rf "$PROJECT_ROOT/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/config"/*
+rm -rf "$PROJECT_ROOT/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib"/*
+
+# Clear the src/bin dir containing compiled class files
+rm -rf "$PROJECT_ROOT/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/bin"/*
+
+#find and compile all java files
+find "$PROJECT_ROOT/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/src" -name "*.java" -exec javac -d "$PROJECT_ROOT/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/bin" -cp "$PROJECT_ROOT/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/lib/*" {} +
+
+# Package the compiled classes into a JAR file
+jar cvf "$PROJECT_ROOT/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib/sample-app.jar" -C "$PROJECT_ROOT/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/bin" .
+
+# Copy all libs and config files to bin
+cp -r "$PROJECT_ROOT/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/lib"/* "$PROJECT_ROOT/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/lib"
+cp -r "$PROJECT_ROOT/Sample Code/src/Protect With Hot Folder and Wrap Sample App Code/config"/* "$PROJECT_ROOT/Sample Code/bin/Protect With Hot Folder and Wrap Sample App/config"
\ No newline at end of file
diff --git a/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/scripts/test.sh b/examples/Java/1. Protect & Wrap with Hot Folder/Using Seclore PoC Policy Server/scripts/test.sh
new file mode 100644
index 0000000..e69de29
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/FSRighstsCalculator.html b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/FSRighstsCalculator.html
new file mode 100644
index 0000000..20c67d1
--- /dev/null
+++ b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/FSRighstsCalculator.html
@@ -0,0 +1,90 @@
+
+
+
+
+
+
+
+
+
FileSecure Rights Calculator
+
+
(primary access rights)
+
+
+ Final:
+
+
+
+
View
+
Lite Viewer
+
Edit
+
Copy Data
+
Print
+
Screen Capture
+
Macro
+
Full Control
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code Walkthrough.mp4 b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code Walkthrough.mp4
new file mode 100644
index 0000000..f272a55
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code Walkthrough.mp4 differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/Readme.txt b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/Readme.txt
new file mode 100644
index 0000000..5e1f885
--- /dev/null
+++ b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/Readme.txt
@@ -0,0 +1,30 @@
+
+Protect With Independent Rights & Wrap Sample App
+==================================================
+
+
+Deployment Steps:
+------------------
+1. make sure your policy server is running . This app requires java 8 or above to run so make
+ sure java 8 or above is installed.
+
+2. go inside 'bin/Protect With Independent Rights & Wrap Sample App'
+
+3. Configure the 'tenant config.xml' in 'config/'
+ a. Policy Server Details:
+ server : Server name on which Policy Server is running
+ port : Server Port on which Policy Server is running
+ app-name : Policy Server application name
+
+ b. fill hot folder details i.e id and passphrase
+
+3. Configure the config.properties in 'config/'
+
+4. If you are using java 8 , put libs present inside 'doc/JCE Files/java8' into
+ 'bin/Protect With Independent Rights & Wrap Sample App/lib'
+
+4. click on run.bat to start sample app , follow instruction on terminal
+
+5. The independent rights given to each user are numeric values.Use
+ the 'FSRighstsCalculator.html' present inside the 'doc' folder to
+ calculate right's value.
\ No newline at end of file
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/config/config.properties b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/config/config.properties
new file mode 100644
index 0000000..d824b9a
--- /dev/null
+++ b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/config/config.properties
@@ -0,0 +1,6 @@
+#Other Rights to be applied on file, refer FSRighstsCalculator.html for primary.access.right.
+offline=0
+redistribute=0
+lock.to.first.machine=0
+no.of.days.since.protection=-1
+no.of.days.since.first.access=-1
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/config/config.xml b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/config/config.xml
new file mode 100644
index 0000000..b148308
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/config/config.xml differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/config/log4j.properties b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/config/log4j.properties
new file mode 100644
index 0000000..8293be6
--- /dev/null
+++ b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/config/log4j.properties
@@ -0,0 +1,15 @@
+
+log4j.category.WSCLIENT=debug, WSCLIENT
+
+# If we want to change the Appender, we have to change
+# UtilFunction.initializeLoggers() too, because it assumes that the appender
+# is 'org.apache.log4j.RollingFileAppender' and changes path of the file by
+# getting appender from this logger.
+log4j.appender.WSCLIENT=com.seclore.fs.ws.client.logger.DailyZippedRollingFileAppender
+# Path of the file should be relative to application ROOT
+log4j.appender.WSCLIENT.File=logs/WSClient.log
+log4j.appender.WSCLIENT.MaxFileSize=10MB
+#log4j.appender.REQUEST_LOGGER.MaxBackupIndex=10
+log4j.appender.WSCLIENT.DatePattern='_'yyyy-MM-dd
+log4j.appender.WSCLIENT.layout=org.apache.log4j.PatternLayout
+log4j.appender.WSCLIENT.layout.ConversionPattern=%d{MMM dd, yyyy HH:mm:ss.SSS} %F:%L%n%p: %m%n
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/config/log4j2.xml b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/config/log4j2.xml
new file mode 100644
index 0000000..b6b5b0e
--- /dev/null
+++ b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/config/log4j2.xml
@@ -0,0 +1,43 @@
+
+
+
+
+
+ ${ctx:applicationPath}/logs
+
+
+
+
+
+
+
+
+
+
+
+
+ UTF-8
+ %d{MMM dd, yyyy HH:mm:ss.SSS}: %t: %p: %m%n
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/config/tenant config.xml b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/config/tenant config.xml
new file mode 100644
index 0000000..da18b33
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/config/tenant config.xml differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/lib/bc-fips-1.0.0.jar b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/lib/bc-fips-1.0.0.jar
new file mode 100644
index 0000000..321e563
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/lib/bc-fips-1.0.0.jar differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/lib/commons-codec-1.6.jar b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/lib/commons-codec-1.6.jar
new file mode 100644
index 0000000..ee1bc49
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/lib/commons-codec-1.6.jar differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/lib/disruptor-3.3.7.jar b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/lib/disruptor-3.3.7.jar
new file mode 100644
index 0000000..1777a37
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/lib/disruptor-3.3.7.jar differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/lib/fs-smaillibrary.jar b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/lib/fs-smaillibrary.jar
new file mode 100644
index 0000000..aa95e22
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/lib/fs-smaillibrary.jar differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/lib/fs-ws-client-4.4.7.jar b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/lib/fs-ws-client-4.4.7.jar
new file mode 100644
index 0000000..bf2adcf
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/lib/fs-ws-client-4.4.7.jar differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/lib/juniversalchardet-1.0.3.jar b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/lib/juniversalchardet-1.0.3.jar
new file mode 100644
index 0000000..1af703f
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/lib/juniversalchardet-1.0.3.jar differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/lib/log4j-1.2.14.jar b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/lib/log4j-1.2.14.jar
new file mode 100644
index 0000000..6251307
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/lib/log4j-1.2.14.jar differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/lib/log4j-api-2.10.0.jar b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/lib/log4j-api-2.10.0.jar
new file mode 100644
index 0000000..9603b1b
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/lib/log4j-api-2.10.0.jar differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/lib/log4j-core-2.10.0.jar b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/lib/log4j-core-2.10.0.jar
new file mode 100644
index 0000000..1be9e67
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/lib/log4j-core-2.10.0.jar differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/lib/sample-app.jar b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/lib/sample-app.jar
new file mode 100644
index 0000000..c26578f
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/lib/sample-app.jar differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/lib/xercesImpl-X.jar b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/lib/xercesImpl-X.jar
new file mode 100644
index 0000000..38fca83
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/lib/xercesImpl-X.jar differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/logs/WSClient.log b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/logs/WSClient.log
new file mode 100644
index 0000000..4309fed
--- /dev/null
+++ b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/logs/WSClient.log
@@ -0,0 +1,4 @@
+FileSecure Version is 4.4.7.0
+Jul 19, 2021 12:11:50.990: main: INFO: WSCLIENT logger is initialized
+Jul 19, 2021 12:11:50.996: main: INFO: -1SDK Logger is initialized
+Jul 19, 2021 12:11:50.998: main: INFO: -1FSHelperLibrary::initializeSuccessfully Initialized helper library.
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/run.bat b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/run.bat
new file mode 100644
index 0000000..47f1076
--- /dev/null
+++ b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/run.bat
@@ -0,0 +1,17 @@
+@echo off
+set "CURRENT_DIR=%cd%"
+echo ---------------------------------------------------------------------
+echo Seclore 'Protect with Independent Rights And Wrap Sample App' Utility
+echo ---------------------------------------------------------------------
+echo.
+
+rem if your want to run on a different jdk or java path is not configured uncomment below line
+rem for example ,
+rem path="C:\Program Files\Java\jdk-11.0.1\bin";
+java -version
+echo.
+
+REM uncomment below line to see the version of sample app i.e( remove REM mentioned below)
+REM java -cp "./lib/sample-app.jar"; com.seclore.fs.protect.example.Version
+ java -cp "./lib/*"; com.seclore.fs.protect.example.main.SecloreMain
+pause
\ No newline at end of file
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/doc/Developer_s Reference.txt b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/doc/Developer_s Reference.txt
new file mode 100644
index 0000000..d49ade4
--- /dev/null
+++ b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/doc/Developer_s Reference.txt
@@ -0,0 +1,37 @@
+FileSecure Interfaces integration source code reference.
+
+FS Helper Initialization
+------------------------
+ - At application startup initializing FSHelperlibrary and FSHelper
+ - Below classes are used for the same
+ - SecloreMain
+ - static block :-
+ InitializeWSClient.initializeHelperLibrary((FSHELPERLIBRARY_CONFIG_XML_PATH, ););
+ InitializeWSClient.initializeHelper(HELPER_INSTANCE_KEY, FSHELPER_RESOURCE_PATH, FSHELPER_CONFIG_XML_PATH, );
+ - InitializeWSClient
+ - initializeHelperLibrary( ... )
+ - initializeHelper( ... )
+
+
+
+Main Class
+------------
+ - com.seclore.fs.protect.example.main
+ - SecloreMain class
+
+Note:
+=====
+while preparing xml string for request or response. please escape below spacial character for the string which will be written within xml tag.
+ "&" -> "&"
+ "<" -> "<"
+ ">", -> ">"
+ "\"" -> """
+ "'" -> "'";
+
+ Refer: com.seclore.fs.protect.example.util.XMLUtil class and
+ - escapeForXML () method
+
+Example: sample xml is "Sample Sales & purchase report.pdf"
+ here "Sample Sales and purchase report" should be escaped.
+ Use: String fileName = XMLHelper.escapeForXML( "Sample Sales & purchase report" );
+ ""+fileName+""
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/doc/FSRighstsCalculator.html b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/doc/FSRighstsCalculator.html
new file mode 100644
index 0000000..9d405cb
--- /dev/null
+++ b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/doc/FSRighstsCalculator.html
@@ -0,0 +1,90 @@
+
+
+
+
+
+
+
+
+
FileSecure Rights Calculator
+
+
(primary access rights)
+
+
+ Final:
+
+
+
+
View
+
Lite Viewer
+
Edit
+
Copy Data
+
Print
+
Screen Capture
+
Macro
+
Full Control
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/doc/JCE Files/Java7/US_export_policy.jar b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/doc/JCE Files/Java7/US_export_policy.jar
new file mode 100644
index 0000000..7173213
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/doc/JCE Files/Java7/US_export_policy.jar differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/doc/JCE Files/Java7/local_policy.jar b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/doc/JCE Files/Java7/local_policy.jar
new file mode 100644
index 0000000..c34d036
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/doc/JCE Files/Java7/local_policy.jar differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/doc/JCE Files/Java8/US_export_policy.jar b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/doc/JCE Files/Java8/US_export_policy.jar
new file mode 100644
index 0000000..251b102
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/doc/JCE Files/Java8/US_export_policy.jar differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/doc/JCE Files/Java8/local_policy.jar b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/doc/JCE Files/Java8/local_policy.jar
new file mode 100644
index 0000000..1c58939
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/doc/JCE Files/Java8/local_policy.jar differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/.classpath b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/.classpath
new file mode 100644
index 0000000..8960a2e
--- /dev/null
+++ b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/.classpath
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/.project b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/.project
new file mode 100644
index 0000000..496d8fb
--- /dev/null
+++ b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/.project
@@ -0,0 +1,17 @@
+
+
+ Protect With Independent Rights & Wrap Sample Code
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+
+
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/.settings/org.eclipse.jdt.core.prefs b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..3a21537
--- /dev/null
+++ b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,11 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/bin/Version.properties b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/bin/Version.properties
new file mode 100644
index 0000000..adf74cc
--- /dev/null
+++ b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/bin/Version.properties
@@ -0,0 +1 @@
+SAMPLE.APP.VERSION=2.0.0.0
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/bin/com/seclore/fs/protect/example/core/Config.class b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/bin/com/seclore/fs/protect/example/core/Config.class
new file mode 100644
index 0000000..2e35dcf
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/bin/com/seclore/fs/protect/example/core/Config.class differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/bin/com/seclore/fs/protect/example/core/FSEntity.class b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/bin/com/seclore/fs/protect/example/core/FSEntity.class
new file mode 100644
index 0000000..c825cab
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/bin/com/seclore/fs/protect/example/core/FSEntity.class differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/bin/com/seclore/fs/protect/example/core/InitializeWSClient.class b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/bin/com/seclore/fs/protect/example/core/InitializeWSClient.class
new file mode 100644
index 0000000..5efd6ab
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/bin/com/seclore/fs/protect/example/core/InitializeWSClient.class differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/bin/com/seclore/fs/protect/example/main/SecloreMain.class b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/bin/com/seclore/fs/protect/example/main/SecloreMain.class
new file mode 100644
index 0000000..994cdc4
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/bin/com/seclore/fs/protect/example/main/SecloreMain.class differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/bin/com/seclore/fs/protect/example/util/XMLUtil.class b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/bin/com/seclore/fs/protect/example/util/XMLUtil.class
new file mode 100644
index 0000000..f1f107e
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/bin/com/seclore/fs/protect/example/util/XMLUtil.class differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/config/config.properties b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/config/config.properties
new file mode 100644
index 0000000..d824b9a
--- /dev/null
+++ b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/config/config.properties
@@ -0,0 +1,6 @@
+#Other Rights to be applied on file, refer FSRighstsCalculator.html for primary.access.right.
+offline=0
+redistribute=0
+lock.to.first.machine=0
+no.of.days.since.protection=-1
+no.of.days.since.first.access=-1
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/config/config.xml b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/config/config.xml
new file mode 100644
index 0000000..610e0c5
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/config/config.xml differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/config/log4j.properties b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/config/log4j.properties
new file mode 100644
index 0000000..8293be6
--- /dev/null
+++ b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/config/log4j.properties
@@ -0,0 +1,15 @@
+
+log4j.category.WSCLIENT=debug, WSCLIENT
+
+# If we want to change the Appender, we have to change
+# UtilFunction.initializeLoggers() too, because it assumes that the appender
+# is 'org.apache.log4j.RollingFileAppender' and changes path of the file by
+# getting appender from this logger.
+log4j.appender.WSCLIENT=com.seclore.fs.ws.client.logger.DailyZippedRollingFileAppender
+# Path of the file should be relative to application ROOT
+log4j.appender.WSCLIENT.File=logs/WSClient.log
+log4j.appender.WSCLIENT.MaxFileSize=10MB
+#log4j.appender.REQUEST_LOGGER.MaxBackupIndex=10
+log4j.appender.WSCLIENT.DatePattern='_'yyyy-MM-dd
+log4j.appender.WSCLIENT.layout=org.apache.log4j.PatternLayout
+log4j.appender.WSCLIENT.layout.ConversionPattern=%d{MMM dd, yyyy HH:mm:ss.SSS} %F:%L%n%p: %m%n
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/config/log4j2.xml b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/config/log4j2.xml
new file mode 100644
index 0000000..b6b5b0e
--- /dev/null
+++ b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/config/log4j2.xml
@@ -0,0 +1,43 @@
+
+
+
+
+
+ ${ctx:applicationPath}/logs
+
+
+
+
+
+
+
+
+
+
+
+
+ UTF-8
+ %d{MMM dd, yyyy HH:mm:ss.SSS}: %t: %p: %m%n
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/config/tenant config.xml b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/config/tenant config.xml
new file mode 100644
index 0000000..b5d9be1
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/config/tenant config.xml differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/lib/bc-fips-1.0.2.3.jar b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/lib/bc-fips-1.0.2.3.jar
new file mode 100644
index 0000000..1a8c5de
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/lib/bc-fips-1.0.2.3.jar differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/lib/commons-codec-1.6.jar b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/lib/commons-codec-1.6.jar
new file mode 100644
index 0000000..ee1bc49
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/lib/commons-codec-1.6.jar differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/lib/disruptor-3.3.7.jar b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/lib/disruptor-3.3.7.jar
new file mode 100644
index 0000000..1777a37
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/lib/disruptor-3.3.7.jar differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/lib/fs-smaillibrary.jar b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/lib/fs-smaillibrary.jar
new file mode 100644
index 0000000..0cb2298
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/lib/fs-smaillibrary.jar differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/lib/fs-ws-client.jar b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/lib/fs-ws-client.jar
new file mode 100644
index 0000000..cbda191
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/lib/fs-ws-client.jar differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/lib/juniversalchardet-1.0.3.jar b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/lib/juniversalchardet-1.0.3.jar
new file mode 100644
index 0000000..1af703f
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/lib/juniversalchardet-1.0.3.jar differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/lib/log4j-api-2.17.1.jar b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/lib/log4j-api-2.17.1.jar
new file mode 100644
index 0000000..1aae243
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/lib/log4j-api-2.17.1.jar differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/lib/log4j-core-2.17.1.jar b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/lib/log4j-core-2.17.1.jar
new file mode 100644
index 0000000..4682527
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/lib/log4j-core-2.17.1.jar differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/lib/seclore-io-1.0.0.0.jar b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/lib/seclore-io-1.0.0.0.jar
new file mode 100644
index 0000000..365237b
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/lib/seclore-io-1.0.0.0.jar differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/lib/xercesImpl-X.jar b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/lib/xercesImpl-X.jar
new file mode 100644
index 0000000..38fca83
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/lib/xercesImpl-X.jar differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/src/Version.properties b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/src/Version.properties
new file mode 100644
index 0000000..adf74cc
--- /dev/null
+++ b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/src/Version.properties
@@ -0,0 +1 @@
+SAMPLE.APP.VERSION=2.0.0.0
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/src/com/seclore/fs/protect/example/core/Config.java b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/src/com/seclore/fs/protect/example/core/Config.java
new file mode 100644
index 0000000..5d2f60c
--- /dev/null
+++ b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/src/com/seclore/fs/protect/example/core/Config.java
@@ -0,0 +1,55 @@
+package com.seclore.fs.protect.example.core;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+
+public class Config
+{
+ private static Properties props = null;
+
+ /**
+ * read the config/config.properties file
+ * @param appPath
+ */
+ public static void initConfig(String appPath)
+ {
+ String configPath = appPath ;
+ InputStream lInputStream = null;
+ try
+ {
+ Properties lProps = new Properties();
+ lInputStream = new FileInputStream(configPath);
+ lProps.load(lInputStream);
+ props = lProps;
+ }
+ catch(Exception lEx)
+ {
+ lEx.printStackTrace();
+ }
+ finally
+ {
+ if( lInputStream != null)
+ {
+ try
+ {
+ lInputStream.close();
+ }
+ catch(IOException ioException)
+ {
+ // Ignore
+ }
+ }
+ }
+ }
+
+ /**
+ * gets the value of property key defined in config/config.properties
+ *
+ */
+ public static String getProperty(String key, String defaultValue)
+ {
+ return props.getProperty(key, defaultValue);
+ }
+}
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/src/com/seclore/fs/protect/example/core/FSEntity.java b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/src/com/seclore/fs/protect/example/core/FSEntity.java
new file mode 100644
index 0000000..334bc73
--- /dev/null
+++ b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/src/com/seclore/fs/protect/example/core/FSEntity.java
@@ -0,0 +1,58 @@
+package com.seclore.fs.protect.example.core;
+
+public class FSEntity
+{
+ private String id;
+
+ /**
+ * repository code
+ */
+ private int repCode;
+ /**
+ *
+ * entity type
+ * 1 for user
+ * 2 for group
+ */
+ private int type;
+
+ // Default constructor
+ public FSEntity()
+ {
+
+ }
+
+ public FSEntity(String id, int repCode, int type)
+ {
+ this.id = id;
+ this.repCode = repCode;
+ this.type = type;
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+ public void setId(String id)
+ {
+ this.id = id;
+ }
+ public int getRepCode()
+ {
+ return repCode;
+ }
+ public void setRepCode(int repCode)
+ {
+ this.repCode = repCode;
+ }
+ public int getType()
+ {
+ return type;
+ }
+ public void setType(int type)
+ {
+ this.type = type;
+ }
+
+
+}
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/src/com/seclore/fs/protect/example/core/InitializeWSClient.java b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/src/com/seclore/fs/protect/example/core/InitializeWSClient.java
new file mode 100644
index 0000000..cae2a78
--- /dev/null
+++ b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/src/com/seclore/fs/protect/example/core/InitializeWSClient.java
@@ -0,0 +1,225 @@
+package com.seclore.fs.protect.example.core;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringWriter;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.mozilla.universalchardet.UniversalDetector;
+import org.w3c.dom.Document;
+import org.xml.sax.InputSource;
+
+import com.seclore.fs.helper.exception.FSHelperException;
+import com.seclore.fs.helper.library.FSHelperLibrary;
+
+public class InitializeWSClient
+{
+ /**
+ * @param configPath
+ * Takes the application config file path as input
+ * @throws Exception
+ */
+ public static void initializeHelperLibrary(String configPath) throws Exception
+ {
+ try
+ {
+ String configContentXMLString = getConfigFileContent(configPath);
+ // Initialize method takes WSClient config content not the config file path.
+ FSHelperLibrary.initialize(configContentXMLString);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @param helperId
+ * Tenant Id
+ * @param helperResourcePath
+ * Resource Path for files of Seclore Policy Server. To be left empty here.
+ * @param helperConfigPath
+ * File path for 'tenant config.xml' file
+ * @throws Exception
+ * Code snippet won't run if any exception is thrown in this block
+ */
+ public static void initializeHelper(String helperId, String helperResourcePath, String helperConfigPath) throws Exception
+ {
+ try
+ {
+ String configContentXMLString = getConfigFileContent( helperConfigPath );
+ // Initialize method takes WSClient config content not the config file path.
+ FSHelperLibrary.initializeHelper(helperId, helperResourcePath, configContentXMLString);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * This method reads an XML file and returns the content of the XML file in string format
+ * @param appPath
+ * XML file path
+ * @return File content in string format
+ * @throws Exception
+ */
+ private static String getConfigFileContent( String appPath ) throws Exception
+ {
+ validateConfigFile( appPath );
+
+ InputStream inputStream = null;
+ try
+ {
+ String encoding = detectEncoding(appPath);
+ if( encoding == null || encoding.trim().isEmpty() )
+ {
+ encoding = "UTF-8";
+ }
+
+ DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
+ builderFactory.setNamespaceAware(false);
+ builderFactory.setValidating(false);
+ DocumentBuilder builder = builderFactory.newDocumentBuilder();
+ inputStream = new FileInputStream(appPath);
+ InputSource lInputSource = new InputSource( inputStream );
+ lInputSource.setEncoding(encoding);
+ Document document = builder.parse( lInputSource );
+
+
+ TransformerFactory lTransFactory = TransformerFactory.newInstance();
+ Transformer lTrans = lTransFactory.newTransformer();
+ DOMSource lSource = new DOMSource(document);
+ StringWriter lStringWriter = new StringWriter();
+ lTrans.transform( lSource, new StreamResult( lStringWriter ) );
+ return lStringWriter.toString();
+ }
+ catch (Exception e)
+ {
+ System.out.println("*** Config file should be in UTF-16LE encoding ***");
+ e.printStackTrace();
+ System.exit(0);
+ }
+ finally
+ {
+ if(inputStream != null)
+ {
+ try{
+ inputStream.close();
+ }
+ catch(IOException ioException)
+ {
+ //ignore
+ }
+ }
+ }
+ return "";
+ }
+
+ /**
+ * Validates whether the file exists at the given location & has valid BOM format
+ * @param configFilePath
+ * @throws Exception
+ * @return The file object representing the configFilePath
+ */
+ private static File validateConfigFile(String configFilePath) throws Exception
+ {
+
+ if ( configFilePath == null || configFilePath.trim().isEmpty() )
+ {
+ throw new Exception("Configuration File path is not provided.");
+ }
+
+ File file = new File(configFilePath);
+ if ( !file.exists() )
+ {
+ throw new Exception("Configuration File does not exist at '"+ file.getAbsolutePath() + "'");
+ }
+
+ if( !file.isFile() )
+ {
+ throw new Exception("'" + file.getAbsolutePath() + "' is not a file.");
+ }
+
+ // Length 3 is checked to make sure that enough bytes are available for
+ // BOM reading.
+ if (file.length() < 3)
+ {
+ throw new Exception("'" + file.getAbsolutePath() + "' is not a valid configuration file.");
+ }
+ return file;
+ }
+
+ /**
+ * Detect encoding format of file
+ * @param pConfigXmlPath
+ * File path whose encoding type is to be detected
+ * @return encoding format (eg: utf-8, utf-16)
+ */
+ public static String detectEncoding(String pConfigXmlPath)
+ {
+ FileInputStream lFis = null;
+ try
+ {
+ lFis = new FileInputStream(pConfigXmlPath);
+ UniversalDetector lDetector = new UniversalDetector(null);
+ byte[] lBuff = new byte[512];
+ int liread;
+ while( (liread = lFis.read(lBuff)) > 0 && !lDetector.isDone() )
+ {
+ lDetector.handleData(lBuff, 0, liread);
+ }
+ lDetector.dataEnd();
+ String lstrEncoding = lDetector.getDetectedCharset();
+ lDetector.reset();
+ return lstrEncoding;
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ finally
+ {
+ if ( lFis != null)
+ {
+ try
+ {
+ lFis.close();
+ } catch (IOException e)
+ {
+ // Igniore
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Terminate the created session and reset the initialized Server SDK library.
+ */
+ public static void terminateWSClient()
+ {
+ try
+ {
+ FSHelperLibrary.logInfo("Terminating FSHelper Library");
+ if(FSHelperLibrary.isTerminated() == false)
+ {
+ System.out.println("FSHelperLibrary.isTerminated(): " + FSHelperLibrary.isTerminated());
+ FSHelperLibrary.terminate();
+ }
+ }
+ catch (FSHelperException e)
+ {
+ FSHelperLibrary.logError(e.getMessage(), e);
+ }
+ }
+
+}
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/src/com/seclore/fs/protect/example/main/SecloreMain.java b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/src/com/seclore/fs/protect/example/main/SecloreMain.java
new file mode 100644
index 0000000..a1e93a1
--- /dev/null
+++ b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/src/com/seclore/fs/protect/example/main/SecloreMain.java
@@ -0,0 +1,383 @@
+package com.seclore.fs.protect.example.main;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Scanner;
+
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import com.seclore.fs.helper.core.ProtectedFile;
+import com.seclore.fs.helper.enums.ProtectionType;
+import com.seclore.fs.helper.exception.FSHelperException;
+import com.seclore.fs.helper.library.FSHelper;
+import com.seclore.fs.helper.library.FSHelperLibrary;
+import com.seclore.fs.protect.example.core.Config;
+import com.seclore.fs.protect.example.core.FSEntity;
+import com.seclore.fs.protect.example.core.InitializeWSClient;
+import com.seclore.fs.protect.example.util.XMLUtil;
+
+public class SecloreMain
+{
+
+ // FS Helper library is multi-tenant. Use unique tenant identifier for each tenant
+ private static String tenantID = "Tenant-1";
+
+ // This file contains information about the Application into which this code snippet is to be integrated.
+ private static final String appConfigXMLFilePath = "config/config.xml";
+
+ // This file contains info for creating session with Seclore Policy Server and initializing Server SDK library
+ private static final String tenantConfigXMLFilePath = "config/tenant config.xml";
+
+ // Used to take user input
+ private static Scanner scanner = null;
+
+ /**
+ *
This block initializes the Server SDK library and creates a session with Seclore Policy Server
+ * @exception Code snippet won't run if any exception is thrown in this block.
+ */
+ static
+ {
+ try
+ {
+ Config.initConfig("config/config.properties");
+ InitializeWSClient.initializeHelperLibrary(appConfigXMLFilePath);
+ InitializeWSClient.initializeHelper(tenantID, "", tenantConfigXMLFilePath);
+ scanner = new Scanner(System.in);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ System.exit(0);
+ }
+ }
+
+ // Entry point to run this application
+ public static void main(String[] args)
+ {
+
+ try
+ {
+ String outputFilePath = protectAndWrapFile();
+
+ if( outputFilePath != null && !outputFilePath.trim().isEmpty() )
+ {
+ System.out.println("File '" + outputFilePath + "' is protected and wrapped successfully");
+ }
+ else
+ {
+ throw new Exception("Unexpected error");
+ }
+
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ finally
+ {
+ if( scanner != null )
+ {
+ scanner.close();
+ }
+
+ InitializeWSClient.terminateWSClient();
+ }
+ }
+
+ /**
+ * Protect and wrap a file using Seclore SDK
+ * @return the absolute file path of protected file
+ * @throws Exception
+ */
+ public static String protectAndWrapFile() throws Exception
+ {
+ System.out.println("Enter absolute path of the file to be protected and wrapped:");
+ String filePath = scanner.nextLine();
+
+ // get the FSHelper object by specifying the tenantId.
+ //note: This tenant id should be same which was used during initialization of Seclore SDK
+ FSHelper tenantObj = FSHelperLibrary.getHelper(tenantID);
+
+ // does basic validation checks to see if the file is supported by SDK and is not already protected
+ validateIfFileSupportsProtection(tenantObj, filePath);
+
+ // this display file name goes in activity log
+ // for more details see javadoc of FSHelper.protectAndWrap()
+ String dispFileName = filePath;
+ // get XML structure to protect with hot folder
+ String protectionDetails = getProtectDetailsXML();
+ // show details about protector
+ String protectorDetails = "";
+ // activity comments to be shown
+ String actvityComments = "Protected by using FS Helper Library's protectAndWrap method";
+
+ // calling Seclore SDK's protectAndWrap api
+ ProtectedFile protectedWrappedFile = tenantObj.protectAndWrap(null,
+ filePath,
+ dispFileName,
+ ProtectionType.PROTECT,
+ protectionDetails,
+ protectorDetails,
+ actvityComments);
+ System.out.println("Protected File Id: " + protectedWrappedFile.getFileId());
+
+ return protectedWrappedFile.getFilePath();
+ }
+
+ /**
+ * Validates if the file supports Seclore protection
+ *
+ * @param tenantObj - FSHelper object created for the tenant.
+ * @param filePath - Absolute path of the file to be protected.
+ * @throws Exception
+ */
+ private static void validateIfFileSupportsProtection(FSHelper tenantObj, String filePath)
+ throws FSHelperException, Exception
+ {
+ //check if file is already Seclore protected
+ if( tenantObj.isProtectedFile(filePath) || tenantObj.isHTMLWrapped(filePath) )
+ {
+ throw new Exception("File '"+filePath+"' is already protected");
+ }
+
+ //check if file extension is supported by Seclore FS Helper Library
+ if( tenantObj.isSupportedFile(filePath) == false && tenantObj.isBasicProtectionSupported(filePath) == false )
+ {
+ String fileExt = filePath.substring( filePath.lastIndexOf(".")+1 );
+ //note: if file is not of standard format and does not support basic protection then throw error
+ throw new Exception("File with extention '"+fileExt+"' is not supported by Seclore FS Helper Library");
+ }
+
+ //check if file extension is supported for HTML wrapping by Seclore FS Helper Library
+ if( tenantObj.isHTMLWrapSupported(filePath) == false )
+ {
+ //note: file is of standard format but not supported for HTML wrapping
+ throw new Exception("File '"+filePath+"' does not support HTML wrapping");
+ }
+ }
+
+ /**
+ * Forms the protection XML request string to be sent to PS.
+ *
+ * @return protection request XML structure
+ */
+ private static String getProtectDetailsXML() throws Exception
+ {
+ System.out.println("Enter owner mail id:");
+ String ownerEmail = scanner.nextLine();
+
+ System.out.println("Enter recipient(s) mail id: [if multiple seperate by using comma ,]");
+ String recipientsEmailCommaSeperated = scanner.nextLine();
+
+ System.out.println("Enter recipient(s) rights id: [if multiple seperate by using comma ,]");
+ String rightsCommaSeparated = scanner.nextLine();
+ //unlike the recipient's , you cannot create the owner
+ // i.e you cannot call createUser on owner emailId
+ // This is because the create user method needs a referrer-email-id and
+ // this user should already exist in the policy server.
+ FSEntity owner = searchUser(ownerEmail.trim());
+ if(owner == null)
+ {
+ throw new Exception("owner does not exist in Policy Server.");
+ }
+
+ String [] emails = recipientsEmailCommaSeperated.split(",");
+ String [] rights = rightsCommaSeparated.split(",");
+
+ List entities = new ArrayList();
+ for (int i = 0; i < emails.length; i++)
+ {
+ //Searching the user in the Policy Server's repositories based on email id.
+ //if not found creating the recipient user in the Policy Server's repository.
+ //note: owner should already exist in the Policy Server
+ //else the protect request will fail.
+ FSEntity recipient = searchAndCreateUser(emails[i].trim(),ownerEmail);
+ //user does not exist
+ if( recipient == null )
+ { // creation of the user failed , abort the request
+ System.err.println("*** No entity found for email id '" + emails[i] + "' ");
+ return null;
+ }
+ entities.add(recipient);
+ }
+
+ if(rights.length != entities.size())
+ {
+ throw new Exception("Number of recipients and number of rights do not match.");
+ }
+
+ StringBuilder fileAccessRightMappings = new StringBuilder();
+ int i = 0;
+ for (FSEntity entity : entities)
+ {
+ String fileAccessRightMapping = ""+
+ "1"+
+ ""+
+ ""+
+ ""+XMLUtil.escapeForXML(entity.getId())+""+
+ ""+entity.getRepCode()+""+
+ ""+entity.getType()+""+
+ ""+
+ ""+rights[i]+""+
+ ""+Config.getProperty("offline", "0")+""+
+ ""+Config.getProperty("redistribute", "0")+""+
+ ""+Config.getProperty("lock.to.first.machine", "0")+""+
+ ""+Config.getProperty("no.of.days.since.protection", "-1")+""+
+ ""+Config.getProperty("no.of.days.since.first.access", "-1")+""+
+ ""+
+ "";
+ fileAccessRightMappings.append(fileAccessRightMapping);
+ i++;
+ }
+
+ String xml = ""
+ +"1"+
+ ""+
+ fileAccessRightMappings.toString()+
+ ""+
+ ""+
+ ""+
+ ""+owner.getId()+""+
+ ""+owner.getRepCode()+""+
+ "1"+
+ ""+
+ ""+
+ "";
+ return xml;
+ }
+
+ /**
+ * A helper method to get user details if exists
+ * or create a new user in PS repository.
+ * For more details see searchUser & createUser.
+ *
+ */
+ private static FSEntity searchAndCreateUser(String emailId,String referrerEmailId)
+ throws FSHelperException,Exception
+ {
+ FSEntity user = searchUser(emailId);
+ //user not found in any repository
+ if(user != null)
+ {
+ return user;
+ }
+ //note: referrer should already exist in policy server before calling create user
+ return createUser(emailId,referrerEmailId);
+ }
+
+ /**
+ * searches a user in the policy server with given email id.
+ *
+ * @param emailId - emailId of the user to be created in PS
+ * @return - FSEntity representing the repository information in which the user exists.
+ * In case the user does not exist returns null
+ *
+ * @throws FSHelperException
+ * - In case some error occurs while searching the user
+ *
+ */
+ private static FSEntity searchUser(String emailId) throws FSHelperException,Exception
+ {
+ FSHelper tenantObj = FSHelperLibrary.getHelper(tenantID);
+ // XML request structure to search a user in Policy Server , if does not exist creating a new user
+ String searchUserXML = ""
+ +""
+ + "2"
+ + ""
+ + ""
+ + ""+XMLUtil.escapeForXML(emailId)+""
+ +""
+ +"";
+ //sending search user request to Policy Server
+ String responseXML = tenantObj.sendRequest(null,74, searchUserXML);
+ Node rootNode = XMLUtil.getRootNode(responseXML);
+ Node requestStatusNode = XMLUtil.parseNode("request-status", rootNode);
+ String returnValue = XMLUtil.parseString("return-value", requestStatusNode);
+ if( "1".equals(returnValue) )
+ {
+ NodeList nodeList = XMLUtil.parseNodeList("entities/entity", rootNode);
+ if ( nodeList != null && nodeList.getLength() > 0 )
+ {
+ // Get first entity
+ Node node = nodeList.item(0);
+ String id = XMLUtil.parseString("id", node);
+ int repCode = XMLUtil.parseInteger("rep-code", node);
+ int type = XMLUtil.parseInteger("type", node);
+ return new FSEntity(id, repCode, type);
+ }
+ }
+ // if no such user found in Policy Server then it will return this error '-220372 :- No Entities Found.'
+ // checking if there is some processing other than error code -220372 then throwing the exception
+ if( "-220372".equals(returnValue) == false )
+ {
+ String errorMessage = XMLUtil.parseString("error-message", requestStatusNode);
+ String displayMessage = XMLUtil.parseString("display-message", requestStatusNode);
+ if( displayMessage == null || displayMessage.trim().isEmpty() ){
+ displayMessage = errorMessage;
+ }
+ throw new Exception( displayMessage +"("+returnValue+")" );
+ }
+
+ return null;
+ }
+
+ /**
+ * to create a new user in policy server with given emailId.
+ * Before calling this method check if the user with given emailId
+ * already exists in policy server using searchUser method.
+ *
+ * @param emailId
+ * emailId of the new user to be created in policy server
+ * @param referrerEmailId
+ * emailId of the person who is referring this person.
+ * This user should already exist in the policy server.
+ *
+ * @throws Exception if user already exists or
+ * no user exists in policy server with given referrerEmailId
+ */
+ private static FSEntity createUser(String emailId , String referrerEmailId) throws Exception
+ {
+ FSHelper tenantObj = FSHelperLibrary.getHelper(tenantID);
+ // request structure for creating a user
+ String createUserXML = ""
+ +""
+ + "2"
+ + ""
+ + ""
+ + ""
+ + ""+XMLUtil.escapeForXML(emailId)+""
+ + "User created by MFP"
+ + ""+referrerEmailId+""
+ + ""
+ + ""
+ + "";
+ // sending create user request to Policy Server
+ String responseXML = tenantObj.sendRequest(null,109,createUserXML);
+ Node rootNode = XMLUtil.getRootNode(responseXML);
+ Node requestStatusNode = XMLUtil.parseNode("request-status", rootNode);
+ String returnValue = XMLUtil.parseString("return-value", requestStatusNode);
+ // if return-value is not 1 this means user creation failed , hence throwing the error
+ if("1".equals(returnValue) == false )
+ {
+ String errorMessage = XMLUtil.parseString("error-message", requestStatusNode);
+ String displayMessage = XMLUtil.parseString("display-message", requestStatusNode);
+ if( displayMessage == null || displayMessage.trim().isEmpty() )
+ {
+ displayMessage = errorMessage;
+ }
+ //user cannot be created in Policy Server , hence throwing exception
+ System.out.println("user can't be created "+displayMessage);
+ throw new Exception( displayMessage +"("+returnValue+")" );
+ }
+ // user already exist
+ // -220394 :- User with email id ''{0}'' already exist.
+ // -220518 :- User with email id ''{0}'' already exist in a repository which is not visible.
+ Node node = XMLUtil.parseNode("im-user", rootNode);
+ String id = XMLUtil.parseString("id", node);
+ int repCode = XMLUtil.parseInteger("rep-code", node);
+ int type = 1;
+ return new FSEntity(id, repCode, type);
+ }
+
+}
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/src/com/seclore/fs/protect/example/util/XMLUtil.java b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/src/com/seclore/fs/protect/example/util/XMLUtil.java
new file mode 100644
index 0000000..14657c5
--- /dev/null
+++ b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/src/com/seclore/fs/protect/example/util/XMLUtil.java
@@ -0,0 +1,164 @@
+package com.seclore.fs.protect.example.util;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringReader;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathExpressionException;
+import javax.xml.xpath.XPathFactory;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.InputSource;
+
+public class XMLUtil
+{
+ private static XPath xpath = null;
+ static
+ {
+ xpath = XPathFactory.newInstance().newXPath();
+ }
+
+
+ /**
+ * @param xmlString
+ * @return
+ */
+ public static Document parseDocument(String xmlString)
+ {
+ InputStream inputStream = null;
+ try
+ {
+ DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
+ DocumentBuilder builder = builderFactory.newDocumentBuilder();
+ Document xmlDocument = builder.parse( new InputSource(new StringReader(xmlString)) );
+ return xmlDocument;
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ //LoggerUtil.logError("Error while parsing - "+xmlString, e);
+ }
+ finally
+ {
+ if(inputStream != null)
+ {
+ try{
+ inputStream.close();
+ }
+ catch(IOException ioException)
+ {
+ //ignore
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @param document
+ * @return
+ */
+ public static Node getRootNode(Document document)
+ {
+ NodeList nodeList = document.getChildNodes();
+ return nodeList.item(0);
+ }
+
+ /**
+ * @param XML String
+ * @return
+ */
+ public static Node getRootNode(String xmlString)
+ {
+ Document document = parseDocument(xmlString);
+ return getRootNode(document);
+ }
+
+ /**
+ * @param xmlTagName
+ * @param parentNode
+ * @return
+ */
+ public static Node parseNode(String xmlTagName, Node parentNode)
+ {
+ try
+ {
+ Node node = (Node) xpath.evaluate(xmlTagName, parentNode, XPathConstants.NODE);
+ return node;
+ }
+ catch (XPathExpressionException e)
+ {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ /**
+ * @param xmlTagName
+ * @param parentNode
+ * @return
+ */
+ public static NodeList parseNodeList(String xmlTagName, Node parentNode)
+ {
+ try
+ {
+ NodeList nodeList = (NodeList) xpath.evaluate(xmlTagName, parentNode, XPathConstants.NODESET);
+ return nodeList;
+ }
+ catch (XPathExpressionException e)
+ {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ /**
+ * @param xmlTagName
+ * @param parentNode
+ * @return
+ */
+ public static String parseString(String xmlTagName, Node parentNode)
+ {
+ try
+ {
+ String requestId = (String) xpath.evaluate(xmlTagName+"/text()", parentNode, XPathConstants.STRING);
+ return requestId;
+ }
+ catch (XPathExpressionException e)
+ {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ public static Integer parseInteger(String xmlTagName, Node parentNode)
+ {
+ try
+ {
+ Number li = (Number) xpath.evaluate(xmlTagName, parentNode, XPathConstants.NUMBER);
+ return li.intValue();
+ }
+ catch (XPathExpressionException e)
+ {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ public static String escapeForXML(String strXML)
+ {
+ if(strXML == null || strXML.trim().isEmpty())
+ {
+ return strXML;
+ }
+
+ return strXML.replace("&", "&").replace("<", "<").replace(">", ">").replace("\"", """).replace("'", "'");
+ }
+}
+
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Start Here - Protect & Wrap with Independent Rights - Enterprise Policy Server.pptx b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Start Here - Protect & Wrap with Independent Rights - Enterprise Policy Server.pptx
new file mode 100644
index 0000000..5aea992
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/Start Here - Protect & Wrap with Independent Rights - Enterprise Policy Server.pptx differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/scripts/build.sh b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/scripts/build.sh
new file mode 100644
index 0000000..f977094
--- /dev/null
+++ b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/scripts/build.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+set -e
+
+# Set the project root directory
+PROJECT_ROOT=$(dirname "$0")/..
+
+# Clean all bin folders
+rm -rf "$PROJECT_ROOT/Sample Code/bin/Protect With Independent Rights & Wrap/config"/*
+rm -rf "$PROJECT_ROOT/Sample Code/bin/Protect With Independent Rights & Wrap/lib"/*
+
+# Clear the src/bin dir containing compiled class files
+rm -rf "$PROJECT_ROOT/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/bin"/*
+
+#find and compile all java files
+find "$PROJECT_ROOT/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/src" -name "*.java" -exec javac -d "$PROJECT_ROOT/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/bin" -cp "$PROJECT_ROOT/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/lib/*" {} +
+
+# Package the compiled classes into a JAR file
+jar cvf "$PROJECT_ROOT/Sample Code/bin/Protect With Independent Rights & Wrap/lib/sample-app.jar" -C "$PROJECT_ROOT/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/bin" .
+
+# Copy all libs and config files to bin
+cp -r "$PROJECT_ROOT/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/lib"/* "$PROJECT_ROOT/Sample Code/bin/Protect With Independent Rights & Wrap/lib"
+cp -r "$PROJECT_ROOT/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/config"/* "$PROJECT_ROOT/Sample Code/bin/Protect With Independent Rights & Wrap/config"
\ No newline at end of file
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/scripts/test.sh b/examples/Java/2. Protect & Wrap with Independent Rights/Using Enterprise Policy Server/scripts/test.sh
new file mode 100644
index 0000000..e69de29
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/FSRighstsCalculator.html b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/FSRighstsCalculator.html
new file mode 100644
index 0000000..f349722
--- /dev/null
+++ b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/FSRighstsCalculator.html
@@ -0,0 +1,90 @@
+
+
+
+
+
+
+
+
+
FileSecure Rights Calculator
+
+
(primary access rights)
+
+
+ Final:
+
+
+
+
View
+
Lite Viewer
+
Edit
+
Copy Data
+
Print
+
Screen Capture
+
Macro
+
Full Control
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code Configuration Details.xlsx b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code Configuration Details.xlsx
new file mode 100644
index 0000000..2aae805
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code Configuration Details.xlsx differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code Walkthrough.mp4 b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code Walkthrough.mp4
new file mode 100644
index 0000000..f272a55
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code Walkthrough.mp4 differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/Readme.txt b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/Readme.txt
new file mode 100644
index 0000000..5e1f885
--- /dev/null
+++ b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/Readme.txt
@@ -0,0 +1,30 @@
+
+Protect With Independent Rights & Wrap Sample App
+==================================================
+
+
+Deployment Steps:
+------------------
+1. make sure your policy server is running . This app requires java 8 or above to run so make
+ sure java 8 or above is installed.
+
+2. go inside 'bin/Protect With Independent Rights & Wrap Sample App'
+
+3. Configure the 'tenant config.xml' in 'config/'
+ a. Policy Server Details:
+ server : Server name on which Policy Server is running
+ port : Server Port on which Policy Server is running
+ app-name : Policy Server application name
+
+ b. fill hot folder details i.e id and passphrase
+
+3. Configure the config.properties in 'config/'
+
+4. If you are using java 8 , put libs present inside 'doc/JCE Files/java8' into
+ 'bin/Protect With Independent Rights & Wrap Sample App/lib'
+
+4. click on run.bat to start sample app , follow instruction on terminal
+
+5. The independent rights given to each user are numeric values.Use
+ the 'FSRighstsCalculator.html' present inside the 'doc' folder to
+ calculate right's value.
\ No newline at end of file
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/config/config.properties b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/config/config.properties
new file mode 100644
index 0000000..d824b9a
--- /dev/null
+++ b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/config/config.properties
@@ -0,0 +1,6 @@
+#Other Rights to be applied on file, refer FSRighstsCalculator.html for primary.access.right.
+offline=0
+redistribute=0
+lock.to.first.machine=0
+no.of.days.since.protection=-1
+no.of.days.since.first.access=-1
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/config/config.xml b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/config/config.xml
new file mode 100644
index 0000000..b148308
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/config/config.xml differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/config/log4j.properties b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/config/log4j.properties
new file mode 100644
index 0000000..8293be6
--- /dev/null
+++ b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/config/log4j.properties
@@ -0,0 +1,15 @@
+
+log4j.category.WSCLIENT=debug, WSCLIENT
+
+# If we want to change the Appender, we have to change
+# UtilFunction.initializeLoggers() too, because it assumes that the appender
+# is 'org.apache.log4j.RollingFileAppender' and changes path of the file by
+# getting appender from this logger.
+log4j.appender.WSCLIENT=com.seclore.fs.ws.client.logger.DailyZippedRollingFileAppender
+# Path of the file should be relative to application ROOT
+log4j.appender.WSCLIENT.File=logs/WSClient.log
+log4j.appender.WSCLIENT.MaxFileSize=10MB
+#log4j.appender.REQUEST_LOGGER.MaxBackupIndex=10
+log4j.appender.WSCLIENT.DatePattern='_'yyyy-MM-dd
+log4j.appender.WSCLIENT.layout=org.apache.log4j.PatternLayout
+log4j.appender.WSCLIENT.layout.ConversionPattern=%d{MMM dd, yyyy HH:mm:ss.SSS} %F:%L%n%p: %m%n
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/config/log4j2.xml b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/config/log4j2.xml
new file mode 100644
index 0000000..b6b5b0e
--- /dev/null
+++ b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/config/log4j2.xml
@@ -0,0 +1,43 @@
+
+
+
+
+
+ ${ctx:applicationPath}/logs
+
+
+
+
+
+
+
+
+
+
+
+
+ UTF-8
+ %d{MMM dd, yyyy HH:mm:ss.SSS}: %t: %p: %m%n
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/config/tenant config.xml b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/config/tenant config.xml
new file mode 100644
index 0000000..da18b33
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/config/tenant config.xml differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/lib/bc-fips-1.0.0.jar b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/lib/bc-fips-1.0.0.jar
new file mode 100644
index 0000000..321e563
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/lib/bc-fips-1.0.0.jar differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/lib/commons-codec-1.6.jar b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/lib/commons-codec-1.6.jar
new file mode 100644
index 0000000..ee1bc49
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/lib/commons-codec-1.6.jar differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/lib/disruptor-3.3.7.jar b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/lib/disruptor-3.3.7.jar
new file mode 100644
index 0000000..1777a37
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/lib/disruptor-3.3.7.jar differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/lib/fs-smaillibrary.jar b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/lib/fs-smaillibrary.jar
new file mode 100644
index 0000000..aa95e22
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/lib/fs-smaillibrary.jar differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/lib/fs-ws-client-4.4.7.jar b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/lib/fs-ws-client-4.4.7.jar
new file mode 100644
index 0000000..bf2adcf
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/lib/fs-ws-client-4.4.7.jar differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/lib/juniversalchardet-1.0.3.jar b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/lib/juniversalchardet-1.0.3.jar
new file mode 100644
index 0000000..1af703f
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/lib/juniversalchardet-1.0.3.jar differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/lib/log4j-1.2.14.jar b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/lib/log4j-1.2.14.jar
new file mode 100644
index 0000000..6251307
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/lib/log4j-1.2.14.jar differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/lib/log4j-api-2.10.0.jar b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/lib/log4j-api-2.10.0.jar
new file mode 100644
index 0000000..9603b1b
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/lib/log4j-api-2.10.0.jar differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/lib/log4j-core-2.10.0.jar b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/lib/log4j-core-2.10.0.jar
new file mode 100644
index 0000000..1be9e67
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/lib/log4j-core-2.10.0.jar differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/lib/sample-app.jar b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/lib/sample-app.jar
new file mode 100644
index 0000000..c26578f
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/lib/sample-app.jar differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/lib/xercesImpl-X.jar b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/lib/xercesImpl-X.jar
new file mode 100644
index 0000000..38fca83
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/lib/xercesImpl-X.jar differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/logs/WSClient.log b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/logs/WSClient.log
new file mode 100644
index 0000000..4309fed
--- /dev/null
+++ b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/logs/WSClient.log
@@ -0,0 +1,4 @@
+FileSecure Version is 4.4.7.0
+Jul 19, 2021 12:11:50.990: main: INFO: WSCLIENT logger is initialized
+Jul 19, 2021 12:11:50.996: main: INFO: -1SDK Logger is initialized
+Jul 19, 2021 12:11:50.998: main: INFO: -1FSHelperLibrary::initializeSuccessfully Initialized helper library.
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/run.bat b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/run.bat
new file mode 100644
index 0000000..47f1076
--- /dev/null
+++ b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/bin/Protect With Independent Rights & Wrap/run.bat
@@ -0,0 +1,17 @@
+@echo off
+set "CURRENT_DIR=%cd%"
+echo ---------------------------------------------------------------------
+echo Seclore 'Protect with Independent Rights And Wrap Sample App' Utility
+echo ---------------------------------------------------------------------
+echo.
+
+rem if your want to run on a different jdk or java path is not configured uncomment below line
+rem for example ,
+rem path="C:\Program Files\Java\jdk-11.0.1\bin";
+java -version
+echo.
+
+REM uncomment below line to see the version of sample app i.e( remove REM mentioned below)
+REM java -cp "./lib/sample-app.jar"; com.seclore.fs.protect.example.Version
+ java -cp "./lib/*"; com.seclore.fs.protect.example.main.SecloreMain
+pause
\ No newline at end of file
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/doc/Developer_s Reference.txt b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/doc/Developer_s Reference.txt
new file mode 100644
index 0000000..d49ade4
--- /dev/null
+++ b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/doc/Developer_s Reference.txt
@@ -0,0 +1,37 @@
+FileSecure Interfaces integration source code reference.
+
+FS Helper Initialization
+------------------------
+ - At application startup initializing FSHelperlibrary and FSHelper
+ - Below classes are used for the same
+ - SecloreMain
+ - static block :-
+ InitializeWSClient.initializeHelperLibrary((FSHELPERLIBRARY_CONFIG_XML_PATH, ););
+ InitializeWSClient.initializeHelper(HELPER_INSTANCE_KEY, FSHELPER_RESOURCE_PATH, FSHELPER_CONFIG_XML_PATH, );
+ - InitializeWSClient
+ - initializeHelperLibrary( ... )
+ - initializeHelper( ... )
+
+
+
+Main Class
+------------
+ - com.seclore.fs.protect.example.main
+ - SecloreMain class
+
+Note:
+=====
+while preparing xml string for request or response. please escape below spacial character for the string which will be written within xml tag.
+ "&" -> "&"
+ "<" -> "<"
+ ">", -> ">"
+ "\"" -> """
+ "'" -> "'";
+
+ Refer: com.seclore.fs.protect.example.util.XMLUtil class and
+ - escapeForXML () method
+
+Example: sample xml is "Sample Sales & purchase report.pdf"
+ here "Sample Sales and purchase report" should be escaped.
+ Use: String fileName = XMLHelper.escapeForXML( "Sample Sales & purchase report" );
+ ""+fileName+""
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/doc/FSRighstsCalculator.html b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/doc/FSRighstsCalculator.html
new file mode 100644
index 0000000..02e4029
--- /dev/null
+++ b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/doc/FSRighstsCalculator.html
@@ -0,0 +1,90 @@
+
+
+
+
+
+
+
+
+
FileSecure Rights Calculator
+
+
(primary access rights)
+
+
+ Final:
+
+
+
+
View
+
Lite Viewer
+
Edit
+
Copy Data
+
Print
+
Screen Capture
+
Macro
+
Full Control
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/doc/JCE Files/Java7/US_export_policy.jar b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/doc/JCE Files/Java7/US_export_policy.jar
new file mode 100644
index 0000000..7173213
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/doc/JCE Files/Java7/US_export_policy.jar differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/doc/JCE Files/Java7/local_policy.jar b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/doc/JCE Files/Java7/local_policy.jar
new file mode 100644
index 0000000..c34d036
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/doc/JCE Files/Java7/local_policy.jar differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/doc/JCE Files/Java8/US_export_policy.jar b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/doc/JCE Files/Java8/US_export_policy.jar
new file mode 100644
index 0000000..251b102
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/doc/JCE Files/Java8/US_export_policy.jar differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/doc/JCE Files/Java8/local_policy.jar b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/doc/JCE Files/Java8/local_policy.jar
new file mode 100644
index 0000000..1c58939
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/doc/JCE Files/Java8/local_policy.jar differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/.classpath b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/.classpath
new file mode 100644
index 0000000..8960a2e
--- /dev/null
+++ b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/.classpath
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/.project b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/.project
new file mode 100644
index 0000000..496d8fb
--- /dev/null
+++ b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/.project
@@ -0,0 +1,17 @@
+
+
+ Protect With Independent Rights & Wrap Sample Code
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+
+
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/.settings/org.eclipse.jdt.core.prefs b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..3a21537
--- /dev/null
+++ b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,11 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/bin/Version.properties b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/bin/Version.properties
new file mode 100644
index 0000000..adf74cc
--- /dev/null
+++ b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/bin/Version.properties
@@ -0,0 +1 @@
+SAMPLE.APP.VERSION=2.0.0.0
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/bin/com/seclore/fs/protect/example/core/Config.class b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/bin/com/seclore/fs/protect/example/core/Config.class
new file mode 100644
index 0000000..2e35dcf
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/bin/com/seclore/fs/protect/example/core/Config.class differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/bin/com/seclore/fs/protect/example/core/FSEntity.class b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/bin/com/seclore/fs/protect/example/core/FSEntity.class
new file mode 100644
index 0000000..c825cab
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/bin/com/seclore/fs/protect/example/core/FSEntity.class differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/bin/com/seclore/fs/protect/example/core/InitializeWSClient.class b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/bin/com/seclore/fs/protect/example/core/InitializeWSClient.class
new file mode 100644
index 0000000..5efd6ab
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/bin/com/seclore/fs/protect/example/core/InitializeWSClient.class differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/bin/com/seclore/fs/protect/example/main/SecloreMain.class b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/bin/com/seclore/fs/protect/example/main/SecloreMain.class
new file mode 100644
index 0000000..994cdc4
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/bin/com/seclore/fs/protect/example/main/SecloreMain.class differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/bin/com/seclore/fs/protect/example/util/XMLUtil.class b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/bin/com/seclore/fs/protect/example/util/XMLUtil.class
new file mode 100644
index 0000000..f1f107e
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/bin/com/seclore/fs/protect/example/util/XMLUtil.class differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/config/config.properties b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/config/config.properties
new file mode 100644
index 0000000..d824b9a
--- /dev/null
+++ b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/config/config.properties
@@ -0,0 +1,6 @@
+#Other Rights to be applied on file, refer FSRighstsCalculator.html for primary.access.right.
+offline=0
+redistribute=0
+lock.to.first.machine=0
+no.of.days.since.protection=-1
+no.of.days.since.first.access=-1
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/config/config.xml b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/config/config.xml
new file mode 100644
index 0000000..610e0c5
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/config/config.xml differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/config/log4j.properties b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/config/log4j.properties
new file mode 100644
index 0000000..8293be6
--- /dev/null
+++ b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/config/log4j.properties
@@ -0,0 +1,15 @@
+
+log4j.category.WSCLIENT=debug, WSCLIENT
+
+# If we want to change the Appender, we have to change
+# UtilFunction.initializeLoggers() too, because it assumes that the appender
+# is 'org.apache.log4j.RollingFileAppender' and changes path of the file by
+# getting appender from this logger.
+log4j.appender.WSCLIENT=com.seclore.fs.ws.client.logger.DailyZippedRollingFileAppender
+# Path of the file should be relative to application ROOT
+log4j.appender.WSCLIENT.File=logs/WSClient.log
+log4j.appender.WSCLIENT.MaxFileSize=10MB
+#log4j.appender.REQUEST_LOGGER.MaxBackupIndex=10
+log4j.appender.WSCLIENT.DatePattern='_'yyyy-MM-dd
+log4j.appender.WSCLIENT.layout=org.apache.log4j.PatternLayout
+log4j.appender.WSCLIENT.layout.ConversionPattern=%d{MMM dd, yyyy HH:mm:ss.SSS} %F:%L%n%p: %m%n
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/config/log4j2.xml b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/config/log4j2.xml
new file mode 100644
index 0000000..b6b5b0e
--- /dev/null
+++ b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/config/log4j2.xml
@@ -0,0 +1,43 @@
+
+
+
+
+
+ ${ctx:applicationPath}/logs
+
+
+
+
+
+
+
+
+
+
+
+
+ UTF-8
+ %d{MMM dd, yyyy HH:mm:ss.SSS}: %t: %p: %m%n
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/config/tenant config.xml b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/config/tenant config.xml
new file mode 100644
index 0000000..b5d9be1
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/config/tenant config.xml differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/lib/bc-fips-1.0.2.3.jar b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/lib/bc-fips-1.0.2.3.jar
new file mode 100644
index 0000000..1a8c5de
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/lib/bc-fips-1.0.2.3.jar differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/lib/commons-codec-1.6.jar b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/lib/commons-codec-1.6.jar
new file mode 100644
index 0000000..ee1bc49
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/lib/commons-codec-1.6.jar differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/lib/disruptor-3.3.7.jar b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/lib/disruptor-3.3.7.jar
new file mode 100644
index 0000000..1777a37
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/lib/disruptor-3.3.7.jar differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/lib/fs-smaillibrary.jar b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/lib/fs-smaillibrary.jar
new file mode 100644
index 0000000..0cb2298
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/lib/fs-smaillibrary.jar differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/lib/fs-ws-client.jar b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/lib/fs-ws-client.jar
new file mode 100644
index 0000000..cbda191
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/lib/fs-ws-client.jar differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/lib/juniversalchardet-1.0.3.jar b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/lib/juniversalchardet-1.0.3.jar
new file mode 100644
index 0000000..1af703f
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/lib/juniversalchardet-1.0.3.jar differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/lib/log4j-api-2.17.1.jar b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/lib/log4j-api-2.17.1.jar
new file mode 100644
index 0000000..1aae243
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/lib/log4j-api-2.17.1.jar differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/lib/log4j-core-2.17.1.jar b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/lib/log4j-core-2.17.1.jar
new file mode 100644
index 0000000..4682527
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/lib/log4j-core-2.17.1.jar differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/lib/seclore-io-1.0.0.0.jar b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/lib/seclore-io-1.0.0.0.jar
new file mode 100644
index 0000000..365237b
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/lib/seclore-io-1.0.0.0.jar differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/lib/xercesImpl-X.jar b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/lib/xercesImpl-X.jar
new file mode 100644
index 0000000..38fca83
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/lib/xercesImpl-X.jar differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/src/Version.properties b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/src/Version.properties
new file mode 100644
index 0000000..adf74cc
--- /dev/null
+++ b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/src/Version.properties
@@ -0,0 +1 @@
+SAMPLE.APP.VERSION=2.0.0.0
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/src/com/seclore/fs/protect/example/core/Config.java b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/src/com/seclore/fs/protect/example/core/Config.java
new file mode 100644
index 0000000..5d2f60c
--- /dev/null
+++ b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/src/com/seclore/fs/protect/example/core/Config.java
@@ -0,0 +1,55 @@
+package com.seclore.fs.protect.example.core;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+
+public class Config
+{
+ private static Properties props = null;
+
+ /**
+ * read the config/config.properties file
+ * @param appPath
+ */
+ public static void initConfig(String appPath)
+ {
+ String configPath = appPath ;
+ InputStream lInputStream = null;
+ try
+ {
+ Properties lProps = new Properties();
+ lInputStream = new FileInputStream(configPath);
+ lProps.load(lInputStream);
+ props = lProps;
+ }
+ catch(Exception lEx)
+ {
+ lEx.printStackTrace();
+ }
+ finally
+ {
+ if( lInputStream != null)
+ {
+ try
+ {
+ lInputStream.close();
+ }
+ catch(IOException ioException)
+ {
+ // Ignore
+ }
+ }
+ }
+ }
+
+ /**
+ * gets the value of property key defined in config/config.properties
+ *
+ */
+ public static String getProperty(String key, String defaultValue)
+ {
+ return props.getProperty(key, defaultValue);
+ }
+}
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/src/com/seclore/fs/protect/example/core/FSEntity.java b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/src/com/seclore/fs/protect/example/core/FSEntity.java
new file mode 100644
index 0000000..334bc73
--- /dev/null
+++ b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/src/com/seclore/fs/protect/example/core/FSEntity.java
@@ -0,0 +1,58 @@
+package com.seclore.fs.protect.example.core;
+
+public class FSEntity
+{
+ private String id;
+
+ /**
+ * repository code
+ */
+ private int repCode;
+ /**
+ *
+ * entity type
+ * 1 for user
+ * 2 for group
+ */
+ private int type;
+
+ // Default constructor
+ public FSEntity()
+ {
+
+ }
+
+ public FSEntity(String id, int repCode, int type)
+ {
+ this.id = id;
+ this.repCode = repCode;
+ this.type = type;
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+ public void setId(String id)
+ {
+ this.id = id;
+ }
+ public int getRepCode()
+ {
+ return repCode;
+ }
+ public void setRepCode(int repCode)
+ {
+ this.repCode = repCode;
+ }
+ public int getType()
+ {
+ return type;
+ }
+ public void setType(int type)
+ {
+ this.type = type;
+ }
+
+
+}
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/src/com/seclore/fs/protect/example/core/InitializeWSClient.java b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/src/com/seclore/fs/protect/example/core/InitializeWSClient.java
new file mode 100644
index 0000000..cae2a78
--- /dev/null
+++ b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/src/com/seclore/fs/protect/example/core/InitializeWSClient.java
@@ -0,0 +1,225 @@
+package com.seclore.fs.protect.example.core;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringWriter;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.mozilla.universalchardet.UniversalDetector;
+import org.w3c.dom.Document;
+import org.xml.sax.InputSource;
+
+import com.seclore.fs.helper.exception.FSHelperException;
+import com.seclore.fs.helper.library.FSHelperLibrary;
+
+public class InitializeWSClient
+{
+ /**
+ * @param configPath
+ * Takes the application config file path as input
+ * @throws Exception
+ */
+ public static void initializeHelperLibrary(String configPath) throws Exception
+ {
+ try
+ {
+ String configContentXMLString = getConfigFileContent(configPath);
+ // Initialize method takes WSClient config content not the config file path.
+ FSHelperLibrary.initialize(configContentXMLString);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @param helperId
+ * Tenant Id
+ * @param helperResourcePath
+ * Resource Path for files of Seclore Policy Server. To be left empty here.
+ * @param helperConfigPath
+ * File path for 'tenant config.xml' file
+ * @throws Exception
+ * Code snippet won't run if any exception is thrown in this block
+ */
+ public static void initializeHelper(String helperId, String helperResourcePath, String helperConfigPath) throws Exception
+ {
+ try
+ {
+ String configContentXMLString = getConfigFileContent( helperConfigPath );
+ // Initialize method takes WSClient config content not the config file path.
+ FSHelperLibrary.initializeHelper(helperId, helperResourcePath, configContentXMLString);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * This method reads an XML file and returns the content of the XML file in string format
+ * @param appPath
+ * XML file path
+ * @return File content in string format
+ * @throws Exception
+ */
+ private static String getConfigFileContent( String appPath ) throws Exception
+ {
+ validateConfigFile( appPath );
+
+ InputStream inputStream = null;
+ try
+ {
+ String encoding = detectEncoding(appPath);
+ if( encoding == null || encoding.trim().isEmpty() )
+ {
+ encoding = "UTF-8";
+ }
+
+ DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
+ builderFactory.setNamespaceAware(false);
+ builderFactory.setValidating(false);
+ DocumentBuilder builder = builderFactory.newDocumentBuilder();
+ inputStream = new FileInputStream(appPath);
+ InputSource lInputSource = new InputSource( inputStream );
+ lInputSource.setEncoding(encoding);
+ Document document = builder.parse( lInputSource );
+
+
+ TransformerFactory lTransFactory = TransformerFactory.newInstance();
+ Transformer lTrans = lTransFactory.newTransformer();
+ DOMSource lSource = new DOMSource(document);
+ StringWriter lStringWriter = new StringWriter();
+ lTrans.transform( lSource, new StreamResult( lStringWriter ) );
+ return lStringWriter.toString();
+ }
+ catch (Exception e)
+ {
+ System.out.println("*** Config file should be in UTF-16LE encoding ***");
+ e.printStackTrace();
+ System.exit(0);
+ }
+ finally
+ {
+ if(inputStream != null)
+ {
+ try{
+ inputStream.close();
+ }
+ catch(IOException ioException)
+ {
+ //ignore
+ }
+ }
+ }
+ return "";
+ }
+
+ /**
+ * Validates whether the file exists at the given location & has valid BOM format
+ * @param configFilePath
+ * @throws Exception
+ * @return The file object representing the configFilePath
+ */
+ private static File validateConfigFile(String configFilePath) throws Exception
+ {
+
+ if ( configFilePath == null || configFilePath.trim().isEmpty() )
+ {
+ throw new Exception("Configuration File path is not provided.");
+ }
+
+ File file = new File(configFilePath);
+ if ( !file.exists() )
+ {
+ throw new Exception("Configuration File does not exist at '"+ file.getAbsolutePath() + "'");
+ }
+
+ if( !file.isFile() )
+ {
+ throw new Exception("'" + file.getAbsolutePath() + "' is not a file.");
+ }
+
+ // Length 3 is checked to make sure that enough bytes are available for
+ // BOM reading.
+ if (file.length() < 3)
+ {
+ throw new Exception("'" + file.getAbsolutePath() + "' is not a valid configuration file.");
+ }
+ return file;
+ }
+
+ /**
+ * Detect encoding format of file
+ * @param pConfigXmlPath
+ * File path whose encoding type is to be detected
+ * @return encoding format (eg: utf-8, utf-16)
+ */
+ public static String detectEncoding(String pConfigXmlPath)
+ {
+ FileInputStream lFis = null;
+ try
+ {
+ lFis = new FileInputStream(pConfigXmlPath);
+ UniversalDetector lDetector = new UniversalDetector(null);
+ byte[] lBuff = new byte[512];
+ int liread;
+ while( (liread = lFis.read(lBuff)) > 0 && !lDetector.isDone() )
+ {
+ lDetector.handleData(lBuff, 0, liread);
+ }
+ lDetector.dataEnd();
+ String lstrEncoding = lDetector.getDetectedCharset();
+ lDetector.reset();
+ return lstrEncoding;
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ finally
+ {
+ if ( lFis != null)
+ {
+ try
+ {
+ lFis.close();
+ } catch (IOException e)
+ {
+ // Igniore
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Terminate the created session and reset the initialized Server SDK library.
+ */
+ public static void terminateWSClient()
+ {
+ try
+ {
+ FSHelperLibrary.logInfo("Terminating FSHelper Library");
+ if(FSHelperLibrary.isTerminated() == false)
+ {
+ System.out.println("FSHelperLibrary.isTerminated(): " + FSHelperLibrary.isTerminated());
+ FSHelperLibrary.terminate();
+ }
+ }
+ catch (FSHelperException e)
+ {
+ FSHelperLibrary.logError(e.getMessage(), e);
+ }
+ }
+
+}
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/src/com/seclore/fs/protect/example/main/SecloreMain.java b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/src/com/seclore/fs/protect/example/main/SecloreMain.java
new file mode 100644
index 0000000..a1e93a1
--- /dev/null
+++ b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/src/com/seclore/fs/protect/example/main/SecloreMain.java
@@ -0,0 +1,383 @@
+package com.seclore.fs.protect.example.main;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Scanner;
+
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import com.seclore.fs.helper.core.ProtectedFile;
+import com.seclore.fs.helper.enums.ProtectionType;
+import com.seclore.fs.helper.exception.FSHelperException;
+import com.seclore.fs.helper.library.FSHelper;
+import com.seclore.fs.helper.library.FSHelperLibrary;
+import com.seclore.fs.protect.example.core.Config;
+import com.seclore.fs.protect.example.core.FSEntity;
+import com.seclore.fs.protect.example.core.InitializeWSClient;
+import com.seclore.fs.protect.example.util.XMLUtil;
+
+public class SecloreMain
+{
+
+ // FS Helper library is multi-tenant. Use unique tenant identifier for each tenant
+ private static String tenantID = "Tenant-1";
+
+ // This file contains information about the Application into which this code snippet is to be integrated.
+ private static final String appConfigXMLFilePath = "config/config.xml";
+
+ // This file contains info for creating session with Seclore Policy Server and initializing Server SDK library
+ private static final String tenantConfigXMLFilePath = "config/tenant config.xml";
+
+ // Used to take user input
+ private static Scanner scanner = null;
+
+ /**
+ *
This block initializes the Server SDK library and creates a session with Seclore Policy Server
+ * @exception Code snippet won't run if any exception is thrown in this block.
+ */
+ static
+ {
+ try
+ {
+ Config.initConfig("config/config.properties");
+ InitializeWSClient.initializeHelperLibrary(appConfigXMLFilePath);
+ InitializeWSClient.initializeHelper(tenantID, "", tenantConfigXMLFilePath);
+ scanner = new Scanner(System.in);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ System.exit(0);
+ }
+ }
+
+ // Entry point to run this application
+ public static void main(String[] args)
+ {
+
+ try
+ {
+ String outputFilePath = protectAndWrapFile();
+
+ if( outputFilePath != null && !outputFilePath.trim().isEmpty() )
+ {
+ System.out.println("File '" + outputFilePath + "' is protected and wrapped successfully");
+ }
+ else
+ {
+ throw new Exception("Unexpected error");
+ }
+
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ finally
+ {
+ if( scanner != null )
+ {
+ scanner.close();
+ }
+
+ InitializeWSClient.terminateWSClient();
+ }
+ }
+
+ /**
+ * Protect and wrap a file using Seclore SDK
+ * @return the absolute file path of protected file
+ * @throws Exception
+ */
+ public static String protectAndWrapFile() throws Exception
+ {
+ System.out.println("Enter absolute path of the file to be protected and wrapped:");
+ String filePath = scanner.nextLine();
+
+ // get the FSHelper object by specifying the tenantId.
+ //note: This tenant id should be same which was used during initialization of Seclore SDK
+ FSHelper tenantObj = FSHelperLibrary.getHelper(tenantID);
+
+ // does basic validation checks to see if the file is supported by SDK and is not already protected
+ validateIfFileSupportsProtection(tenantObj, filePath);
+
+ // this display file name goes in activity log
+ // for more details see javadoc of FSHelper.protectAndWrap()
+ String dispFileName = filePath;
+ // get XML structure to protect with hot folder
+ String protectionDetails = getProtectDetailsXML();
+ // show details about protector
+ String protectorDetails = "";
+ // activity comments to be shown
+ String actvityComments = "Protected by using FS Helper Library's protectAndWrap method";
+
+ // calling Seclore SDK's protectAndWrap api
+ ProtectedFile protectedWrappedFile = tenantObj.protectAndWrap(null,
+ filePath,
+ dispFileName,
+ ProtectionType.PROTECT,
+ protectionDetails,
+ protectorDetails,
+ actvityComments);
+ System.out.println("Protected File Id: " + protectedWrappedFile.getFileId());
+
+ return protectedWrappedFile.getFilePath();
+ }
+
+ /**
+ * Validates if the file supports Seclore protection
+ *
+ * @param tenantObj - FSHelper object created for the tenant.
+ * @param filePath - Absolute path of the file to be protected.
+ * @throws Exception
+ */
+ private static void validateIfFileSupportsProtection(FSHelper tenantObj, String filePath)
+ throws FSHelperException, Exception
+ {
+ //check if file is already Seclore protected
+ if( tenantObj.isProtectedFile(filePath) || tenantObj.isHTMLWrapped(filePath) )
+ {
+ throw new Exception("File '"+filePath+"' is already protected");
+ }
+
+ //check if file extension is supported by Seclore FS Helper Library
+ if( tenantObj.isSupportedFile(filePath) == false && tenantObj.isBasicProtectionSupported(filePath) == false )
+ {
+ String fileExt = filePath.substring( filePath.lastIndexOf(".")+1 );
+ //note: if file is not of standard format and does not support basic protection then throw error
+ throw new Exception("File with extention '"+fileExt+"' is not supported by Seclore FS Helper Library");
+ }
+
+ //check if file extension is supported for HTML wrapping by Seclore FS Helper Library
+ if( tenantObj.isHTMLWrapSupported(filePath) == false )
+ {
+ //note: file is of standard format but not supported for HTML wrapping
+ throw new Exception("File '"+filePath+"' does not support HTML wrapping");
+ }
+ }
+
+ /**
+ * Forms the protection XML request string to be sent to PS.
+ *
+ * @return protection request XML structure
+ */
+ private static String getProtectDetailsXML() throws Exception
+ {
+ System.out.println("Enter owner mail id:");
+ String ownerEmail = scanner.nextLine();
+
+ System.out.println("Enter recipient(s) mail id: [if multiple seperate by using comma ,]");
+ String recipientsEmailCommaSeperated = scanner.nextLine();
+
+ System.out.println("Enter recipient(s) rights id: [if multiple seperate by using comma ,]");
+ String rightsCommaSeparated = scanner.nextLine();
+ //unlike the recipient's , you cannot create the owner
+ // i.e you cannot call createUser on owner emailId
+ // This is because the create user method needs a referrer-email-id and
+ // this user should already exist in the policy server.
+ FSEntity owner = searchUser(ownerEmail.trim());
+ if(owner == null)
+ {
+ throw new Exception("owner does not exist in Policy Server.");
+ }
+
+ String [] emails = recipientsEmailCommaSeperated.split(",");
+ String [] rights = rightsCommaSeparated.split(",");
+
+ List entities = new ArrayList();
+ for (int i = 0; i < emails.length; i++)
+ {
+ //Searching the user in the Policy Server's repositories based on email id.
+ //if not found creating the recipient user in the Policy Server's repository.
+ //note: owner should already exist in the Policy Server
+ //else the protect request will fail.
+ FSEntity recipient = searchAndCreateUser(emails[i].trim(),ownerEmail);
+ //user does not exist
+ if( recipient == null )
+ { // creation of the user failed , abort the request
+ System.err.println("*** No entity found for email id '" + emails[i] + "' ");
+ return null;
+ }
+ entities.add(recipient);
+ }
+
+ if(rights.length != entities.size())
+ {
+ throw new Exception("Number of recipients and number of rights do not match.");
+ }
+
+ StringBuilder fileAccessRightMappings = new StringBuilder();
+ int i = 0;
+ for (FSEntity entity : entities)
+ {
+ String fileAccessRightMapping = ""+
+ "1"+
+ ""+
+ ""+
+ ""+XMLUtil.escapeForXML(entity.getId())+""+
+ ""+entity.getRepCode()+""+
+ ""+entity.getType()+""+
+ ""+
+ ""+rights[i]+""+
+ ""+Config.getProperty("offline", "0")+""+
+ ""+Config.getProperty("redistribute", "0")+""+
+ ""+Config.getProperty("lock.to.first.machine", "0")+""+
+ ""+Config.getProperty("no.of.days.since.protection", "-1")+""+
+ ""+Config.getProperty("no.of.days.since.first.access", "-1")+""+
+ ""+
+ "";
+ fileAccessRightMappings.append(fileAccessRightMapping);
+ i++;
+ }
+
+ String xml = ""
+ +"1"+
+ ""+
+ fileAccessRightMappings.toString()+
+ ""+
+ ""+
+ ""+
+ ""+owner.getId()+""+
+ ""+owner.getRepCode()+""+
+ "1"+
+ ""+
+ ""+
+ "";
+ return xml;
+ }
+
+ /**
+ * A helper method to get user details if exists
+ * or create a new user in PS repository.
+ * For more details see searchUser & createUser.
+ *
+ */
+ private static FSEntity searchAndCreateUser(String emailId,String referrerEmailId)
+ throws FSHelperException,Exception
+ {
+ FSEntity user = searchUser(emailId);
+ //user not found in any repository
+ if(user != null)
+ {
+ return user;
+ }
+ //note: referrer should already exist in policy server before calling create user
+ return createUser(emailId,referrerEmailId);
+ }
+
+ /**
+ * searches a user in the policy server with given email id.
+ *
+ * @param emailId - emailId of the user to be created in PS
+ * @return - FSEntity representing the repository information in which the user exists.
+ * In case the user does not exist returns null
+ *
+ * @throws FSHelperException
+ * - In case some error occurs while searching the user
+ *
+ */
+ private static FSEntity searchUser(String emailId) throws FSHelperException,Exception
+ {
+ FSHelper tenantObj = FSHelperLibrary.getHelper(tenantID);
+ // XML request structure to search a user in Policy Server , if does not exist creating a new user
+ String searchUserXML = ""
+ +""
+ + "2"
+ + ""
+ + ""
+ + ""+XMLUtil.escapeForXML(emailId)+""
+ +""
+ +"";
+ //sending search user request to Policy Server
+ String responseXML = tenantObj.sendRequest(null,74, searchUserXML);
+ Node rootNode = XMLUtil.getRootNode(responseXML);
+ Node requestStatusNode = XMLUtil.parseNode("request-status", rootNode);
+ String returnValue = XMLUtil.parseString("return-value", requestStatusNode);
+ if( "1".equals(returnValue) )
+ {
+ NodeList nodeList = XMLUtil.parseNodeList("entities/entity", rootNode);
+ if ( nodeList != null && nodeList.getLength() > 0 )
+ {
+ // Get first entity
+ Node node = nodeList.item(0);
+ String id = XMLUtil.parseString("id", node);
+ int repCode = XMLUtil.parseInteger("rep-code", node);
+ int type = XMLUtil.parseInteger("type", node);
+ return new FSEntity(id, repCode, type);
+ }
+ }
+ // if no such user found in Policy Server then it will return this error '-220372 :- No Entities Found.'
+ // checking if there is some processing other than error code -220372 then throwing the exception
+ if( "-220372".equals(returnValue) == false )
+ {
+ String errorMessage = XMLUtil.parseString("error-message", requestStatusNode);
+ String displayMessage = XMLUtil.parseString("display-message", requestStatusNode);
+ if( displayMessage == null || displayMessage.trim().isEmpty() ){
+ displayMessage = errorMessage;
+ }
+ throw new Exception( displayMessage +"("+returnValue+")" );
+ }
+
+ return null;
+ }
+
+ /**
+ * to create a new user in policy server with given emailId.
+ * Before calling this method check if the user with given emailId
+ * already exists in policy server using searchUser method.
+ *
+ * @param emailId
+ * emailId of the new user to be created in policy server
+ * @param referrerEmailId
+ * emailId of the person who is referring this person.
+ * This user should already exist in the policy server.
+ *
+ * @throws Exception if user already exists or
+ * no user exists in policy server with given referrerEmailId
+ */
+ private static FSEntity createUser(String emailId , String referrerEmailId) throws Exception
+ {
+ FSHelper tenantObj = FSHelperLibrary.getHelper(tenantID);
+ // request structure for creating a user
+ String createUserXML = ""
+ +""
+ + "2"
+ + ""
+ + ""
+ + ""
+ + ""+XMLUtil.escapeForXML(emailId)+""
+ + "User created by MFP"
+ + ""+referrerEmailId+""
+ + ""
+ + ""
+ + "";
+ // sending create user request to Policy Server
+ String responseXML = tenantObj.sendRequest(null,109,createUserXML);
+ Node rootNode = XMLUtil.getRootNode(responseXML);
+ Node requestStatusNode = XMLUtil.parseNode("request-status", rootNode);
+ String returnValue = XMLUtil.parseString("return-value", requestStatusNode);
+ // if return-value is not 1 this means user creation failed , hence throwing the error
+ if("1".equals(returnValue) == false )
+ {
+ String errorMessage = XMLUtil.parseString("error-message", requestStatusNode);
+ String displayMessage = XMLUtil.parseString("display-message", requestStatusNode);
+ if( displayMessage == null || displayMessage.trim().isEmpty() )
+ {
+ displayMessage = errorMessage;
+ }
+ //user cannot be created in Policy Server , hence throwing exception
+ System.out.println("user can't be created "+displayMessage);
+ throw new Exception( displayMessage +"("+returnValue+")" );
+ }
+ // user already exist
+ // -220394 :- User with email id ''{0}'' already exist.
+ // -220518 :- User with email id ''{0}'' already exist in a repository which is not visible.
+ Node node = XMLUtil.parseNode("im-user", rootNode);
+ String id = XMLUtil.parseString("id", node);
+ int repCode = XMLUtil.parseInteger("rep-code", node);
+ int type = 1;
+ return new FSEntity(id, repCode, type);
+ }
+
+}
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/src/com/seclore/fs/protect/example/util/XMLUtil.java b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/src/com/seclore/fs/protect/example/util/XMLUtil.java
new file mode 100644
index 0000000..14657c5
--- /dev/null
+++ b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/src/com/seclore/fs/protect/example/util/XMLUtil.java
@@ -0,0 +1,164 @@
+package com.seclore.fs.protect.example.util;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringReader;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathExpressionException;
+import javax.xml.xpath.XPathFactory;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.InputSource;
+
+public class XMLUtil
+{
+ private static XPath xpath = null;
+ static
+ {
+ xpath = XPathFactory.newInstance().newXPath();
+ }
+
+
+ /**
+ * @param xmlString
+ * @return
+ */
+ public static Document parseDocument(String xmlString)
+ {
+ InputStream inputStream = null;
+ try
+ {
+ DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
+ DocumentBuilder builder = builderFactory.newDocumentBuilder();
+ Document xmlDocument = builder.parse( new InputSource(new StringReader(xmlString)) );
+ return xmlDocument;
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ //LoggerUtil.logError("Error while parsing - "+xmlString, e);
+ }
+ finally
+ {
+ if(inputStream != null)
+ {
+ try{
+ inputStream.close();
+ }
+ catch(IOException ioException)
+ {
+ //ignore
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @param document
+ * @return
+ */
+ public static Node getRootNode(Document document)
+ {
+ NodeList nodeList = document.getChildNodes();
+ return nodeList.item(0);
+ }
+
+ /**
+ * @param XML String
+ * @return
+ */
+ public static Node getRootNode(String xmlString)
+ {
+ Document document = parseDocument(xmlString);
+ return getRootNode(document);
+ }
+
+ /**
+ * @param xmlTagName
+ * @param parentNode
+ * @return
+ */
+ public static Node parseNode(String xmlTagName, Node parentNode)
+ {
+ try
+ {
+ Node node = (Node) xpath.evaluate(xmlTagName, parentNode, XPathConstants.NODE);
+ return node;
+ }
+ catch (XPathExpressionException e)
+ {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ /**
+ * @param xmlTagName
+ * @param parentNode
+ * @return
+ */
+ public static NodeList parseNodeList(String xmlTagName, Node parentNode)
+ {
+ try
+ {
+ NodeList nodeList = (NodeList) xpath.evaluate(xmlTagName, parentNode, XPathConstants.NODESET);
+ return nodeList;
+ }
+ catch (XPathExpressionException e)
+ {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ /**
+ * @param xmlTagName
+ * @param parentNode
+ * @return
+ */
+ public static String parseString(String xmlTagName, Node parentNode)
+ {
+ try
+ {
+ String requestId = (String) xpath.evaluate(xmlTagName+"/text()", parentNode, XPathConstants.STRING);
+ return requestId;
+ }
+ catch (XPathExpressionException e)
+ {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ public static Integer parseInteger(String xmlTagName, Node parentNode)
+ {
+ try
+ {
+ Number li = (Number) xpath.evaluate(xmlTagName, parentNode, XPathConstants.NUMBER);
+ return li.intValue();
+ }
+ catch (XPathExpressionException e)
+ {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ public static String escapeForXML(String strXML)
+ {
+ if(strXML == null || strXML.trim().isEmpty())
+ {
+ return strXML;
+ }
+
+ return strXML.replace("&", "&").replace("<", "<").replace(">", ">").replace("\"", """).replace("'", "'");
+ }
+}
+
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Start Here - Protect & Wrap with Independent Rights - Seclore Cloud Policy Server.pptx b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Start Here - Protect & Wrap with Independent Rights - Seclore Cloud Policy Server.pptx
new file mode 100644
index 0000000..5395fde
Binary files /dev/null and b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/Start Here - Protect & Wrap with Independent Rights - Seclore Cloud Policy Server.pptx differ
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/scripts/build.sh b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/scripts/build.sh
new file mode 100644
index 0000000..f977094
--- /dev/null
+++ b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/scripts/build.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+set -e
+
+# Set the project root directory
+PROJECT_ROOT=$(dirname "$0")/..
+
+# Clean all bin folders
+rm -rf "$PROJECT_ROOT/Sample Code/bin/Protect With Independent Rights & Wrap/config"/*
+rm -rf "$PROJECT_ROOT/Sample Code/bin/Protect With Independent Rights & Wrap/lib"/*
+
+# Clear the src/bin dir containing compiled class files
+rm -rf "$PROJECT_ROOT/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/bin"/*
+
+#find and compile all java files
+find "$PROJECT_ROOT/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/src" -name "*.java" -exec javac -d "$PROJECT_ROOT/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/bin" -cp "$PROJECT_ROOT/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/lib/*" {} +
+
+# Package the compiled classes into a JAR file
+jar cvf "$PROJECT_ROOT/Sample Code/bin/Protect With Independent Rights & Wrap/lib/sample-app.jar" -C "$PROJECT_ROOT/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/bin" .
+
+# Copy all libs and config files to bin
+cp -r "$PROJECT_ROOT/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/lib"/* "$PROJECT_ROOT/Sample Code/bin/Protect With Independent Rights & Wrap/lib"
+cp -r "$PROJECT_ROOT/Sample Code/src/Protect With Independent Rights & Wrap Sample Code/config"/* "$PROJECT_ROOT/Sample Code/bin/Protect With Independent Rights & Wrap/config"
\ No newline at end of file
diff --git a/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/scripts/test.sh b/examples/Java/2. Protect & Wrap with Independent Rights/Using Seclore PoC Policy Server/scripts/test.sh
new file mode 100644
index 0000000..e69de29
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/Readme.txt b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/Readme.txt
new file mode 100644
index 0000000..c48caf0
--- /dev/null
+++ b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/Readme.txt
@@ -0,0 +1,57 @@
+=======================================
+Get Advanced EA Helper
+=======================================
+
+---------------------------
+Pre-requisites/Assumptions
+---------------------------
+1) Seclore Policy Server is up and running.
+3) An Elevated Enterprise Application (EA) is configured on the Seclore Policy Server.
+4) This utility is configured to run with Seclore Server SDK (4.4.7.0)
+
+
+
+------
+Notes
+------
+1) To use current working directory as the Application Path in '/config/config.xml' file, use "."
+ e.g .
+
+ Otherwise, enter the complete absolute path
+ e.g C:\Seclore\Elevated EA Utility\Source
+
+2) Sample public and private key xml files used to set up an Elevated EA have also been provided at :
+ 'Elevated EA Utility/Docs/samples/publicKey.xml'
+ 'Elevated EA Utility/Docs/samples/privateKey.xml'
+
+------------------
+Configuration Steps:
+------------------
+1. Put the JCE jar files (specific to JRE version) from 'Elevated EA Utility/Docs/JCE Files/' into 'JRE/lib/security/' folder of the system. This utility requires JDK version 1.8 or higher to run. The utility displays the JDK version it uses when you execute the 'run.bat' file.
+
+2. Configure the 'config.xml' file located in 'Elevated EA Utility/Source/config/'.
+ a. app-path : This is the absolute path of the application
+ - place a dot "." or put the absolute application path
+ - example: C:\Seclore\Seclore SDK Sample Code\Source
+ b. initalize-logger : This can be true/false depending upon the logging implementation.
+
+3. Configure the 'tenant config.xml' located in 'Elevated EA Utility/Source/config/'
+ a. Policy Server Details:
+ server : Server name on which Policy Server is running
+ port : Server Port on which Policy Server is running
+ app-name : Policy Server application name
+
+ b. Login details:
+ When using Hot Folder cabinet (EA) context i.e (1) :
+ id : ID of the Elevated Enterprise Application (EA) on the Seclore Policy Server.
+ passphrase : Passphrase of the Elevated Enterprise Application.
+ allow-advanced-privileges : 'false' by default. To enable advanced privileges for this EA, set this to 'true'
+
+3. Populate the 'config.properties' in 'Elevated EA Utility/Source/config/'. Some values are pre-populated which must not be changed.
+ ea.active.key.id : Elevated EA active key id which is displayed on EA config details page on Policy Server portal under the "Advanced Security" section titled 'Active Key ID'.
+
+ ea.private.key.xml.path : The absolute path of the private key xml file whose public key was used to configure the Elevated EA.
+ eg. ea.private.key.xml.path=C:\\Users\\Desktop\\EA Advanced Security Keys\\privateKeyXML.xml
+
+
+
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/Readme.txt b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/Readme.txt
new file mode 100644
index 0000000..893cdc6
--- /dev/null
+++ b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/Readme.txt
@@ -0,0 +1,60 @@
+=======================================
+Get Advanced EA Helper
+=======================================
+
+---------------------------
+Pre-requisites/Assumptions
+---------------------------
+1) Seclore Policy Server is up and running.
+3) An Elevated Enterprise Application (EA) is configured on the Seclore Policy Server.
+4) This utility is configured to run with Seclore Server SDK (4.4.7.0)
+
+
+
+------
+Notes
+------
+1) To use current working directory as the Application Path in '/config/config.xml' file, use "."
+ e.g .
+
+ Otherwise, enter the complete absolute path
+ e.g C:\Seclore\Elevated EA Utility\Source
+
+2) Sample public and private key xml files used to set up an Elevated EA have also been provided at :
+ 'Elevated EA Utility/Docs/samples/publicKey.xml'
+ 'Elevated EA Utility/Docs/samples/privateKey.xml'
+
+------------------
+Configuration Steps:
+------------------
+1. Put the JCE jar files (specific to JRE version) from 'Elevated EA Utility/Docs/JCE Files/' into 'JRE/lib/security/' folder of the system. This utility requires JDK version 1.8 or higher to run. The utility displays the JDK version it uses when you execute the 'run.bat' file.
+
+2. Configure the 'config.xml' file located in 'Elevated EA Utility/Source/config/'.
+ a. app-path : This is the absolute path of the application
+ - place a dot "." or put the absolute application path
+ - example: C:\Seclore\Seclore SDK Sample Code\Source
+ b. initalize-logger : This can be true/false depending upon the logging implementation.
+
+3. Configure the 'tenant config.xml' located in 'Elevated EA Utility/Source/config/'
+ a. Policy Server Details:
+ server : Server name on which Policy Server is running
+ port : Server Port on which Policy Server is running
+ app-name : Policy Server application name
+
+ b. Login details:
+ When using Hot Folder cabinet (EA) context i.e (1) :
+ id : ID of the Elevated Enterprise Application (EA) on the Seclore Policy Server.
+ passphrase : Passphrase of the Elevated Enterprise Application.
+ allow-advanced-privileges : 'false' by default. To enable advanced privileges for this EA, set this to 'true'
+
+3. Populate the 'config.properties' in 'Elevated EA Utility/Source/config/'. Some values are pre-populated which must not be changed.
+ ea.active.key.id : Elevated EA active key id which is displayed on EA config details page on Policy Server portal under the "Advanced Security" section titled 'Active Key ID'.
+
+ ea.private.key.xml.path : The absolute path of the private key xml file whose public key was used to configure the Elevated EA.
+ eg. ea.private.key.xml.path=C:\\Users\\Desktop\\EA Advanced Security Keys\\privateKeyXML.xml
+
+4. Execute "run.bat" to get the utility running.
+
+
+
+
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/config/config.properties b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/config/config.properties
new file mode 100644
index 0000000..e9e5022
--- /dev/null
+++ b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/config/config.properties
@@ -0,0 +1,6 @@
+#config details of logged in EA (visible in PS Portal)
+ea.active.key.id=
+ea.private.key.xml.path=
+ea.key.chaining.mode=ECB
+ea.key.padding.scheme=PKCS1Padding
+ea.key.length=256
\ No newline at end of file
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/config/config.xml b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/config/config.xml
new file mode 100644
index 0000000..9cc30b9
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/config/config.xml differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/config/log4j.properties b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/config/log4j.properties
new file mode 100644
index 0000000..8293be6
--- /dev/null
+++ b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/config/log4j.properties
@@ -0,0 +1,15 @@
+
+log4j.category.WSCLIENT=debug, WSCLIENT
+
+# If we want to change the Appender, we have to change
+# UtilFunction.initializeLoggers() too, because it assumes that the appender
+# is 'org.apache.log4j.RollingFileAppender' and changes path of the file by
+# getting appender from this logger.
+log4j.appender.WSCLIENT=com.seclore.fs.ws.client.logger.DailyZippedRollingFileAppender
+# Path of the file should be relative to application ROOT
+log4j.appender.WSCLIENT.File=logs/WSClient.log
+log4j.appender.WSCLIENT.MaxFileSize=10MB
+#log4j.appender.REQUEST_LOGGER.MaxBackupIndex=10
+log4j.appender.WSCLIENT.DatePattern='_'yyyy-MM-dd
+log4j.appender.WSCLIENT.layout=org.apache.log4j.PatternLayout
+log4j.appender.WSCLIENT.layout.ConversionPattern=%d{MMM dd, yyyy HH:mm:ss.SSS} %F:%L%n%p: %m%n
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/config/log4j2.xml b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/config/log4j2.xml
new file mode 100644
index 0000000..6902efe
--- /dev/null
+++ b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/config/log4j2.xml
@@ -0,0 +1,43 @@
+
+
+
+
+
+ ${ctx:applicationPath}/logs
+
+
+
+
+
+
+
+
+
+
+
+
+ UTF-8
+ %d{MMM dd, yyyy HH:mm:ss.SSS} :%t %n%p: %m%n
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/config/tenant config.xml b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/config/tenant config.xml
new file mode 100644
index 0000000..a88ffcc
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/config/tenant config.xml differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/lib/bc-fips-1.0.0.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/lib/bc-fips-1.0.0.jar
new file mode 100644
index 0000000..321e563
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/lib/bc-fips-1.0.0.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/lib/commons-codec-1.6.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/lib/commons-codec-1.6.jar
new file mode 100644
index 0000000..ee1bc49
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/lib/commons-codec-1.6.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/lib/disruptor-3.3.7.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/lib/disruptor-3.3.7.jar
new file mode 100644
index 0000000..1777a37
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/lib/disruptor-3.3.7.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/lib/fs-smaillibrary.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/lib/fs-smaillibrary.jar
new file mode 100644
index 0000000..aa95e22
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/lib/fs-smaillibrary.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/lib/fs-ws-client-4.4.7.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/lib/fs-ws-client-4.4.7.jar
new file mode 100644
index 0000000..bf2adcf
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/lib/fs-ws-client-4.4.7.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/lib/juniversalchardet-1.0.3.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/lib/juniversalchardet-1.0.3.jar
new file mode 100644
index 0000000..1af703f
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/lib/juniversalchardet-1.0.3.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/lib/log4j-1.2.14.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/lib/log4j-1.2.14.jar
new file mode 100644
index 0000000..6251307
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/lib/log4j-1.2.14.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/lib/log4j-api-2.10.0.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/lib/log4j-api-2.10.0.jar
new file mode 100644
index 0000000..9603b1b
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/lib/log4j-api-2.10.0.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/lib/log4j-core-2.10.0.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/lib/log4j-core-2.10.0.jar
new file mode 100644
index 0000000..1be9e67
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/lib/log4j-core-2.10.0.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/lib/sample-app.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/lib/sample-app.jar
new file mode 100644
index 0000000..90af6de
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/lib/sample-app.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/lib/xercesImpl-X.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/lib/xercesImpl-X.jar
new file mode 100644
index 0000000..38fca83
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/lib/xercesImpl-X.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/run.bat b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/run.bat
new file mode 100644
index 0000000..98082e8
--- /dev/null
+++ b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/run.bat
@@ -0,0 +1,14 @@
+@echo off
+set "CURRENT_DIR=%cd%"
+echo -------------------------------------------------------
+echo Seclore 'Get Advanced EA Helper' Utility
+echo -------------------------------------------------------
+echo.
+java -version
+echo.
+
+REM uncomment below line to see the version of sample app i.e( remove REM mentioned below)
+REM java -cp "./lib/sample-app.jar"; com.seclore.fs.ea.advanced.example.Version
+ java -cp "./lib/*"; com.seclore.fs.ea.advanced.example.main.SecloreMain
+pause
+
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/doc/Developer_s Reference.txt b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/doc/Developer_s Reference.txt
new file mode 100644
index 0000000..7bf2ed5
--- /dev/null
+++ b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/doc/Developer_s Reference.txt
@@ -0,0 +1,23 @@
+==========================================================
+FileSecure Interfaces integration source code reference
+==========================================================
+
+------------------------
+FS Helper Initialization
+------------------------
+ - At application startup, loading 'config.properties' file located in 'Seclore SDK Sample Code/Source/config'
+ - Then initializing FSHelperlibrary and FSHelper
+ - Below classes are used for the same
+ - SecloreMain
+ - static block :-
+ initializeHelperLibrary( FSHELPERLIBRARY_CONFIG_XML_PATH );
+ initializeHelper( HELPER_INSTANCE_KEY, FSHELPER_RESOURCE_PATH, FSHELPER_CONFIG_XML_PATH );
+ - Note that here since we are using an Elevated EA, we will also need to create an instance of 'DefaultCryptoHandler' to initilalize FSHelper.
+ eg. FSHelperLibrary.initializeHelper(TENANT_ID, FSHELPER_RESOURCE_PATH, FSHELPER_CONFIG_XML_CONTENT, DefaultCryptoHandler);
+
+
+------------
+Main Class
+------------
+ - com.seclore.fs.ea.advanced.example.main
+ - SecloreMain.java
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/doc/JCE Files/Java8/US_export_policy.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/doc/JCE Files/Java8/US_export_policy.jar
new file mode 100644
index 0000000..251b102
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/doc/JCE Files/Java8/US_export_policy.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/doc/JCE Files/Java8/local_policy.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/doc/JCE Files/Java8/local_policy.jar
new file mode 100644
index 0000000..1c58939
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/doc/JCE Files/Java8/local_policy.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/doc/samples/privateKey.xml b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/doc/samples/privateKey.xml
new file mode 100644
index 0000000..3c25134
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/doc/samples/privateKey.xml differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/doc/samples/publicKey.xml b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/doc/samples/publicKey.xml
new file mode 100644
index 0000000..517b12f
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/doc/samples/publicKey.xml differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/.classpath b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/.classpath
new file mode 100644
index 0000000..feb3dd0
--- /dev/null
+++ b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/.classpath
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/.project b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/.project
new file mode 100644
index 0000000..753a2b5
--- /dev/null
+++ b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/.project
@@ -0,0 +1,17 @@
+
+
+ Get Advanced EA Helper
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+
+
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/.settings/org.eclipse.jdt.core.prefs b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..3a21537
--- /dev/null
+++ b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,11 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/bin/com/seclore/fs/ea/advanced/example/Version.class b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/bin/com/seclore/fs/ea/advanced/example/Version.class
new file mode 100644
index 0000000..c569e52
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/bin/com/seclore/fs/ea/advanced/example/Version.class differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/bin/com/seclore/fs/ea/advanced/example/core/Config.class b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/bin/com/seclore/fs/ea/advanced/example/core/Config.class
new file mode 100644
index 0000000..eed4049
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/bin/com/seclore/fs/ea/advanced/example/core/Config.class differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/bin/com/seclore/fs/ea/advanced/example/main/SecloreMain.class b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/bin/com/seclore/fs/ea/advanced/example/main/SecloreMain.class
new file mode 100644
index 0000000..defee53
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/bin/com/seclore/fs/ea/advanced/example/main/SecloreMain.class differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/config/config.properties b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/config/config.properties
new file mode 100644
index 0000000..e9e5022
--- /dev/null
+++ b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/config/config.properties
@@ -0,0 +1,6 @@
+#config details of logged in EA (visible in PS Portal)
+ea.active.key.id=
+ea.private.key.xml.path=
+ea.key.chaining.mode=ECB
+ea.key.padding.scheme=PKCS1Padding
+ea.key.length=256
\ No newline at end of file
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/config/config.xml b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/config/config.xml
new file mode 100644
index 0000000..9cc30b9
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/config/config.xml differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/config/log4j.properties b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/config/log4j.properties
new file mode 100644
index 0000000..8293be6
--- /dev/null
+++ b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/config/log4j.properties
@@ -0,0 +1,15 @@
+
+log4j.category.WSCLIENT=debug, WSCLIENT
+
+# If we want to change the Appender, we have to change
+# UtilFunction.initializeLoggers() too, because it assumes that the appender
+# is 'org.apache.log4j.RollingFileAppender' and changes path of the file by
+# getting appender from this logger.
+log4j.appender.WSCLIENT=com.seclore.fs.ws.client.logger.DailyZippedRollingFileAppender
+# Path of the file should be relative to application ROOT
+log4j.appender.WSCLIENT.File=logs/WSClient.log
+log4j.appender.WSCLIENT.MaxFileSize=10MB
+#log4j.appender.REQUEST_LOGGER.MaxBackupIndex=10
+log4j.appender.WSCLIENT.DatePattern='_'yyyy-MM-dd
+log4j.appender.WSCLIENT.layout=org.apache.log4j.PatternLayout
+log4j.appender.WSCLIENT.layout.ConversionPattern=%d{MMM dd, yyyy HH:mm:ss.SSS} %F:%L%n%p: %m%n
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/config/log4j2.xml b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/config/log4j2.xml
new file mode 100644
index 0000000..6902efe
--- /dev/null
+++ b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/config/log4j2.xml
@@ -0,0 +1,43 @@
+
+
+
+
+
+ ${ctx:applicationPath}/logs
+
+
+
+
+
+
+
+
+
+
+
+
+ UTF-8
+ %d{MMM dd, yyyy HH:mm:ss.SSS} :%t %n%p: %m%n
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/config/tenant config.xml b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/config/tenant config.xml
new file mode 100644
index 0000000..a88ffcc
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/config/tenant config.xml differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/lib/bc-fips-1.0.0.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/lib/bc-fips-1.0.0.jar
new file mode 100644
index 0000000..321e563
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/lib/bc-fips-1.0.0.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/lib/commons-codec-1.6.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/lib/commons-codec-1.6.jar
new file mode 100644
index 0000000..ee1bc49
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/lib/commons-codec-1.6.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/lib/disruptor-3.3.7.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/lib/disruptor-3.3.7.jar
new file mode 100644
index 0000000..1777a37
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/lib/disruptor-3.3.7.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/lib/fs-get-elevated-session.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/lib/fs-get-elevated-session.jar
new file mode 100644
index 0000000..f475f9d
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/lib/fs-get-elevated-session.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/lib/fs-smaillibrary.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/lib/fs-smaillibrary.jar
new file mode 100644
index 0000000..aa95e22
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/lib/fs-smaillibrary.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/lib/fs-ws-client-4.4.7.0.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/lib/fs-ws-client-4.4.7.0.jar
new file mode 100644
index 0000000..bf2adcf
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/lib/fs-ws-client-4.4.7.0.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/lib/juniversalchardet-1.0.3.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/lib/juniversalchardet-1.0.3.jar
new file mode 100644
index 0000000..1af703f
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/lib/juniversalchardet-1.0.3.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/lib/log4j-1.2.14.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/lib/log4j-1.2.14.jar
new file mode 100644
index 0000000..6251307
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/lib/log4j-1.2.14.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/lib/log4j-api-2.10.0.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/lib/log4j-api-2.10.0.jar
new file mode 100644
index 0000000..9603b1b
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/lib/log4j-api-2.10.0.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/lib/log4j-core-2.10.0.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/lib/log4j-core-2.10.0.jar
new file mode 100644
index 0000000..1be9e67
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/lib/log4j-core-2.10.0.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/lib/xercesImpl-X.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/lib/xercesImpl-X.jar
new file mode 100644
index 0000000..38fca83
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/lib/xercesImpl-X.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/src/com/seclore/fs/ea/advanced/example/Version.java b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/src/com/seclore/fs/ea/advanced/example/Version.java
new file mode 100644
index 0000000..b4cd66b
--- /dev/null
+++ b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/src/com/seclore/fs/ea/advanced/example/Version.java
@@ -0,0 +1,23 @@
+package com.seclore.fs.ea.advanced.example;
+
+/**
+ * Represents the Sample App version.
+ */
+public class Version
+{
+ /**
+ * The version of the Sample App.
+ */
+ public static final String Version = "3.0.0.0";
+
+ /**
+ * Displays the version of the Sample App
+ *
+ * @param args
+ */
+ public static void main(String[] args)
+ {
+ System.out.println("Sample App version : " + Version);
+ System.out.println("Copyright (c) 2008 Seclore Technology Pvt. Ltd.");
+ }
+}
\ No newline at end of file
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/src/com/seclore/fs/ea/advanced/example/core/Config.java b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/src/com/seclore/fs/ea/advanced/example/core/Config.java
new file mode 100644
index 0000000..f292bb9
--- /dev/null
+++ b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/src/com/seclore/fs/ea/advanced/example/core/Config.java
@@ -0,0 +1,65 @@
+package com.seclore.fs.ea.advanced.example.core;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+
+public class Config
+{
+ private static Properties props = null;
+
+ /**
+ * Load and initialize the '/config.properties' file
+ * @param configPath
+ * @throws Exception
+ */
+ public static void initConfig(String configPath) throws Exception
+ {
+ InputStream lInputStream = null;
+ try
+ {
+ Properties properties = new Properties();
+ lInputStream = new FileInputStream(configPath);
+ properties.load(lInputStream);
+ props = properties;
+ }
+ catch(Exception lEx)
+ {
+ throw new Exception(lEx);
+ }
+ finally
+ {
+ if( lInputStream != null)
+ {
+ try
+ {
+ lInputStream.close();
+ }
+ catch(IOException ioException)
+ {
+ // Ignore
+ }
+ }
+ }
+ }
+
+ /**
+ * This method reads the value against the specified 'key' and returns it.
+ * In case the value is blank or null, it returns the 'defaultValue' which was passed to this method.
+ * @param key
+ * @param defaultValue
+ * @return
+ * @throws Exception
+ */
+ public static String getProperty(String key, String defaultValue) throws Exception
+ {
+ String propertyValue = props.getProperty(key, defaultValue);
+ if( propertyValue.trim().isEmpty() )
+ {
+ propertyValue = defaultValue;
+ }
+
+ return propertyValue;
+ }
+}
\ No newline at end of file
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/src/com/seclore/fs/ea/advanced/example/main/SecloreMain.java b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/src/com/seclore/fs/ea/advanced/example/main/SecloreMain.java
new file mode 100644
index 0000000..445df61
--- /dev/null
+++ b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/src/com/seclore/fs/ea/advanced/example/main/SecloreMain.java
@@ -0,0 +1,363 @@
+package com.seclore.fs.ea.advanced.example.main;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringWriter;
+import java.util.Scanner;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.mozilla.universalchardet.UniversalDetector;
+import org.w3c.dom.Document;
+import org.xml.sax.InputSource;
+
+import com.seclore.fs.ea.advanced.example.core.Config;
+import com.seclore.fs.helper.crypto.DefaultCryptoHandler;
+import com.seclore.fs.helper.exception.FSHelperException;
+import com.seclore.fs.helper.library.FSHelper;
+import com.seclore.fs.helper.library.FSHelperLibrary;
+
+/**
+ *
+ * @author vishal.kumar
+ *
+ */
+public class SecloreMain
+{
+
+ private static final String tenantID = "Tenant-1";
+
+ //# This file contains information about the Application into which this code snippet is to be integrated.
+ private static final String appConfigXMLFilePath = "config/config.xml";
+
+ //# This file contains info for creating session with Seclore Policy Server and initializing Server SDK library
+ private static final String tenantConfigXMLFilePath = "config/tenant config.xml";
+
+ //# Used to take user input
+ private static Scanner scanner = null;
+
+ /**
+ *
This block initializes the Server SDK library and creates a session with Seclore Policy Server
+ * @exception Code snippet won't run if any exception is thrown in this block.
+ */
+ static
+ {
+ try
+ {
+ //load config.properties file and then validate the entries in it
+ Config.initConfig("config/config.properties");
+
+ //validate if entries in this file have pre-filled values
+ validateConfigEntries();
+
+ //initialize the FSHelper Library
+ initializeHelperLibrary(appConfigXMLFilePath);
+ initializeHelper(tenantID, "", tenantConfigXMLFilePath);
+
+ scanner = new Scanner(System.in);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ System.exit(0);
+ }
+ }
+
+ /**
+ * Main method
+ * @param args
+ * Takes input from user
+ */
+ public static void main(String[] args)
+ {
+ try
+ {
+ boolean isRequestSuccessful = initializeElevatedHelper();
+ if(isRequestSuccessful)
+ {
+ System.out.println("***** Operation successful. *****");
+ }
+ else
+ {
+ System.out.println("***** Operation failed! *****");
+ }
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ }
+ finally
+ {
+ if( scanner != null )
+ {
+ scanner.close();
+ }
+ }
+ }
+
+ /**
+ * Validate if properties in this file have pre-filled values
+ * @throws Exception
+ */
+ private static void validateConfigEntries() throws Exception
+ {
+ String eaActiveKeyId = Config.getProperty("ea.active.key.id", "");
+ if( null == eaActiveKeyId || eaActiveKeyId.trim().isEmpty() )
+ {
+ throw new Exception("Value for property 'ea.active.key.id' missing in config.properties file.");
+ }
+
+ String eaPrivateKeyXMLPath = Config.getProperty("ea.private.key.xml.path", "");
+ if( null == eaPrivateKeyXMLPath || eaPrivateKeyXMLPath.trim().isEmpty() )
+ {
+ throw new Exception("Value for property 'ea.private.key.xml.path' missing in config.properties file.");
+ }
+ }
+
+ /**
+ * This method calls the Server SDK API to process the request for getting file protection details, which also contains the file classification details
+ * and display the success or error message.
+ * @return Flag to indicate if operation was successful or not
+ * @throws Exception
+ */
+ private static boolean initializeElevatedHelper() throws Exception
+ {
+ boolean isRequestSuccessful = false;
+ try
+ {
+ //# This object is specific to a tenant. It contains the methods to call Server SDK API to process any request.
+ FSHelper fsHelper = FSHelperLibrary.getHelper(tenantID);
+ isRequestSuccessful=true;
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ }
+ finally
+ {
+ terminateWSClient();
+ }
+
+ return isRequestSuccessful;
+ }
+
+
+ /**
+ * @param configPath
+ * Takes the application config file path ( /config.xml ) as input
+ * @throws Exception
+ */
+ private static void initializeHelperLibrary(String configPath) throws Exception
+ {
+ String appConfigXMLContent = getConfigFileContent( configPath );
+ // Initialize method takes config file content, not the config file path.
+ FSHelperLibrary.initialize( appConfigXMLContent );
+ }
+
+ /**
+ * @param pHelperId
+ * Tenant Id
+ * @param pHelperResourcePath
+ * Resource Path for files of Seclore Policy Server. To be left empty here.
+ * @param pHelperConfigPath
+ * File path for 'tenant config.xml' file
+ * @throws Exception
+ * Code snippet won't run if any exception is thrown in this block
+ */
+ private static void initializeHelper(String pHelperId, String pHelperResourcePath, String pHelperConfigPath) throws Exception
+ {
+ //# Reads the content of the private key XML file related to the EA using which session was created
+ String lEAPrivateKeyXMLContent = getConfigFileContent( Config.getProperty("ea.private.key.xml.path", "") );
+
+ //# This object is used for advanced security. Only those EA with 'Advanced Security' option enabled on Policy Server portal can create another EA.
+ DefaultCryptoHandler defaultCryptoHandler = getDefaultCryptoHandler(lEAPrivateKeyXMLContent);
+
+ //# Reads the content of the 'tenant config.xml' file
+ String tenantConfigXMLContent = getConfigFileContent(pHelperConfigPath);
+
+ // Initialize method takes WSClient config content not the config file path.
+ FSHelperLibrary.initializeHelper(pHelperId, pHelperResourcePath, tenantConfigXMLContent, defaultCryptoHandler);
+ }
+
+ /**
+ *
Uses the private key xml file to create an instance of DefaultCryptoHandler.
+ * @param pEAPrivateKeyXMLContent
+ * @return DefaultCryptoHandler instance
+ * @throws Exception
+ */
+ private static DefaultCryptoHandler getDefaultCryptoHandler(String pEAPrivateKeyXMLContent) throws Exception
+ {
+ DefaultCryptoHandler defaultCryptoHandler = new DefaultCryptoHandler(
+ pEAPrivateKeyXMLContent,
+ Integer.parseInt(Config.getProperty("ea.key.length", "256")),
+ Config.getProperty("ea.active.key.id", ""),
+ Config.getProperty("ea.key.chaining.mode", "ECB"),
+ Config.getProperty("ea.key.padding.scheme", "PKCS1Padding")
+ );
+ return defaultCryptoHandler;
+ }
+
+ /**
+ * This method reads an XML file and returns the content of the XML file in string format
+ * @param pAppPath
+ * XML file path
+ * @return File content in string format
+ * @throws Exception
+ */
+ private static String getConfigFileContent( String pAppPath ) throws Exception
+ {
+ validateConfigFile( pAppPath );
+
+ InputStream inputStream = null;
+ try
+ {
+ String lstrEncoding = detectEncoding(pAppPath);
+ if( lstrEncoding == null || lstrEncoding.trim().isEmpty() )
+ {
+ lstrEncoding = "UTF-8";
+ }
+
+ DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
+ builderFactory.setNamespaceAware(false);
+ builderFactory.setValidating(false);
+ DocumentBuilder builder = builderFactory.newDocumentBuilder();
+ inputStream = new FileInputStream(pAppPath);
+ InputSource lInputSource = new InputSource( inputStream );
+ lInputSource.setEncoding(lstrEncoding);
+ Document document = builder.parse( lInputSource );
+
+ TransformerFactory lTransFactory = TransformerFactory.newInstance();
+ Transformer lTrans = lTransFactory.newTransformer();
+ DOMSource lSource = new DOMSource(document);
+ StringWriter lStringWriter = new StringWriter();
+ lTrans.transform( lSource, new StreamResult( lStringWriter ) );
+ return lStringWriter.toString();
+ }
+ catch (Exception e)
+ {
+ System.out.println("*** Config file should be in UTF-16LE encoding ***");
+ e.printStackTrace();
+ System.exit(0);
+ }
+ finally
+ {
+ if(inputStream != null)
+ {
+ try
+ {
+ inputStream.close();
+ }
+ catch(IOException ioException)
+ {
+ //ignore
+ }
+ }
+ }
+ return "";
+ }
+
+ /**
+ * @param configFilePath
+ * @throws Exception
+ */
+ private static File validateConfigFile(String configFilePath) throws Exception
+ {
+
+ if ( configFilePath == null || configFilePath.trim().isEmpty() )
+ {
+ throw new Exception("Configuration File path is not provided.");
+ }
+
+ File file = new File(configFilePath);
+ if ( !file.exists() )
+ {
+ throw new Exception("Configuration File does not exist at '"+ file.getAbsolutePath() + "'");
+ }
+
+ if( !file.isFile() )
+ {
+ throw new Exception("'" + file.getAbsolutePath() + "' is not a file.");
+ }
+
+ // Length 3 is checked to make sure that enough bytes are available for
+ // BOM reading.
+ if (file.length() < 3)
+ {
+ throw new Exception("'" + file.getAbsolutePath() + "' is not a valid configuration file.");
+ }
+ return file;
+ }
+
+ /**
+ * Detect encoding format of file
+ * @param pConfigXmlPath
+ * File path whose encoding type is to be detected
+ * @return encoding format (eg: utf-8, utf-16)
+ */
+ public static String detectEncoding(String pConfigXmlPath)
+ {
+ FileInputStream lFis = null;
+ try
+ {
+ lFis = new FileInputStream(pConfigXmlPath);
+ UniversalDetector lDetector = new UniversalDetector(null);
+ byte[] lBuff = new byte[512];
+ int liread;
+ while( (liread = lFis.read(lBuff)) > 0 && !lDetector.isDone() )
+ {
+ lDetector.handleData(lBuff, 0, liread);
+ }
+ lDetector.dataEnd();
+ String lstrEncoding = lDetector.getDetectedCharset();
+ lDetector.reset();
+ return lstrEncoding;
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ finally
+ {
+ if ( lFis != null)
+ {
+ try
+ {
+ lFis.close();
+ }
+ catch (IOException e)
+ {
+ // Ignore
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Terminate the created session and reset the initialized Server SDK library.
+ */
+ public static void terminateWSClient()
+ {
+ try
+ {
+ FSHelperLibrary.logInfo("Terminating FSHelper Library");
+ if(FSHelperLibrary.isTerminated() == false)
+ {
+ System.out.println("FSHelperLibrary.isTerminated(): " + FSHelperLibrary.isTerminated());
+ FSHelperLibrary.terminate();
+ }
+ }
+ catch (FSHelperException e)
+ {
+ FSHelperLibrary.logError(e.getMessage(), e);
+ }
+ }
+
+ }
\ No newline at end of file
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/RSA Key Pair Generation Sample Tool.zip b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/RSA Key Pair Generation Sample Tool.zip
new file mode 100644
index 0000000..edb199e
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/RSA Key Pair Generation Sample Tool.zip differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Unprotect Any File using Elevated EA.pptx b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Unprotect Any File using Elevated EA.pptx
new file mode 100644
index 0000000..91cfc94
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Unprotect Any File using Elevated EA.pptx differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Use Elevated Enterprise Application to Unprotect Any File - Technical Document.docx b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Use Elevated Enterprise Application to Unprotect Any File - Technical Document.docx
new file mode 100644
index 0000000..816acf0
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Appendix - Unprotect Any File using Elevated EA/Use Elevated Enterprise Application to Unprotect Any File - Technical Document.docx differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/Readme.txt b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/Readme.txt
new file mode 100644
index 0000000..4c4f2b3
--- /dev/null
+++ b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/Readme.txt
@@ -0,0 +1,22 @@
+
+Unprotect & Unwrap in EA context Sample App
+===========================================
+
+Deployment Steps:
+------------------
+1. make sure your policy server is running . This app requires java 8 or above to run so make
+ sure java 8 or above is installed.
+
+2. go inside 'bin/Unprotect & Unwrap in EA context Sample App'
+
+3. Configure the 'tenant config.xml' in 'config/'
+ a. Policy Server Details:
+ server : Server name on which Policy Server is running
+ port : Server Port on which Policy Server is running
+ app-name : Policy Server application name
+
+ b. fill hot folder details i.e id and passphrase
+
+4. If you are using java 8 , put libs present inside 'doc/JCE Files/java8' into 'bin/Unprotect & Unwrap in EA context Sample App/lib'
+
+5. click on run.bat to start sample app , follow instruction on terminal
\ No newline at end of file
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/config/config.xml b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/config/config.xml
new file mode 100644
index 0000000..b148308
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/config/config.xml differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/config/log4j.properties b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/config/log4j.properties
new file mode 100644
index 0000000..8293be6
--- /dev/null
+++ b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/config/log4j.properties
@@ -0,0 +1,15 @@
+
+log4j.category.WSCLIENT=debug, WSCLIENT
+
+# If we want to change the Appender, we have to change
+# UtilFunction.initializeLoggers() too, because it assumes that the appender
+# is 'org.apache.log4j.RollingFileAppender' and changes path of the file by
+# getting appender from this logger.
+log4j.appender.WSCLIENT=com.seclore.fs.ws.client.logger.DailyZippedRollingFileAppender
+# Path of the file should be relative to application ROOT
+log4j.appender.WSCLIENT.File=logs/WSClient.log
+log4j.appender.WSCLIENT.MaxFileSize=10MB
+#log4j.appender.REQUEST_LOGGER.MaxBackupIndex=10
+log4j.appender.WSCLIENT.DatePattern='_'yyyy-MM-dd
+log4j.appender.WSCLIENT.layout=org.apache.log4j.PatternLayout
+log4j.appender.WSCLIENT.layout.ConversionPattern=%d{MMM dd, yyyy HH:mm:ss.SSS} %F:%L%n%p: %m%n
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/config/log4j2.xml b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/config/log4j2.xml
new file mode 100644
index 0000000..6902efe
--- /dev/null
+++ b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/config/log4j2.xml
@@ -0,0 +1,43 @@
+
+
+
+
+
+ ${ctx:applicationPath}/logs
+
+
+
+
+
+
+
+
+
+
+
+
+ UTF-8
+ %d{MMM dd, yyyy HH:mm:ss.SSS} :%t %n%p: %m%n
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/config/tenant config.xml b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/config/tenant config.xml
new file mode 100644
index 0000000..bbd0c13
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/config/tenant config.xml differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/US_export_policy.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/US_export_policy.jar
new file mode 100644
index 0000000..7173213
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/US_export_policy.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/US_export_policy_2.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/US_export_policy_2.jar
new file mode 100644
index 0000000..251b102
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/US_export_policy_2.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/bc-fips-1.0.0.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/bc-fips-1.0.0.jar
new file mode 100644
index 0000000..321e563
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/bc-fips-1.0.0.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/commons-codec-1.6.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/commons-codec-1.6.jar
new file mode 100644
index 0000000..ee1bc49
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/commons-codec-1.6.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/disruptor-3.3.7.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/disruptor-3.3.7.jar
new file mode 100644
index 0000000..1777a37
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/disruptor-3.3.7.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/fs-smaillibrary.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/fs-smaillibrary.jar
new file mode 100644
index 0000000..aa95e22
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/fs-smaillibrary.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/fs-ws-client-4.4.7.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/fs-ws-client-4.4.7.jar
new file mode 100644
index 0000000..bf2adcf
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/fs-ws-client-4.4.7.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/juniversalchardet-1.0.3.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/juniversalchardet-1.0.3.jar
new file mode 100644
index 0000000..1af703f
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/juniversalchardet-1.0.3.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/local_policy.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/local_policy.jar
new file mode 100644
index 0000000..c34d036
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/local_policy.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/local_policy_2.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/local_policy_2.jar
new file mode 100644
index 0000000..1c58939
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/local_policy_2.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/log4j-1.2.14.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/log4j-1.2.14.jar
new file mode 100644
index 0000000..6251307
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/log4j-1.2.14.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/log4j-api-2.10.0.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/log4j-api-2.10.0.jar
new file mode 100644
index 0000000..9603b1b
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/log4j-api-2.10.0.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/log4j-core-2.10.0.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/log4j-core-2.10.0.jar
new file mode 100644
index 0000000..1be9e67
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/log4j-core-2.10.0.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/sample-app.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/sample-app.jar
new file mode 100644
index 0000000..783f3d3
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/sample-app.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/xercesImpl-X.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/xercesImpl-X.jar
new file mode 100644
index 0000000..38fca83
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/xercesImpl-X.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/logs/WSClient.log b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/logs/WSClient.log
new file mode 100644
index 0000000..1982057
--- /dev/null
+++ b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/logs/WSClient.log
@@ -0,0 +1,25 @@
+FileSecure Version is 4.4.7.0
+Jul 19, 2021 12:31:33.603 :main
+INFO: WSCLIENT logger is initialized
+Jul 19, 2021 12:31:33.609 :main
+INFO: -1SDK Logger is initialized
+Jul 19, 2021 12:31:33.610 :main
+INFO: -1FSHelperLibrary::initializeSuccessfully Initialized helper library.
+Jul 19, 2021 12:32:16.087 :main
+INFO: WSCLIENT logger is initialized
+Jul 19, 2021 12:32:16.093 :main
+INFO: -1SDK Logger is initialized
+Jul 19, 2021 12:32:16.095 :main
+INFO: -1FSHelperLibrary::initializeSuccessfully Initialized helper library.
+Jul 19, 2021 12:36:54.076 :main
+INFO: WSCLIENT logger is initialized
+Jul 19, 2021 12:36:54.080 :main
+INFO: -1SDK Logger is initialized
+Jul 19, 2021 12:36:54.080 :main
+INFO: -1FSHelperLibrary::initializeSuccessfully Initialized helper library.
+Jul 19, 2021 12:37:14.966 :main
+INFO: WSCLIENT logger is initialized
+Jul 19, 2021 12:37:14.970 :main
+INFO: -1SDK Logger is initialized
+Jul 19, 2021 12:37:14.972 :main
+INFO: -1FSHelperLibrary::initializeSuccessfully Initialized helper library.
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/run.bat b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/run.bat
new file mode 100644
index 0000000..2bf9ca8
--- /dev/null
+++ b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/run.bat
@@ -0,0 +1,16 @@
+@echo off
+set "CURRENT_DIR=%cd%"
+echo ---------------------------------------------------------------
+echo Seclore 'Unprotect and Unwrap in EA context Sample App' Utility
+echo ---------------------------------------------------------------
+echo.
+
+rem if your want to run on a different jdk or java path is not configured uncomment below line
+rem for example ,
+rem set path="C:\Program Files\Java\jdk-11.0.1\bin";
+java -version
+echo.
+REM uncomment below line to see the version of sample app i.e( remove REM mentioned below)
+REM java -cp "./lib/sample-app.jar"; com.seclore.fs.protect.example.Version
+ java -cp "./lib/*"; com.seclore.fs.protect.example.main.SecloreMain
+pause
\ No newline at end of file
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/doc/Developer_s Reference.txt b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/doc/Developer_s Reference.txt
new file mode 100644
index 0000000..d49ade4
--- /dev/null
+++ b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/doc/Developer_s Reference.txt
@@ -0,0 +1,37 @@
+FileSecure Interfaces integration source code reference.
+
+FS Helper Initialization
+------------------------
+ - At application startup initializing FSHelperlibrary and FSHelper
+ - Below classes are used for the same
+ - SecloreMain
+ - static block :-
+ InitializeWSClient.initializeHelperLibrary((FSHELPERLIBRARY_CONFIG_XML_PATH, ););
+ InitializeWSClient.initializeHelper(HELPER_INSTANCE_KEY, FSHELPER_RESOURCE_PATH, FSHELPER_CONFIG_XML_PATH, );
+ - InitializeWSClient
+ - initializeHelperLibrary( ... )
+ - initializeHelper( ... )
+
+
+
+Main Class
+------------
+ - com.seclore.fs.protect.example.main
+ - SecloreMain class
+
+Note:
+=====
+while preparing xml string for request or response. please escape below spacial character for the string which will be written within xml tag.
+ "&" -> "&"
+ "<" -> "<"
+ ">", -> ">"
+ "\"" -> """
+ "'" -> "'";
+
+ Refer: com.seclore.fs.protect.example.util.XMLUtil class and
+ - escapeForXML () method
+
+Example: sample xml is "Sample Sales & purchase report.pdf"
+ here "Sample Sales and purchase report" should be escaped.
+ Use: String fileName = XMLHelper.escapeForXML( "Sample Sales & purchase report" );
+ ""+fileName+""
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/doc/JCE Files/Java7/US_export_policy.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/doc/JCE Files/Java7/US_export_policy.jar
new file mode 100644
index 0000000..7173213
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/doc/JCE Files/Java7/US_export_policy.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/doc/JCE Files/Java7/local_policy.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/doc/JCE Files/Java7/local_policy.jar
new file mode 100644
index 0000000..c34d036
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/doc/JCE Files/Java7/local_policy.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/doc/JCE Files/Java8/US_export_policy.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/doc/JCE Files/Java8/US_export_policy.jar
new file mode 100644
index 0000000..251b102
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/doc/JCE Files/Java8/US_export_policy.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/doc/JCE Files/Java8/local_policy.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/doc/JCE Files/Java8/local_policy.jar
new file mode 100644
index 0000000..1c58939
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/doc/JCE Files/Java8/local_policy.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/.classpath b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/.classpath
new file mode 100644
index 0000000..8960a2e
--- /dev/null
+++ b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/.classpath
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/.project b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/.project
new file mode 100644
index 0000000..adbd983
--- /dev/null
+++ b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/.project
@@ -0,0 +1,17 @@
+
+
+ Unprotect & Unwrap in EA context Sample App Code
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+
+
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/.settings/org.eclipse.jdt.core.prefs b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..3a21537
--- /dev/null
+++ b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,11 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/bin/com/seclore/fs/protect/example/Version.class b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/bin/com/seclore/fs/protect/example/Version.class
new file mode 100644
index 0000000..694b590
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/bin/com/seclore/fs/protect/example/Version.class differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/bin/com/seclore/fs/protect/example/core/InitializeWSClient.class b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/bin/com/seclore/fs/protect/example/core/InitializeWSClient.class
new file mode 100644
index 0000000..e94d4de
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/bin/com/seclore/fs/protect/example/core/InitializeWSClient.class differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/bin/com/seclore/fs/protect/example/main/SecloreMain.class b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/bin/com/seclore/fs/protect/example/main/SecloreMain.class
new file mode 100644
index 0000000..20f880e
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/bin/com/seclore/fs/protect/example/main/SecloreMain.class differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/config/config.xml b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/config/config.xml
new file mode 100644
index 0000000..610e0c5
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/config/config.xml differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/config/log4j.properties b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/config/log4j.properties
new file mode 100644
index 0000000..8293be6
--- /dev/null
+++ b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/config/log4j.properties
@@ -0,0 +1,15 @@
+
+log4j.category.WSCLIENT=debug, WSCLIENT
+
+# If we want to change the Appender, we have to change
+# UtilFunction.initializeLoggers() too, because it assumes that the appender
+# is 'org.apache.log4j.RollingFileAppender' and changes path of the file by
+# getting appender from this logger.
+log4j.appender.WSCLIENT=com.seclore.fs.ws.client.logger.DailyZippedRollingFileAppender
+# Path of the file should be relative to application ROOT
+log4j.appender.WSCLIENT.File=logs/WSClient.log
+log4j.appender.WSCLIENT.MaxFileSize=10MB
+#log4j.appender.REQUEST_LOGGER.MaxBackupIndex=10
+log4j.appender.WSCLIENT.DatePattern='_'yyyy-MM-dd
+log4j.appender.WSCLIENT.layout=org.apache.log4j.PatternLayout
+log4j.appender.WSCLIENT.layout.ConversionPattern=%d{MMM dd, yyyy HH:mm:ss.SSS} %F:%L%n%p: %m%n
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/config/log4j2.xml b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/config/log4j2.xml
new file mode 100644
index 0000000..6902efe
--- /dev/null
+++ b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/config/log4j2.xml
@@ -0,0 +1,43 @@
+
+
+
+
+
+ ${ctx:applicationPath}/logs
+
+
+
+
+
+
+
+
+
+
+
+
+ UTF-8
+ %d{MMM dd, yyyy HH:mm:ss.SSS} :%t %n%p: %m%n
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/config/tenant config.xml b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/config/tenant config.xml
new file mode 100644
index 0000000..350ad86
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/config/tenant config.xml differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/lib/bc-fips-1.0.2.3.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/lib/bc-fips-1.0.2.3.jar
new file mode 100644
index 0000000..1a8c5de
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/lib/bc-fips-1.0.2.3.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/lib/commons-codec-1.6.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/lib/commons-codec-1.6.jar
new file mode 100644
index 0000000..ee1bc49
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/lib/commons-codec-1.6.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/lib/disruptor-3.3.7.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/lib/disruptor-3.3.7.jar
new file mode 100644
index 0000000..1777a37
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/lib/disruptor-3.3.7.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/lib/fs-smaillibrary.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/lib/fs-smaillibrary.jar
new file mode 100644
index 0000000..0cb2298
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/lib/fs-smaillibrary.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/lib/fs-ws-client.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/lib/fs-ws-client.jar
new file mode 100644
index 0000000..cbda191
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/lib/fs-ws-client.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/lib/juniversalchardet-1.0.3.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/lib/juniversalchardet-1.0.3.jar
new file mode 100644
index 0000000..1af703f
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/lib/juniversalchardet-1.0.3.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/lib/log4j-api-2.17.1.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/lib/log4j-api-2.17.1.jar
new file mode 100644
index 0000000..1aae243
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/lib/log4j-api-2.17.1.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/lib/log4j-core-2.17.1.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/lib/log4j-core-2.17.1.jar
new file mode 100644
index 0000000..4682527
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/lib/log4j-core-2.17.1.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/lib/seclore-io-1.0.0.0.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/lib/seclore-io-1.0.0.0.jar
new file mode 100644
index 0000000..365237b
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/lib/seclore-io-1.0.0.0.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/lib/xercesImpl-X.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/lib/xercesImpl-X.jar
new file mode 100644
index 0000000..38fca83
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/lib/xercesImpl-X.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/src/com/seclore/fs/protect/example/Version.java b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/src/com/seclore/fs/protect/example/Version.java
new file mode 100644
index 0000000..df17df2
--- /dev/null
+++ b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/src/com/seclore/fs/protect/example/Version.java
@@ -0,0 +1,23 @@
+package com.seclore.fs.protect.example;
+
+/**
+ * Represents the Sample App version.
+ */
+public class Version
+{
+ /**
+ * The version of the Sample App.
+ */
+ public static final String Version = "3.0.0.0";
+
+ /**
+ * Displays the version of the Sample App
+ *
+ * @param args
+ */
+ public static void main(String[] args)
+ {
+ System.out.println("Sample App version : " + Version);
+ System.out.println("Copyright (c) 2008 Seclore Technology Pvt. Ltd.");
+ }
+}
\ No newline at end of file
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/src/com/seclore/fs/protect/example/core/InitializeWSClient.java b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/src/com/seclore/fs/protect/example/core/InitializeWSClient.java
new file mode 100644
index 0000000..b49cd74
--- /dev/null
+++ b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/src/com/seclore/fs/protect/example/core/InitializeWSClient.java
@@ -0,0 +1,240 @@
+package com.seclore.fs.protect.example.core;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringWriter;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.mozilla.universalchardet.UniversalDetector;
+import org.w3c.dom.Document;
+import org.xml.sax.InputSource;
+
+import com.seclore.fs.helper.exception.FSHelperException;
+import com.seclore.fs.helper.library.FSHelperLibrary;
+
+public class InitializeWSClient
+{
+ /**
+ * @param configPath
+ * Takes the application config file path as input
+ * @throws Exception
+ */
+ public static void initializeHelperLibrary(String configPath) throws Exception
+ {
+ try
+ {
+ String configContentXMLString = getConfigFileContent( configPath );
+ // Initialize method takes WSClient config content not the config file path.
+ FSHelperLibrary.initialize( configContentXMLString );
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @param helperId
+ * Tenant Id
+ * @param helperResourcePath
+ * Resource Path for files of Seclore Policy Server. To be left empty here.
+ * @param helperConfigPath
+ * File path for 'tenant config.xml' file
+ * @throws Exception
+ * Code snippet won't run if any exception is thrown in this block
+ */
+ public static void initializeHelper(String pHelperId, String pHelperResourcePath, String pHelperConfigPath) throws Exception
+ {
+ try
+ {
+ String configContentXMLString = getConfigFileContent( pHelperConfigPath );
+ // Initialize method takes WSClient config content not the config file path.
+ FSHelperLibrary.initializeHelper(pHelperId, pHelperResourcePath, configContentXMLString);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * This method reads an XML file and returns the content of the XML file in string format
+ * @param appPath
+ * XML file path
+ * @return File content in string format
+ * @throws Exception
+ */
+ private static String getConfigFileContent( String pAppPath ) throws Exception
+ {
+ validateConfigFile( pAppPath );
+
+ InputStream inputStream = null;
+ try
+ {
+ String lstrEncoding = detectEncoding(pAppPath);
+ if( lstrEncoding == null || lstrEncoding.trim().isEmpty() )
+ {
+ lstrEncoding = "UTF-8";
+ }
+
+ DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
+ builderFactory.setNamespaceAware(false);
+ builderFactory.setValidating(false);
+ DocumentBuilder builder = builderFactory.newDocumentBuilder();
+ inputStream = new FileInputStream(pAppPath);
+ InputSource lInputSource = new InputSource( inputStream );
+ lInputSource.setEncoding(lstrEncoding);
+ Document document = builder.parse( lInputSource );
+
+
+ TransformerFactory lTransFactory = TransformerFactory.newInstance();
+ Transformer lTrans = lTransFactory.newTransformer();
+ DOMSource lSource = new DOMSource(document);
+ StringWriter lStringWriter = new StringWriter();
+ lTrans.transform( lSource, new StreamResult( lStringWriter ) );
+ return lStringWriter.toString();
+ }
+ catch (Exception e)
+ {
+ System.out.println("*** Config file should be in UTF-16LE encoding ***");
+ e.printStackTrace();
+ System.exit(0);
+ }
+ finally
+ {
+ if(inputStream != null)
+ {
+ try{
+ inputStream.close();
+ }
+ catch(IOException ioException)
+ {
+ //ignore
+ }
+ }
+ }
+ return "";
+ }
+
+ /**
+ * Validates whether the file exists at the given location & has valid BOM format
+ * @param configFilePath
+ * @throws Exception
+ * @return The file object representing the configFilePath
+ */
+ private static File validateConfigFile(String configFilePath) throws Exception
+ {
+
+ if ( configFilePath == null || configFilePath.trim().isEmpty() )
+ {
+ throw new Exception("Configuration File path is not provided.");
+ }
+
+ File file = new File(configFilePath);
+ if ( !file.exists() )
+ {
+ throw new Exception("Configuration File does not exist at '"+ file.getAbsolutePath() + "'");
+ }
+
+ if( !file.isFile() )
+ {
+ throw new Exception("'" + file.getAbsolutePath() + "' is not a file.");
+ }
+
+ // Length 3 is checked to make sure that enough bytes are available for
+ // BOM reading.
+ if (file.length() < 3)
+ {
+ throw new Exception("'" + file.getAbsolutePath() + "' is not a valid configuration file.");
+ }
+ return file;
+ }
+
+ /**
+ * Detect encoding format of file
+ * @param pConfigXmlPath
+ * File path whose encoding type is to be detected
+ * @return encoding format (eg: utf-8, utf-16)
+ */
+ public static String detectEncoding(String pConfigXmlPath)
+ {
+ FileInputStream lFis = null;
+ try
+ {
+ lFis = new FileInputStream(pConfigXmlPath);
+ UniversalDetector lDetector = new UniversalDetector(null);
+ byte[] lBuff = new byte[512];
+ int liread;
+ while( (liread = lFis.read(lBuff)) > 0 && !lDetector.isDone() )
+ {
+ lDetector.handleData(lBuff, 0, liread);
+ }
+ lDetector.dataEnd();
+ String lstrEncoding = lDetector.getDetectedCharset();
+ lDetector.reset();
+ return lstrEncoding;
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ finally
+ {
+ if ( lFis != null)
+ {
+ try
+ {
+ lFis.close();
+ } catch (IOException e) {
+ // Igniore
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Terminate the created session and reset the initialized Server SDK library.
+ */
+ public static void terminateWSClient()
+ {
+ try
+ {
+ FSHelperLibrary.logInfo("Terminating FSHelper Library");
+ if(FSHelperLibrary.isTerminated() == false)
+ {
+ System.out.println("FSHelperLibrary.isTerminated(): " + FSHelperLibrary.isTerminated());
+ FSHelperLibrary.terminate();
+ }
+ }
+ catch (FSHelperException e)
+ {
+ FSHelperLibrary.logError(e.getMessage(), e);
+ }
+ }
+
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/src/com/seclore/fs/protect/example/main/SecloreMain.java b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/src/com/seclore/fs/protect/example/main/SecloreMain.java
new file mode 100644
index 0000000..051852a
--- /dev/null
+++ b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/src/com/seclore/fs/protect/example/main/SecloreMain.java
@@ -0,0 +1,118 @@
+package com.seclore.fs.protect.example.main;
+
+import java.util.Scanner;
+
+import com.seclore.fs.helper.core.UnprotectedFile;
+import com.seclore.fs.helper.library.FSHelper;
+import com.seclore.fs.helper.library.FSHelperLibrary;
+import com.seclore.fs.protect.example.core.InitializeWSClient;
+
+public class SecloreMain
+{
+ //# FS Helper library is multi-tenant. Use unique tenant identifier for each tenant
+ private static String tenantID = "Tenant-1";
+
+ //# This file contains information about the Application into which this code snippet is to be integrated.
+ private static final String appConfigXMLFilePath = "config/config.xml";
+
+ //# This file contains info for creating session with Seclore Policy Server and initializing Server SDK library
+ private static final String tenantConfigXMLFilePath = "config/tenant config.xml";
+
+ //# Used to take user input
+ private static Scanner scanner = null;
+
+ /**
+ *
This block initializes the Server SDK library and creates a session with Seclore Policy Server
+ * @exception Code snippet won't run if any exception is thrown in this block.
+ */
+ static
+ {
+ try
+ {
+ InitializeWSClient.initializeHelperLibrary(appConfigXMLFilePath);
+ InitializeWSClient.initializeHelper(tenantID, "", tenantConfigXMLFilePath);
+ scanner = new Scanner(System.in);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ System.exit(0);
+ }
+ }
+
+ //# Entry point to run this application
+ public static void main(String[] args)
+ {
+ try
+ {
+ String outputFilePath = UnwrapAndunprotectFile();
+
+ if( outputFilePath != null && !outputFilePath.trim().isEmpty() )
+ {
+ System.out.println("File '" + outputFilePath + "' is unwrapped and unprotected successfully");
+ }
+ else
+ {
+ throw new Exception("Unexpected error");
+ }
+
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ finally
+ {
+ if( scanner != null )
+ {
+ scanner.close();
+ }
+
+ InitializeWSClient.terminateWSClient();
+ }
+
+ }
+
+ /**
+ * unprotect and unWrap a file using Seclore SDK
+ * @return the absolute file path of unprotected file
+ * @throws Exception
+ */
+ public static String UnwrapAndunprotectFile() throws Exception
+ {
+ System.out.println("Enter absolute path of the file to be unwrapped & unprotected:");
+ String wrappedAndProtectedFilePath = scanner.nextLine();
+
+ //# get the FSHelper object by specifying the tenantId.
+ //note: This tenant id should be same which was used during initialization of Seclore SDK
+ FSHelper tenantObj = FSHelperLibrary.getHelper(tenantID);
+
+ //throw error if the file is not HTML wrapped
+ if(tenantObj.isHTMLWrapped(wrappedAndProtectedFilePath) == false)
+ {
+ throw new Exception("File '" + wrappedAndProtectedFilePath + "' is not HTML wrapped");
+ }
+
+ //# this display file name goes in activity log
+ // for more details see javadoc of FSHelper.unwrapAndUnprotect()
+ String displayFilePath = wrappedAndProtectedFilePath;
+ //# activity comments to be shown
+ String actvityComments = "Unprotected by using FS Helper Library's unwrapAndUnprotect method";
+
+ //# calling Seclore SDK's unwrapAndUnprotect api
+ UnprotectedFile unprotectedFile = tenantObj.unwrapAndUnprotect(null,
+ wrappedAndProtectedFilePath,
+ displayFilePath,
+ actvityComments);
+ return unprotectedFile.getFilePath();
+ }
+
+}
+
+
+
+
+
+
+
+
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Unwrap & Unprotect Sample Code Walkthrough.mp4 b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Unwrap & Unprotect Sample Code Walkthrough.mp4
new file mode 100644
index 0000000..6a32104
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Unwrap & Unprotect Sample Code Walkthrough.mp4 differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Unwrap and Unprotect in EA context - Enterprise Policy Server.pptx b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Unwrap and Unprotect in EA context - Enterprise Policy Server.pptx
new file mode 100644
index 0000000..b21e371
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/Unwrap and Unprotect in EA context - Enterprise Policy Server.pptx differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/scripts/build.sh b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/scripts/build.sh
new file mode 100644
index 0000000..50c5566
--- /dev/null
+++ b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/scripts/build.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+set -e
+
+# Set the project root directory
+PROJECT_ROOT=$(dirname "$0")/..
+
+# Clean all bin folders
+rm -rf "$PROJECT_ROOT/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/config"/*
+rm -rf "$PROJECT_ROOT/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib"/*
+
+# Clear the src/bin dir containing compiled class files
+rm -rf "$PROJECT_ROOT/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/bin"/*
+
+#find and compile all java files
+find "$PROJECT_ROOT/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/src" -name "*.java" -exec javac -d "$PROJECT_ROOT/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/bin" -cp "$PROJECT_ROOT/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/lib/*" {} +
+
+# Package the compiled classes into a JAR file
+jar cvf "$PROJECT_ROOT/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/sample-app.jar" -C "$PROJECT_ROOT/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/bin" .
+
+# Copy all libs and config files to bin
+cp -r "$PROJECT_ROOT/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/lib"/* "$PROJECT_ROOT/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib"
+cp -r "$PROJECT_ROOT/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/config"/* "$PROJECT_ROOT/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/config"
\ No newline at end of file
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/scripts/test.sh b/examples/Java/3. Unwrap & Unprotect in EA context/Using Enterprise Policy Server/scripts/test.sh
new file mode 100644
index 0000000..e69de29
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/Readme.txt b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/Readme.txt
new file mode 100644
index 0000000..c48caf0
--- /dev/null
+++ b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/Readme.txt
@@ -0,0 +1,57 @@
+=======================================
+Get Advanced EA Helper
+=======================================
+
+---------------------------
+Pre-requisites/Assumptions
+---------------------------
+1) Seclore Policy Server is up and running.
+3) An Elevated Enterprise Application (EA) is configured on the Seclore Policy Server.
+4) This utility is configured to run with Seclore Server SDK (4.4.7.0)
+
+
+
+------
+Notes
+------
+1) To use current working directory as the Application Path in '/config/config.xml' file, use "."
+ e.g .
+
+ Otherwise, enter the complete absolute path
+ e.g C:\Seclore\Elevated EA Utility\Source
+
+2) Sample public and private key xml files used to set up an Elevated EA have also been provided at :
+ 'Elevated EA Utility/Docs/samples/publicKey.xml'
+ 'Elevated EA Utility/Docs/samples/privateKey.xml'
+
+------------------
+Configuration Steps:
+------------------
+1. Put the JCE jar files (specific to JRE version) from 'Elevated EA Utility/Docs/JCE Files/' into 'JRE/lib/security/' folder of the system. This utility requires JDK version 1.8 or higher to run. The utility displays the JDK version it uses when you execute the 'run.bat' file.
+
+2. Configure the 'config.xml' file located in 'Elevated EA Utility/Source/config/'.
+ a. app-path : This is the absolute path of the application
+ - place a dot "." or put the absolute application path
+ - example: C:\Seclore\Seclore SDK Sample Code\Source
+ b. initalize-logger : This can be true/false depending upon the logging implementation.
+
+3. Configure the 'tenant config.xml' located in 'Elevated EA Utility/Source/config/'
+ a. Policy Server Details:
+ server : Server name on which Policy Server is running
+ port : Server Port on which Policy Server is running
+ app-name : Policy Server application name
+
+ b. Login details:
+ When using Hot Folder cabinet (EA) context i.e (1) :
+ id : ID of the Elevated Enterprise Application (EA) on the Seclore Policy Server.
+ passphrase : Passphrase of the Elevated Enterprise Application.
+ allow-advanced-privileges : 'false' by default. To enable advanced privileges for this EA, set this to 'true'
+
+3. Populate the 'config.properties' in 'Elevated EA Utility/Source/config/'. Some values are pre-populated which must not be changed.
+ ea.active.key.id : Elevated EA active key id which is displayed on EA config details page on Policy Server portal under the "Advanced Security" section titled 'Active Key ID'.
+
+ ea.private.key.xml.path : The absolute path of the private key xml file whose public key was used to configure the Elevated EA.
+ eg. ea.private.key.xml.path=C:\\Users\\Desktop\\EA Advanced Security Keys\\privateKeyXML.xml
+
+
+
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/Readme.txt b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/Readme.txt
new file mode 100644
index 0000000..893cdc6
--- /dev/null
+++ b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/Readme.txt
@@ -0,0 +1,60 @@
+=======================================
+Get Advanced EA Helper
+=======================================
+
+---------------------------
+Pre-requisites/Assumptions
+---------------------------
+1) Seclore Policy Server is up and running.
+3) An Elevated Enterprise Application (EA) is configured on the Seclore Policy Server.
+4) This utility is configured to run with Seclore Server SDK (4.4.7.0)
+
+
+
+------
+Notes
+------
+1) To use current working directory as the Application Path in '/config/config.xml' file, use "."
+ e.g .
+
+ Otherwise, enter the complete absolute path
+ e.g C:\Seclore\Elevated EA Utility\Source
+
+2) Sample public and private key xml files used to set up an Elevated EA have also been provided at :
+ 'Elevated EA Utility/Docs/samples/publicKey.xml'
+ 'Elevated EA Utility/Docs/samples/privateKey.xml'
+
+------------------
+Configuration Steps:
+------------------
+1. Put the JCE jar files (specific to JRE version) from 'Elevated EA Utility/Docs/JCE Files/' into 'JRE/lib/security/' folder of the system. This utility requires JDK version 1.8 or higher to run. The utility displays the JDK version it uses when you execute the 'run.bat' file.
+
+2. Configure the 'config.xml' file located in 'Elevated EA Utility/Source/config/'.
+ a. app-path : This is the absolute path of the application
+ - place a dot "." or put the absolute application path
+ - example: C:\Seclore\Seclore SDK Sample Code\Source
+ b. initalize-logger : This can be true/false depending upon the logging implementation.
+
+3. Configure the 'tenant config.xml' located in 'Elevated EA Utility/Source/config/'
+ a. Policy Server Details:
+ server : Server name on which Policy Server is running
+ port : Server Port on which Policy Server is running
+ app-name : Policy Server application name
+
+ b. Login details:
+ When using Hot Folder cabinet (EA) context i.e (1) :
+ id : ID of the Elevated Enterprise Application (EA) on the Seclore Policy Server.
+ passphrase : Passphrase of the Elevated Enterprise Application.
+ allow-advanced-privileges : 'false' by default. To enable advanced privileges for this EA, set this to 'true'
+
+3. Populate the 'config.properties' in 'Elevated EA Utility/Source/config/'. Some values are pre-populated which must not be changed.
+ ea.active.key.id : Elevated EA active key id which is displayed on EA config details page on Policy Server portal under the "Advanced Security" section titled 'Active Key ID'.
+
+ ea.private.key.xml.path : The absolute path of the private key xml file whose public key was used to configure the Elevated EA.
+ eg. ea.private.key.xml.path=C:\\Users\\Desktop\\EA Advanced Security Keys\\privateKeyXML.xml
+
+4. Execute "run.bat" to get the utility running.
+
+
+
+
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/config/config.properties b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/config/config.properties
new file mode 100644
index 0000000..e9e5022
--- /dev/null
+++ b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/config/config.properties
@@ -0,0 +1,6 @@
+#config details of logged in EA (visible in PS Portal)
+ea.active.key.id=
+ea.private.key.xml.path=
+ea.key.chaining.mode=ECB
+ea.key.padding.scheme=PKCS1Padding
+ea.key.length=256
\ No newline at end of file
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/config/config.xml b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/config/config.xml
new file mode 100644
index 0000000..9cc30b9
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/config/config.xml differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/config/log4j.properties b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/config/log4j.properties
new file mode 100644
index 0000000..8293be6
--- /dev/null
+++ b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/config/log4j.properties
@@ -0,0 +1,15 @@
+
+log4j.category.WSCLIENT=debug, WSCLIENT
+
+# If we want to change the Appender, we have to change
+# UtilFunction.initializeLoggers() too, because it assumes that the appender
+# is 'org.apache.log4j.RollingFileAppender' and changes path of the file by
+# getting appender from this logger.
+log4j.appender.WSCLIENT=com.seclore.fs.ws.client.logger.DailyZippedRollingFileAppender
+# Path of the file should be relative to application ROOT
+log4j.appender.WSCLIENT.File=logs/WSClient.log
+log4j.appender.WSCLIENT.MaxFileSize=10MB
+#log4j.appender.REQUEST_LOGGER.MaxBackupIndex=10
+log4j.appender.WSCLIENT.DatePattern='_'yyyy-MM-dd
+log4j.appender.WSCLIENT.layout=org.apache.log4j.PatternLayout
+log4j.appender.WSCLIENT.layout.ConversionPattern=%d{MMM dd, yyyy HH:mm:ss.SSS} %F:%L%n%p: %m%n
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/config/log4j2.xml b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/config/log4j2.xml
new file mode 100644
index 0000000..6902efe
--- /dev/null
+++ b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/config/log4j2.xml
@@ -0,0 +1,43 @@
+
+
+
+
+
+ ${ctx:applicationPath}/logs
+
+
+
+
+
+
+
+
+
+
+
+
+ UTF-8
+ %d{MMM dd, yyyy HH:mm:ss.SSS} :%t %n%p: %m%n
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/config/tenant config.xml b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/config/tenant config.xml
new file mode 100644
index 0000000..a88ffcc
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/config/tenant config.xml differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/lib/bc-fips-1.0.0.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/lib/bc-fips-1.0.0.jar
new file mode 100644
index 0000000..321e563
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/lib/bc-fips-1.0.0.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/lib/commons-codec-1.6.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/lib/commons-codec-1.6.jar
new file mode 100644
index 0000000..ee1bc49
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/lib/commons-codec-1.6.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/lib/disruptor-3.3.7.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/lib/disruptor-3.3.7.jar
new file mode 100644
index 0000000..1777a37
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/lib/disruptor-3.3.7.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/lib/fs-smaillibrary.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/lib/fs-smaillibrary.jar
new file mode 100644
index 0000000..aa95e22
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/lib/fs-smaillibrary.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/lib/fs-ws-client-4.4.7.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/lib/fs-ws-client-4.4.7.jar
new file mode 100644
index 0000000..bf2adcf
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/lib/fs-ws-client-4.4.7.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/lib/juniversalchardet-1.0.3.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/lib/juniversalchardet-1.0.3.jar
new file mode 100644
index 0000000..1af703f
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/lib/juniversalchardet-1.0.3.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/lib/log4j-1.2.14.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/lib/log4j-1.2.14.jar
new file mode 100644
index 0000000..6251307
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/lib/log4j-1.2.14.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/lib/log4j-api-2.10.0.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/lib/log4j-api-2.10.0.jar
new file mode 100644
index 0000000..9603b1b
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/lib/log4j-api-2.10.0.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/lib/log4j-core-2.10.0.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/lib/log4j-core-2.10.0.jar
new file mode 100644
index 0000000..1be9e67
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/lib/log4j-core-2.10.0.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/lib/sample-app.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/lib/sample-app.jar
new file mode 100644
index 0000000..90af6de
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/lib/sample-app.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/lib/xercesImpl-X.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/lib/xercesImpl-X.jar
new file mode 100644
index 0000000..38fca83
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/lib/xercesImpl-X.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/run.bat b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/run.bat
new file mode 100644
index 0000000..98082e8
--- /dev/null
+++ b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/bin/run.bat
@@ -0,0 +1,14 @@
+@echo off
+set "CURRENT_DIR=%cd%"
+echo -------------------------------------------------------
+echo Seclore 'Get Advanced EA Helper' Utility
+echo -------------------------------------------------------
+echo.
+java -version
+echo.
+
+REM uncomment below line to see the version of sample app i.e( remove REM mentioned below)
+REM java -cp "./lib/sample-app.jar"; com.seclore.fs.ea.advanced.example.Version
+ java -cp "./lib/*"; com.seclore.fs.ea.advanced.example.main.SecloreMain
+pause
+
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/doc/Developer_s Reference.txt b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/doc/Developer_s Reference.txt
new file mode 100644
index 0000000..7bf2ed5
--- /dev/null
+++ b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/doc/Developer_s Reference.txt
@@ -0,0 +1,23 @@
+==========================================================
+FileSecure Interfaces integration source code reference
+==========================================================
+
+------------------------
+FS Helper Initialization
+------------------------
+ - At application startup, loading 'config.properties' file located in 'Seclore SDK Sample Code/Source/config'
+ - Then initializing FSHelperlibrary and FSHelper
+ - Below classes are used for the same
+ - SecloreMain
+ - static block :-
+ initializeHelperLibrary( FSHELPERLIBRARY_CONFIG_XML_PATH );
+ initializeHelper( HELPER_INSTANCE_KEY, FSHELPER_RESOURCE_PATH, FSHELPER_CONFIG_XML_PATH );
+ - Note that here since we are using an Elevated EA, we will also need to create an instance of 'DefaultCryptoHandler' to initilalize FSHelper.
+ eg. FSHelperLibrary.initializeHelper(TENANT_ID, FSHELPER_RESOURCE_PATH, FSHELPER_CONFIG_XML_CONTENT, DefaultCryptoHandler);
+
+
+------------
+Main Class
+------------
+ - com.seclore.fs.ea.advanced.example.main
+ - SecloreMain.java
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/doc/JCE Files/Java8/US_export_policy.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/doc/JCE Files/Java8/US_export_policy.jar
new file mode 100644
index 0000000..251b102
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/doc/JCE Files/Java8/US_export_policy.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/doc/JCE Files/Java8/local_policy.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/doc/JCE Files/Java8/local_policy.jar
new file mode 100644
index 0000000..1c58939
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/doc/JCE Files/Java8/local_policy.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/doc/samples/privateKey.xml b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/doc/samples/privateKey.xml
new file mode 100644
index 0000000..3c25134
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/doc/samples/privateKey.xml differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/doc/samples/publicKey.xml b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/doc/samples/publicKey.xml
new file mode 100644
index 0000000..517b12f
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/doc/samples/publicKey.xml differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/.classpath b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/.classpath
new file mode 100644
index 0000000..feb3dd0
--- /dev/null
+++ b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/.classpath
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/.project b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/.project
new file mode 100644
index 0000000..753a2b5
--- /dev/null
+++ b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/.project
@@ -0,0 +1,17 @@
+
+
+ Get Advanced EA Helper
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+
+
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/.settings/org.eclipse.jdt.core.prefs b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..3a21537
--- /dev/null
+++ b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,11 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/bin/com/seclore/fs/ea/advanced/example/Version.class b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/bin/com/seclore/fs/ea/advanced/example/Version.class
new file mode 100644
index 0000000..c569e52
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/bin/com/seclore/fs/ea/advanced/example/Version.class differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/bin/com/seclore/fs/ea/advanced/example/core/Config.class b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/bin/com/seclore/fs/ea/advanced/example/core/Config.class
new file mode 100644
index 0000000..eed4049
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/bin/com/seclore/fs/ea/advanced/example/core/Config.class differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/bin/com/seclore/fs/ea/advanced/example/main/SecloreMain.class b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/bin/com/seclore/fs/ea/advanced/example/main/SecloreMain.class
new file mode 100644
index 0000000..defee53
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/bin/com/seclore/fs/ea/advanced/example/main/SecloreMain.class differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/config/config.properties b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/config/config.properties
new file mode 100644
index 0000000..e9e5022
--- /dev/null
+++ b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/config/config.properties
@@ -0,0 +1,6 @@
+#config details of logged in EA (visible in PS Portal)
+ea.active.key.id=
+ea.private.key.xml.path=
+ea.key.chaining.mode=ECB
+ea.key.padding.scheme=PKCS1Padding
+ea.key.length=256
\ No newline at end of file
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/config/config.xml b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/config/config.xml
new file mode 100644
index 0000000..9cc30b9
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/config/config.xml differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/config/log4j.properties b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/config/log4j.properties
new file mode 100644
index 0000000..8293be6
--- /dev/null
+++ b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/config/log4j.properties
@@ -0,0 +1,15 @@
+
+log4j.category.WSCLIENT=debug, WSCLIENT
+
+# If we want to change the Appender, we have to change
+# UtilFunction.initializeLoggers() too, because it assumes that the appender
+# is 'org.apache.log4j.RollingFileAppender' and changes path of the file by
+# getting appender from this logger.
+log4j.appender.WSCLIENT=com.seclore.fs.ws.client.logger.DailyZippedRollingFileAppender
+# Path of the file should be relative to application ROOT
+log4j.appender.WSCLIENT.File=logs/WSClient.log
+log4j.appender.WSCLIENT.MaxFileSize=10MB
+#log4j.appender.REQUEST_LOGGER.MaxBackupIndex=10
+log4j.appender.WSCLIENT.DatePattern='_'yyyy-MM-dd
+log4j.appender.WSCLIENT.layout=org.apache.log4j.PatternLayout
+log4j.appender.WSCLIENT.layout.ConversionPattern=%d{MMM dd, yyyy HH:mm:ss.SSS} %F:%L%n%p: %m%n
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/config/log4j2.xml b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/config/log4j2.xml
new file mode 100644
index 0000000..6902efe
--- /dev/null
+++ b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/config/log4j2.xml
@@ -0,0 +1,43 @@
+
+
+
+
+
+ ${ctx:applicationPath}/logs
+
+
+
+
+
+
+
+
+
+
+
+
+ UTF-8
+ %d{MMM dd, yyyy HH:mm:ss.SSS} :%t %n%p: %m%n
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/config/tenant config.xml b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/config/tenant config.xml
new file mode 100644
index 0000000..a88ffcc
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/config/tenant config.xml differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/lib/bc-fips-1.0.0.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/lib/bc-fips-1.0.0.jar
new file mode 100644
index 0000000..321e563
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/lib/bc-fips-1.0.0.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/lib/commons-codec-1.6.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/lib/commons-codec-1.6.jar
new file mode 100644
index 0000000..ee1bc49
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/lib/commons-codec-1.6.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/lib/disruptor-3.3.7.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/lib/disruptor-3.3.7.jar
new file mode 100644
index 0000000..1777a37
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/lib/disruptor-3.3.7.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/lib/fs-get-elevated-session.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/lib/fs-get-elevated-session.jar
new file mode 100644
index 0000000..f475f9d
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/lib/fs-get-elevated-session.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/lib/fs-smaillibrary.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/lib/fs-smaillibrary.jar
new file mode 100644
index 0000000..aa95e22
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/lib/fs-smaillibrary.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/lib/fs-ws-client-4.4.7.0.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/lib/fs-ws-client-4.4.7.0.jar
new file mode 100644
index 0000000..bf2adcf
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/lib/fs-ws-client-4.4.7.0.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/lib/juniversalchardet-1.0.3.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/lib/juniversalchardet-1.0.3.jar
new file mode 100644
index 0000000..1af703f
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/lib/juniversalchardet-1.0.3.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/lib/log4j-1.2.14.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/lib/log4j-1.2.14.jar
new file mode 100644
index 0000000..6251307
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/lib/log4j-1.2.14.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/lib/log4j-api-2.10.0.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/lib/log4j-api-2.10.0.jar
new file mode 100644
index 0000000..9603b1b
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/lib/log4j-api-2.10.0.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/lib/log4j-core-2.10.0.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/lib/log4j-core-2.10.0.jar
new file mode 100644
index 0000000..1be9e67
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/lib/log4j-core-2.10.0.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/lib/xercesImpl-X.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/lib/xercesImpl-X.jar
new file mode 100644
index 0000000..38fca83
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/lib/xercesImpl-X.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/src/com/seclore/fs/ea/advanced/example/Version.java b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/src/com/seclore/fs/ea/advanced/example/Version.java
new file mode 100644
index 0000000..b4cd66b
--- /dev/null
+++ b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/src/com/seclore/fs/ea/advanced/example/Version.java
@@ -0,0 +1,23 @@
+package com.seclore.fs.ea.advanced.example;
+
+/**
+ * Represents the Sample App version.
+ */
+public class Version
+{
+ /**
+ * The version of the Sample App.
+ */
+ public static final String Version = "3.0.0.0";
+
+ /**
+ * Displays the version of the Sample App
+ *
+ * @param args
+ */
+ public static void main(String[] args)
+ {
+ System.out.println("Sample App version : " + Version);
+ System.out.println("Copyright (c) 2008 Seclore Technology Pvt. Ltd.");
+ }
+}
\ No newline at end of file
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/src/com/seclore/fs/ea/advanced/example/core/Config.java b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/src/com/seclore/fs/ea/advanced/example/core/Config.java
new file mode 100644
index 0000000..f292bb9
--- /dev/null
+++ b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/src/com/seclore/fs/ea/advanced/example/core/Config.java
@@ -0,0 +1,65 @@
+package com.seclore.fs.ea.advanced.example.core;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+
+public class Config
+{
+ private static Properties props = null;
+
+ /**
+ * Load and initialize the '/config.properties' file
+ * @param configPath
+ * @throws Exception
+ */
+ public static void initConfig(String configPath) throws Exception
+ {
+ InputStream lInputStream = null;
+ try
+ {
+ Properties properties = new Properties();
+ lInputStream = new FileInputStream(configPath);
+ properties.load(lInputStream);
+ props = properties;
+ }
+ catch(Exception lEx)
+ {
+ throw new Exception(lEx);
+ }
+ finally
+ {
+ if( lInputStream != null)
+ {
+ try
+ {
+ lInputStream.close();
+ }
+ catch(IOException ioException)
+ {
+ // Ignore
+ }
+ }
+ }
+ }
+
+ /**
+ * This method reads the value against the specified 'key' and returns it.
+ * In case the value is blank or null, it returns the 'defaultValue' which was passed to this method.
+ * @param key
+ * @param defaultValue
+ * @return
+ * @throws Exception
+ */
+ public static String getProperty(String key, String defaultValue) throws Exception
+ {
+ String propertyValue = props.getProperty(key, defaultValue);
+ if( propertyValue.trim().isEmpty() )
+ {
+ propertyValue = defaultValue;
+ }
+
+ return propertyValue;
+ }
+}
\ No newline at end of file
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/src/com/seclore/fs/ea/advanced/example/main/SecloreMain.java b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/src/com/seclore/fs/ea/advanced/example/main/SecloreMain.java
new file mode 100644
index 0000000..445df61
--- /dev/null
+++ b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Get Advance EA Helper/src/src/com/seclore/fs/ea/advanced/example/main/SecloreMain.java
@@ -0,0 +1,363 @@
+package com.seclore.fs.ea.advanced.example.main;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringWriter;
+import java.util.Scanner;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.mozilla.universalchardet.UniversalDetector;
+import org.w3c.dom.Document;
+import org.xml.sax.InputSource;
+
+import com.seclore.fs.ea.advanced.example.core.Config;
+import com.seclore.fs.helper.crypto.DefaultCryptoHandler;
+import com.seclore.fs.helper.exception.FSHelperException;
+import com.seclore.fs.helper.library.FSHelper;
+import com.seclore.fs.helper.library.FSHelperLibrary;
+
+/**
+ *
+ * @author vishal.kumar
+ *
+ */
+public class SecloreMain
+{
+
+ private static final String tenantID = "Tenant-1";
+
+ //# This file contains information about the Application into which this code snippet is to be integrated.
+ private static final String appConfigXMLFilePath = "config/config.xml";
+
+ //# This file contains info for creating session with Seclore Policy Server and initializing Server SDK library
+ private static final String tenantConfigXMLFilePath = "config/tenant config.xml";
+
+ //# Used to take user input
+ private static Scanner scanner = null;
+
+ /**
+ *
This block initializes the Server SDK library and creates a session with Seclore Policy Server
+ * @exception Code snippet won't run if any exception is thrown in this block.
+ */
+ static
+ {
+ try
+ {
+ //load config.properties file and then validate the entries in it
+ Config.initConfig("config/config.properties");
+
+ //validate if entries in this file have pre-filled values
+ validateConfigEntries();
+
+ //initialize the FSHelper Library
+ initializeHelperLibrary(appConfigXMLFilePath);
+ initializeHelper(tenantID, "", tenantConfigXMLFilePath);
+
+ scanner = new Scanner(System.in);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ System.exit(0);
+ }
+ }
+
+ /**
+ * Main method
+ * @param args
+ * Takes input from user
+ */
+ public static void main(String[] args)
+ {
+ try
+ {
+ boolean isRequestSuccessful = initializeElevatedHelper();
+ if(isRequestSuccessful)
+ {
+ System.out.println("***** Operation successful. *****");
+ }
+ else
+ {
+ System.out.println("***** Operation failed! *****");
+ }
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ }
+ finally
+ {
+ if( scanner != null )
+ {
+ scanner.close();
+ }
+ }
+ }
+
+ /**
+ * Validate if properties in this file have pre-filled values
+ * @throws Exception
+ */
+ private static void validateConfigEntries() throws Exception
+ {
+ String eaActiveKeyId = Config.getProperty("ea.active.key.id", "");
+ if( null == eaActiveKeyId || eaActiveKeyId.trim().isEmpty() )
+ {
+ throw new Exception("Value for property 'ea.active.key.id' missing in config.properties file.");
+ }
+
+ String eaPrivateKeyXMLPath = Config.getProperty("ea.private.key.xml.path", "");
+ if( null == eaPrivateKeyXMLPath || eaPrivateKeyXMLPath.trim().isEmpty() )
+ {
+ throw new Exception("Value for property 'ea.private.key.xml.path' missing in config.properties file.");
+ }
+ }
+
+ /**
+ * This method calls the Server SDK API to process the request for getting file protection details, which also contains the file classification details
+ * and display the success or error message.
+ * @return Flag to indicate if operation was successful or not
+ * @throws Exception
+ */
+ private static boolean initializeElevatedHelper() throws Exception
+ {
+ boolean isRequestSuccessful = false;
+ try
+ {
+ //# This object is specific to a tenant. It contains the methods to call Server SDK API to process any request.
+ FSHelper fsHelper = FSHelperLibrary.getHelper(tenantID);
+ isRequestSuccessful=true;
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ }
+ finally
+ {
+ terminateWSClient();
+ }
+
+ return isRequestSuccessful;
+ }
+
+
+ /**
+ * @param configPath
+ * Takes the application config file path ( /config.xml ) as input
+ * @throws Exception
+ */
+ private static void initializeHelperLibrary(String configPath) throws Exception
+ {
+ String appConfigXMLContent = getConfigFileContent( configPath );
+ // Initialize method takes config file content, not the config file path.
+ FSHelperLibrary.initialize( appConfigXMLContent );
+ }
+
+ /**
+ * @param pHelperId
+ * Tenant Id
+ * @param pHelperResourcePath
+ * Resource Path for files of Seclore Policy Server. To be left empty here.
+ * @param pHelperConfigPath
+ * File path for 'tenant config.xml' file
+ * @throws Exception
+ * Code snippet won't run if any exception is thrown in this block
+ */
+ private static void initializeHelper(String pHelperId, String pHelperResourcePath, String pHelperConfigPath) throws Exception
+ {
+ //# Reads the content of the private key XML file related to the EA using which session was created
+ String lEAPrivateKeyXMLContent = getConfigFileContent( Config.getProperty("ea.private.key.xml.path", "") );
+
+ //# This object is used for advanced security. Only those EA with 'Advanced Security' option enabled on Policy Server portal can create another EA.
+ DefaultCryptoHandler defaultCryptoHandler = getDefaultCryptoHandler(lEAPrivateKeyXMLContent);
+
+ //# Reads the content of the 'tenant config.xml' file
+ String tenantConfigXMLContent = getConfigFileContent(pHelperConfigPath);
+
+ // Initialize method takes WSClient config content not the config file path.
+ FSHelperLibrary.initializeHelper(pHelperId, pHelperResourcePath, tenantConfigXMLContent, defaultCryptoHandler);
+ }
+
+ /**
+ *
Uses the private key xml file to create an instance of DefaultCryptoHandler.
+ * @param pEAPrivateKeyXMLContent
+ * @return DefaultCryptoHandler instance
+ * @throws Exception
+ */
+ private static DefaultCryptoHandler getDefaultCryptoHandler(String pEAPrivateKeyXMLContent) throws Exception
+ {
+ DefaultCryptoHandler defaultCryptoHandler = new DefaultCryptoHandler(
+ pEAPrivateKeyXMLContent,
+ Integer.parseInt(Config.getProperty("ea.key.length", "256")),
+ Config.getProperty("ea.active.key.id", ""),
+ Config.getProperty("ea.key.chaining.mode", "ECB"),
+ Config.getProperty("ea.key.padding.scheme", "PKCS1Padding")
+ );
+ return defaultCryptoHandler;
+ }
+
+ /**
+ * This method reads an XML file and returns the content of the XML file in string format
+ * @param pAppPath
+ * XML file path
+ * @return File content in string format
+ * @throws Exception
+ */
+ private static String getConfigFileContent( String pAppPath ) throws Exception
+ {
+ validateConfigFile( pAppPath );
+
+ InputStream inputStream = null;
+ try
+ {
+ String lstrEncoding = detectEncoding(pAppPath);
+ if( lstrEncoding == null || lstrEncoding.trim().isEmpty() )
+ {
+ lstrEncoding = "UTF-8";
+ }
+
+ DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
+ builderFactory.setNamespaceAware(false);
+ builderFactory.setValidating(false);
+ DocumentBuilder builder = builderFactory.newDocumentBuilder();
+ inputStream = new FileInputStream(pAppPath);
+ InputSource lInputSource = new InputSource( inputStream );
+ lInputSource.setEncoding(lstrEncoding);
+ Document document = builder.parse( lInputSource );
+
+ TransformerFactory lTransFactory = TransformerFactory.newInstance();
+ Transformer lTrans = lTransFactory.newTransformer();
+ DOMSource lSource = new DOMSource(document);
+ StringWriter lStringWriter = new StringWriter();
+ lTrans.transform( lSource, new StreamResult( lStringWriter ) );
+ return lStringWriter.toString();
+ }
+ catch (Exception e)
+ {
+ System.out.println("*** Config file should be in UTF-16LE encoding ***");
+ e.printStackTrace();
+ System.exit(0);
+ }
+ finally
+ {
+ if(inputStream != null)
+ {
+ try
+ {
+ inputStream.close();
+ }
+ catch(IOException ioException)
+ {
+ //ignore
+ }
+ }
+ }
+ return "";
+ }
+
+ /**
+ * @param configFilePath
+ * @throws Exception
+ */
+ private static File validateConfigFile(String configFilePath) throws Exception
+ {
+
+ if ( configFilePath == null || configFilePath.trim().isEmpty() )
+ {
+ throw new Exception("Configuration File path is not provided.");
+ }
+
+ File file = new File(configFilePath);
+ if ( !file.exists() )
+ {
+ throw new Exception("Configuration File does not exist at '"+ file.getAbsolutePath() + "'");
+ }
+
+ if( !file.isFile() )
+ {
+ throw new Exception("'" + file.getAbsolutePath() + "' is not a file.");
+ }
+
+ // Length 3 is checked to make sure that enough bytes are available for
+ // BOM reading.
+ if (file.length() < 3)
+ {
+ throw new Exception("'" + file.getAbsolutePath() + "' is not a valid configuration file.");
+ }
+ return file;
+ }
+
+ /**
+ * Detect encoding format of file
+ * @param pConfigXmlPath
+ * File path whose encoding type is to be detected
+ * @return encoding format (eg: utf-8, utf-16)
+ */
+ public static String detectEncoding(String pConfigXmlPath)
+ {
+ FileInputStream lFis = null;
+ try
+ {
+ lFis = new FileInputStream(pConfigXmlPath);
+ UniversalDetector lDetector = new UniversalDetector(null);
+ byte[] lBuff = new byte[512];
+ int liread;
+ while( (liread = lFis.read(lBuff)) > 0 && !lDetector.isDone() )
+ {
+ lDetector.handleData(lBuff, 0, liread);
+ }
+ lDetector.dataEnd();
+ String lstrEncoding = lDetector.getDetectedCharset();
+ lDetector.reset();
+ return lstrEncoding;
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ finally
+ {
+ if ( lFis != null)
+ {
+ try
+ {
+ lFis.close();
+ }
+ catch (IOException e)
+ {
+ // Ignore
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Terminate the created session and reset the initialized Server SDK library.
+ */
+ public static void terminateWSClient()
+ {
+ try
+ {
+ FSHelperLibrary.logInfo("Terminating FSHelper Library");
+ if(FSHelperLibrary.isTerminated() == false)
+ {
+ System.out.println("FSHelperLibrary.isTerminated(): " + FSHelperLibrary.isTerminated());
+ FSHelperLibrary.terminate();
+ }
+ }
+ catch (FSHelperException e)
+ {
+ FSHelperLibrary.logError(e.getMessage(), e);
+ }
+ }
+
+ }
\ No newline at end of file
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/RSA Key Pair Generation Sample Tool.zip b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/RSA Key Pair Generation Sample Tool.zip
new file mode 100644
index 0000000..edb199e
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/RSA Key Pair Generation Sample Tool.zip differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Unprotect Any File using Elevated EA.pptx b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Unprotect Any File using Elevated EA.pptx
new file mode 100644
index 0000000..e20a266
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Unprotect Any File using Elevated EA.pptx differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Use Elevated Enterprise Application to Unprotect Any File - Technical Document.docx b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Use Elevated Enterprise Application to Unprotect Any File - Technical Document.docx
new file mode 100644
index 0000000..d85750b
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Appendix - Unprotect Any File using Elevated EA/Use Elevated Enterprise Application to Unprotect Any File - Technical Document.docx differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code Configuration Details.xlsx b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code Configuration Details.xlsx
new file mode 100644
index 0000000..b1364f7
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code Configuration Details.xlsx differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/Readme.txt b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/Readme.txt
new file mode 100644
index 0000000..4c4f2b3
--- /dev/null
+++ b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/Readme.txt
@@ -0,0 +1,22 @@
+
+Unprotect & Unwrap in EA context Sample App
+===========================================
+
+Deployment Steps:
+------------------
+1. make sure your policy server is running . This app requires java 8 or above to run so make
+ sure java 8 or above is installed.
+
+2. go inside 'bin/Unprotect & Unwrap in EA context Sample App'
+
+3. Configure the 'tenant config.xml' in 'config/'
+ a. Policy Server Details:
+ server : Server name on which Policy Server is running
+ port : Server Port on which Policy Server is running
+ app-name : Policy Server application name
+
+ b. fill hot folder details i.e id and passphrase
+
+4. If you are using java 8 , put libs present inside 'doc/JCE Files/java8' into 'bin/Unprotect & Unwrap in EA context Sample App/lib'
+
+5. click on run.bat to start sample app , follow instruction on terminal
\ No newline at end of file
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/config/config.xml b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/config/config.xml
new file mode 100644
index 0000000..b148308
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/config/config.xml differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/config/log4j.properties b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/config/log4j.properties
new file mode 100644
index 0000000..8293be6
--- /dev/null
+++ b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/config/log4j.properties
@@ -0,0 +1,15 @@
+
+log4j.category.WSCLIENT=debug, WSCLIENT
+
+# If we want to change the Appender, we have to change
+# UtilFunction.initializeLoggers() too, because it assumes that the appender
+# is 'org.apache.log4j.RollingFileAppender' and changes path of the file by
+# getting appender from this logger.
+log4j.appender.WSCLIENT=com.seclore.fs.ws.client.logger.DailyZippedRollingFileAppender
+# Path of the file should be relative to application ROOT
+log4j.appender.WSCLIENT.File=logs/WSClient.log
+log4j.appender.WSCLIENT.MaxFileSize=10MB
+#log4j.appender.REQUEST_LOGGER.MaxBackupIndex=10
+log4j.appender.WSCLIENT.DatePattern='_'yyyy-MM-dd
+log4j.appender.WSCLIENT.layout=org.apache.log4j.PatternLayout
+log4j.appender.WSCLIENT.layout.ConversionPattern=%d{MMM dd, yyyy HH:mm:ss.SSS} %F:%L%n%p: %m%n
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/config/log4j2.xml b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/config/log4j2.xml
new file mode 100644
index 0000000..6902efe
--- /dev/null
+++ b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/config/log4j2.xml
@@ -0,0 +1,43 @@
+
+
+
+
+
+ ${ctx:applicationPath}/logs
+
+
+
+
+
+
+
+
+
+
+
+
+ UTF-8
+ %d{MMM dd, yyyy HH:mm:ss.SSS} :%t %n%p: %m%n
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/config/tenant config.xml b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/config/tenant config.xml
new file mode 100644
index 0000000..bbd0c13
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/config/tenant config.xml differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/US_export_policy.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/US_export_policy.jar
new file mode 100644
index 0000000..7173213
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/US_export_policy.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/US_export_policy_2.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/US_export_policy_2.jar
new file mode 100644
index 0000000..251b102
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/US_export_policy_2.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/bc-fips-1.0.0.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/bc-fips-1.0.0.jar
new file mode 100644
index 0000000..321e563
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/bc-fips-1.0.0.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/commons-codec-1.6.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/commons-codec-1.6.jar
new file mode 100644
index 0000000..ee1bc49
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/commons-codec-1.6.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/disruptor-3.3.7.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/disruptor-3.3.7.jar
new file mode 100644
index 0000000..1777a37
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/disruptor-3.3.7.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/fs-smaillibrary.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/fs-smaillibrary.jar
new file mode 100644
index 0000000..aa95e22
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/fs-smaillibrary.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/fs-ws-client-4.4.7.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/fs-ws-client-4.4.7.jar
new file mode 100644
index 0000000..bf2adcf
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/fs-ws-client-4.4.7.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/juniversalchardet-1.0.3.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/juniversalchardet-1.0.3.jar
new file mode 100644
index 0000000..1af703f
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/juniversalchardet-1.0.3.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/local_policy.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/local_policy.jar
new file mode 100644
index 0000000..c34d036
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/local_policy.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/local_policy_2.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/local_policy_2.jar
new file mode 100644
index 0000000..1c58939
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/local_policy_2.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/log4j-1.2.14.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/log4j-1.2.14.jar
new file mode 100644
index 0000000..6251307
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/log4j-1.2.14.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/log4j-api-2.10.0.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/log4j-api-2.10.0.jar
new file mode 100644
index 0000000..9603b1b
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/log4j-api-2.10.0.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/log4j-core-2.10.0.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/log4j-core-2.10.0.jar
new file mode 100644
index 0000000..1be9e67
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/log4j-core-2.10.0.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/sample-app.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/sample-app.jar
new file mode 100644
index 0000000..783f3d3
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/sample-app.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/xercesImpl-X.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/xercesImpl-X.jar
new file mode 100644
index 0000000..38fca83
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/lib/xercesImpl-X.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/logs/WSClient.log b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/logs/WSClient.log
new file mode 100644
index 0000000..1982057
--- /dev/null
+++ b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/logs/WSClient.log
@@ -0,0 +1,25 @@
+FileSecure Version is 4.4.7.0
+Jul 19, 2021 12:31:33.603 :main
+INFO: WSCLIENT logger is initialized
+Jul 19, 2021 12:31:33.609 :main
+INFO: -1SDK Logger is initialized
+Jul 19, 2021 12:31:33.610 :main
+INFO: -1FSHelperLibrary::initializeSuccessfully Initialized helper library.
+Jul 19, 2021 12:32:16.087 :main
+INFO: WSCLIENT logger is initialized
+Jul 19, 2021 12:32:16.093 :main
+INFO: -1SDK Logger is initialized
+Jul 19, 2021 12:32:16.095 :main
+INFO: -1FSHelperLibrary::initializeSuccessfully Initialized helper library.
+Jul 19, 2021 12:36:54.076 :main
+INFO: WSCLIENT logger is initialized
+Jul 19, 2021 12:36:54.080 :main
+INFO: -1SDK Logger is initialized
+Jul 19, 2021 12:36:54.080 :main
+INFO: -1FSHelperLibrary::initializeSuccessfully Initialized helper library.
+Jul 19, 2021 12:37:14.966 :main
+INFO: WSCLIENT logger is initialized
+Jul 19, 2021 12:37:14.970 :main
+INFO: -1SDK Logger is initialized
+Jul 19, 2021 12:37:14.972 :main
+INFO: -1FSHelperLibrary::initializeSuccessfully Initialized helper library.
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/run.bat b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/run.bat
new file mode 100644
index 0000000..2bf9ca8
--- /dev/null
+++ b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/bin/Unprotect & Unwrap in EA context Sample App/run.bat
@@ -0,0 +1,16 @@
+@echo off
+set "CURRENT_DIR=%cd%"
+echo ---------------------------------------------------------------
+echo Seclore 'Unprotect and Unwrap in EA context Sample App' Utility
+echo ---------------------------------------------------------------
+echo.
+
+rem if your want to run on a different jdk or java path is not configured uncomment below line
+rem for example ,
+rem set path="C:\Program Files\Java\jdk-11.0.1\bin";
+java -version
+echo.
+REM uncomment below line to see the version of sample app i.e( remove REM mentioned below)
+REM java -cp "./lib/sample-app.jar"; com.seclore.fs.protect.example.Version
+ java -cp "./lib/*"; com.seclore.fs.protect.example.main.SecloreMain
+pause
\ No newline at end of file
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/doc/Developer_s Reference.txt b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/doc/Developer_s Reference.txt
new file mode 100644
index 0000000..d49ade4
--- /dev/null
+++ b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/doc/Developer_s Reference.txt
@@ -0,0 +1,37 @@
+FileSecure Interfaces integration source code reference.
+
+FS Helper Initialization
+------------------------
+ - At application startup initializing FSHelperlibrary and FSHelper
+ - Below classes are used for the same
+ - SecloreMain
+ - static block :-
+ InitializeWSClient.initializeHelperLibrary((FSHELPERLIBRARY_CONFIG_XML_PATH, ););
+ InitializeWSClient.initializeHelper(HELPER_INSTANCE_KEY, FSHELPER_RESOURCE_PATH, FSHELPER_CONFIG_XML_PATH, );
+ - InitializeWSClient
+ - initializeHelperLibrary( ... )
+ - initializeHelper( ... )
+
+
+
+Main Class
+------------
+ - com.seclore.fs.protect.example.main
+ - SecloreMain class
+
+Note:
+=====
+while preparing xml string for request or response. please escape below spacial character for the string which will be written within xml tag.
+ "&" -> "&"
+ "<" -> "<"
+ ">", -> ">"
+ "\"" -> """
+ "'" -> "'";
+
+ Refer: com.seclore.fs.protect.example.util.XMLUtil class and
+ - escapeForXML () method
+
+Example: sample xml is "Sample Sales & purchase report.pdf"
+ here "Sample Sales and purchase report" should be escaped.
+ Use: String fileName = XMLHelper.escapeForXML( "Sample Sales & purchase report" );
+ ""+fileName+""
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/doc/JCE Files/Java7/US_export_policy.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/doc/JCE Files/Java7/US_export_policy.jar
new file mode 100644
index 0000000..7173213
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/doc/JCE Files/Java7/US_export_policy.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/doc/JCE Files/Java7/local_policy.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/doc/JCE Files/Java7/local_policy.jar
new file mode 100644
index 0000000..c34d036
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/doc/JCE Files/Java7/local_policy.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/doc/JCE Files/Java8/US_export_policy.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/doc/JCE Files/Java8/US_export_policy.jar
new file mode 100644
index 0000000..251b102
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/doc/JCE Files/Java8/US_export_policy.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/doc/JCE Files/Java8/local_policy.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/doc/JCE Files/Java8/local_policy.jar
new file mode 100644
index 0000000..1c58939
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/doc/JCE Files/Java8/local_policy.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/.classpath b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/.classpath
new file mode 100644
index 0000000..8960a2e
--- /dev/null
+++ b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/.classpath
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/.project b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/.project
new file mode 100644
index 0000000..adbd983
--- /dev/null
+++ b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/.project
@@ -0,0 +1,17 @@
+
+
+ Unprotect & Unwrap in EA context Sample App Code
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+
+
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/.settings/org.eclipse.jdt.core.prefs b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..3a21537
--- /dev/null
+++ b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,11 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/bin/com/seclore/fs/protect/example/Version.class b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/bin/com/seclore/fs/protect/example/Version.class
new file mode 100644
index 0000000..694b590
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/bin/com/seclore/fs/protect/example/Version.class differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/bin/com/seclore/fs/protect/example/core/InitializeWSClient.class b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/bin/com/seclore/fs/protect/example/core/InitializeWSClient.class
new file mode 100644
index 0000000..e94d4de
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/bin/com/seclore/fs/protect/example/core/InitializeWSClient.class differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/bin/com/seclore/fs/protect/example/main/SecloreMain.class b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/bin/com/seclore/fs/protect/example/main/SecloreMain.class
new file mode 100644
index 0000000..20f880e
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/bin/com/seclore/fs/protect/example/main/SecloreMain.class differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/config/config.xml b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/config/config.xml
new file mode 100644
index 0000000..610e0c5
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/config/config.xml differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/config/log4j.properties b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/config/log4j.properties
new file mode 100644
index 0000000..8293be6
--- /dev/null
+++ b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/config/log4j.properties
@@ -0,0 +1,15 @@
+
+log4j.category.WSCLIENT=debug, WSCLIENT
+
+# If we want to change the Appender, we have to change
+# UtilFunction.initializeLoggers() too, because it assumes that the appender
+# is 'org.apache.log4j.RollingFileAppender' and changes path of the file by
+# getting appender from this logger.
+log4j.appender.WSCLIENT=com.seclore.fs.ws.client.logger.DailyZippedRollingFileAppender
+# Path of the file should be relative to application ROOT
+log4j.appender.WSCLIENT.File=logs/WSClient.log
+log4j.appender.WSCLIENT.MaxFileSize=10MB
+#log4j.appender.REQUEST_LOGGER.MaxBackupIndex=10
+log4j.appender.WSCLIENT.DatePattern='_'yyyy-MM-dd
+log4j.appender.WSCLIENT.layout=org.apache.log4j.PatternLayout
+log4j.appender.WSCLIENT.layout.ConversionPattern=%d{MMM dd, yyyy HH:mm:ss.SSS} %F:%L%n%p: %m%n
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/config/log4j2.xml b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/config/log4j2.xml
new file mode 100644
index 0000000..6902efe
--- /dev/null
+++ b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/config/log4j2.xml
@@ -0,0 +1,43 @@
+
+
+
+
+
+ ${ctx:applicationPath}/logs
+
+
+
+
+
+
+
+
+
+
+
+
+ UTF-8
+ %d{MMM dd, yyyy HH:mm:ss.SSS} :%t %n%p: %m%n
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/config/tenant config.xml b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/config/tenant config.xml
new file mode 100644
index 0000000..350ad86
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/config/tenant config.xml differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/lib/bc-fips-1.0.2.3.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/lib/bc-fips-1.0.2.3.jar
new file mode 100644
index 0000000..1a8c5de
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/lib/bc-fips-1.0.2.3.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/lib/commons-codec-1.6.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/lib/commons-codec-1.6.jar
new file mode 100644
index 0000000..ee1bc49
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/lib/commons-codec-1.6.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/lib/disruptor-3.3.7.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/lib/disruptor-3.3.7.jar
new file mode 100644
index 0000000..1777a37
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/lib/disruptor-3.3.7.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/lib/fs-smaillibrary.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/lib/fs-smaillibrary.jar
new file mode 100644
index 0000000..0cb2298
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/lib/fs-smaillibrary.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/lib/fs-ws-client.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/lib/fs-ws-client.jar
new file mode 100644
index 0000000..cbda191
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/lib/fs-ws-client.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/lib/juniversalchardet-1.0.3.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/lib/juniversalchardet-1.0.3.jar
new file mode 100644
index 0000000..1af703f
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/lib/juniversalchardet-1.0.3.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/lib/log4j-api-2.17.1.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/lib/log4j-api-2.17.1.jar
new file mode 100644
index 0000000..1aae243
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/lib/log4j-api-2.17.1.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/lib/log4j-core-2.17.1.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/lib/log4j-core-2.17.1.jar
new file mode 100644
index 0000000..4682527
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/lib/log4j-core-2.17.1.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/lib/seclore-io-1.0.0.0.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/lib/seclore-io-1.0.0.0.jar
new file mode 100644
index 0000000..365237b
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/lib/seclore-io-1.0.0.0.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/lib/xercesImpl-X.jar b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/lib/xercesImpl-X.jar
new file mode 100644
index 0000000..38fca83
Binary files /dev/null and b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/lib/xercesImpl-X.jar differ
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/src/com/seclore/fs/protect/example/Version.java b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/src/com/seclore/fs/protect/example/Version.java
new file mode 100644
index 0000000..df17df2
--- /dev/null
+++ b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/src/com/seclore/fs/protect/example/Version.java
@@ -0,0 +1,23 @@
+package com.seclore.fs.protect.example;
+
+/**
+ * Represents the Sample App version.
+ */
+public class Version
+{
+ /**
+ * The version of the Sample App.
+ */
+ public static final String Version = "3.0.0.0";
+
+ /**
+ * Displays the version of the Sample App
+ *
+ * @param args
+ */
+ public static void main(String[] args)
+ {
+ System.out.println("Sample App version : " + Version);
+ System.out.println("Copyright (c) 2008 Seclore Technology Pvt. Ltd.");
+ }
+}
\ No newline at end of file
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/src/com/seclore/fs/protect/example/core/InitializeWSClient.java b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/src/com/seclore/fs/protect/example/core/InitializeWSClient.java
new file mode 100644
index 0000000..b49cd74
--- /dev/null
+++ b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/src/com/seclore/fs/protect/example/core/InitializeWSClient.java
@@ -0,0 +1,240 @@
+package com.seclore.fs.protect.example.core;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringWriter;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.mozilla.universalchardet.UniversalDetector;
+import org.w3c.dom.Document;
+import org.xml.sax.InputSource;
+
+import com.seclore.fs.helper.exception.FSHelperException;
+import com.seclore.fs.helper.library.FSHelperLibrary;
+
+public class InitializeWSClient
+{
+ /**
+ * @param configPath
+ * Takes the application config file path as input
+ * @throws Exception
+ */
+ public static void initializeHelperLibrary(String configPath) throws Exception
+ {
+ try
+ {
+ String configContentXMLString = getConfigFileContent( configPath );
+ // Initialize method takes WSClient config content not the config file path.
+ FSHelperLibrary.initialize( configContentXMLString );
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @param helperId
+ * Tenant Id
+ * @param helperResourcePath
+ * Resource Path for files of Seclore Policy Server. To be left empty here.
+ * @param helperConfigPath
+ * File path for 'tenant config.xml' file
+ * @throws Exception
+ * Code snippet won't run if any exception is thrown in this block
+ */
+ public static void initializeHelper(String pHelperId, String pHelperResourcePath, String pHelperConfigPath) throws Exception
+ {
+ try
+ {
+ String configContentXMLString = getConfigFileContent( pHelperConfigPath );
+ // Initialize method takes WSClient config content not the config file path.
+ FSHelperLibrary.initializeHelper(pHelperId, pHelperResourcePath, configContentXMLString);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * This method reads an XML file and returns the content of the XML file in string format
+ * @param appPath
+ * XML file path
+ * @return File content in string format
+ * @throws Exception
+ */
+ private static String getConfigFileContent( String pAppPath ) throws Exception
+ {
+ validateConfigFile( pAppPath );
+
+ InputStream inputStream = null;
+ try
+ {
+ String lstrEncoding = detectEncoding(pAppPath);
+ if( lstrEncoding == null || lstrEncoding.trim().isEmpty() )
+ {
+ lstrEncoding = "UTF-8";
+ }
+
+ DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
+ builderFactory.setNamespaceAware(false);
+ builderFactory.setValidating(false);
+ DocumentBuilder builder = builderFactory.newDocumentBuilder();
+ inputStream = new FileInputStream(pAppPath);
+ InputSource lInputSource = new InputSource( inputStream );
+ lInputSource.setEncoding(lstrEncoding);
+ Document document = builder.parse( lInputSource );
+
+
+ TransformerFactory lTransFactory = TransformerFactory.newInstance();
+ Transformer lTrans = lTransFactory.newTransformer();
+ DOMSource lSource = new DOMSource(document);
+ StringWriter lStringWriter = new StringWriter();
+ lTrans.transform( lSource, new StreamResult( lStringWriter ) );
+ return lStringWriter.toString();
+ }
+ catch (Exception e)
+ {
+ System.out.println("*** Config file should be in UTF-16LE encoding ***");
+ e.printStackTrace();
+ System.exit(0);
+ }
+ finally
+ {
+ if(inputStream != null)
+ {
+ try{
+ inputStream.close();
+ }
+ catch(IOException ioException)
+ {
+ //ignore
+ }
+ }
+ }
+ return "";
+ }
+
+ /**
+ * Validates whether the file exists at the given location & has valid BOM format
+ * @param configFilePath
+ * @throws Exception
+ * @return The file object representing the configFilePath
+ */
+ private static File validateConfigFile(String configFilePath) throws Exception
+ {
+
+ if ( configFilePath == null || configFilePath.trim().isEmpty() )
+ {
+ throw new Exception("Configuration File path is not provided.");
+ }
+
+ File file = new File(configFilePath);
+ if ( !file.exists() )
+ {
+ throw new Exception("Configuration File does not exist at '"+ file.getAbsolutePath() + "'");
+ }
+
+ if( !file.isFile() )
+ {
+ throw new Exception("'" + file.getAbsolutePath() + "' is not a file.");
+ }
+
+ // Length 3 is checked to make sure that enough bytes are available for
+ // BOM reading.
+ if (file.length() < 3)
+ {
+ throw new Exception("'" + file.getAbsolutePath() + "' is not a valid configuration file.");
+ }
+ return file;
+ }
+
+ /**
+ * Detect encoding format of file
+ * @param pConfigXmlPath
+ * File path whose encoding type is to be detected
+ * @return encoding format (eg: utf-8, utf-16)
+ */
+ public static String detectEncoding(String pConfigXmlPath)
+ {
+ FileInputStream lFis = null;
+ try
+ {
+ lFis = new FileInputStream(pConfigXmlPath);
+ UniversalDetector lDetector = new UniversalDetector(null);
+ byte[] lBuff = new byte[512];
+ int liread;
+ while( (liread = lFis.read(lBuff)) > 0 && !lDetector.isDone() )
+ {
+ lDetector.handleData(lBuff, 0, liread);
+ }
+ lDetector.dataEnd();
+ String lstrEncoding = lDetector.getDetectedCharset();
+ lDetector.reset();
+ return lstrEncoding;
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ finally
+ {
+ if ( lFis != null)
+ {
+ try
+ {
+ lFis.close();
+ } catch (IOException e) {
+ // Igniore
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Terminate the created session and reset the initialized Server SDK library.
+ */
+ public static void terminateWSClient()
+ {
+ try
+ {
+ FSHelperLibrary.logInfo("Terminating FSHelper Library");
+ if(FSHelperLibrary.isTerminated() == false)
+ {
+ System.out.println("FSHelperLibrary.isTerminated(): " + FSHelperLibrary.isTerminated());
+ FSHelperLibrary.terminate();
+ }
+ }
+ catch (FSHelperException e)
+ {
+ FSHelperLibrary.logError(e.getMessage(), e);
+ }
+ }
+
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/src/com/seclore/fs/protect/example/main/SecloreMain.java b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/src/com/seclore/fs/protect/example/main/SecloreMain.java
new file mode 100644
index 0000000..051852a
--- /dev/null
+++ b/examples/Java/3. Unwrap & Unprotect in EA context/Using Seclore PoC Policy Server/Sample Code/src/Unprotect & Unwrap in EA context Sample App Code/src/com/seclore/fs/protect/example/main/SecloreMain.java
@@ -0,0 +1,118 @@
+package com.seclore.fs.protect.example.main;
+
+import java.util.Scanner;
+
+import com.seclore.fs.helper.core.UnprotectedFile;
+import com.seclore.fs.helper.library.FSHelper;
+import com.seclore.fs.helper.library.FSHelperLibrary;
+import com.seclore.fs.protect.example.core.InitializeWSClient;
+
+public class SecloreMain
+{
+ //# FS Helper library is multi-tenant. Use unique tenant identifier for each tenant
+ private static String tenantID = "Tenant-1";
+
+ //# This file contains information about the Application into which this code snippet is to be integrated.
+ private static final String appConfigXMLFilePath = "config/config.xml";
+
+ //# This file contains info for creating session with Seclore Policy Server and initializing Server SDK library
+ private static final String tenantConfigXMLFilePath = "config/tenant config.xml";
+
+ //# Used to take user input
+ private static Scanner scanner = null;
+
+ /**
+ *
This block initializes the Server SDK library and creates a session with Seclore Policy Server