Package com.seclore.fs.helper.library
Class FSHelper
java.lang.Object
com.seclore.fs.helper.library.FSHelper
-
Method Summary
Modifier and TypeMethodDescriptionThis method returns an authenticated user connection for the Policy Server which is passed as XML inFSHelperLibrary.initializeHelper(String, String, String, CryptoHandler).com.seclore.fs.ws.client.encryption.jwe.JWTDatadecryptJWEToken(String pJWEToken) Decrypt and validate the JWE token.getCustomAttributesFromHTMLFile(String pFilePath) This method returns the custom attributes from Seclore HTML wrapped file.getFileHeader(String pFilePath) This method returns the header XML of the protected or HTML wrapped file.This method returns the File Identifier of protected or HTML wrapped file.getHTMLWrappedFileId(String pFilePath) This method returns the File Identifier of Seclore HTML wrapped file.getLocaleFromHTMLFile(String pFilePath) This method returns the Locale of Seclore HTML wrapped file.This method returns an authenticated user connection for the Policy Server which is passed as XML inFSHelperLibrary.initializeHelper(String, String, String, CryptoHandler).getSmailBodyBuffer(PSConnection pPSConnection, String pOutputFolderPath) This method returnsIMailBodyfor seclore protected mail.booleanisBasicProtectionSupported(String pstrFileName) This methods check if the provided filename is supported for basic protection.booleanisHTMLWrapped(String pHtmlWrappedFile) This method checks whether the given file is HTML wrapped or not.booleanisHTMLWrapSupported(String pFilePath) This method will assert whether the file given can be HTML wrapped or not.booleanThis method returns whether the FSHelper Object is initialized or not.booleanisProtectedFile(byte[] pFileData) This method returns whether passed bytes are of Seclore protected file or not.booleanisProtectedFile(String pFilePath) This method returns whether a file is Seclore protected or not.booleanisSupportedFile(String pFilePath) This method returns whether a file is of Seclore supported extension or not.booleanThis method returns whether the FSHelper Object is terminated or not.protectAndGetSMail(PSConnection pPSConnection, ProtectionType pProtectionType, String pProtectionXML, String pProtectorDetails, String pActivityComments, IMailInput pMailInput) Protect the email body passed in pMailInput.protectAndWrap(PSConnection pPSConnection, String pFilePath, String pDisplayFilePath, ProtectionType pProtectionType, String pProtectXML, String pProtectorDetails, String pActivityComments) This method protects the given unprotected input file using protection details and wraps (convert) it into HTML file and returns object of ProtectedFile This wrapped HTML file will replace the file at pFilePath and name of the HTML file will be same as filename followed by ".html" suffix.protectMailBody(PSConnection pPSConnection, ProtectionType pProtectionType, String pProtectionXML, String pProtectorDetails, String pActivityComments, IMailInput pMailInput) Protect the email body passed in pMailInput.protectX(PSConnection pPSConnection, String pFilePath, String pDisplayFilePath, ProtectionType pProtectionType, String pProtectXML, String pProtectorDetails, String pActivityComments) This method protects the input file with specific protection details.voidreleasePSConnection(PSConnection pPSConnection) This method releases the authenticated PSConnection which has been passed as input parameter.sendRequest(PSConnection pPSConnection, int pRequestType, String pRequestXML) This method will send a request to the Seclore Policy Server.unprotectMailBody(PSConnection pPSConnection, IProtectedMailInput pProtectedMailInput, String pActivityComments) This method unprotects a protected mail file.voidunprotectX(PSConnection pPSConnection, String pFilePath, String pDisplayFilePath, String pActivityComments) This method unprotects a file.This method unwrap (converts) warpped HTML file into native file and return absolute file location of unwrapped file.unwrapAndUnprotect(PSConnection pPSConnection, String pstrFilePath, String pstrDisplayFilePath, String pstrActivityComments) This method is used to unwrap and unprotect the seclore protected seclore supported and basic files.wrap(PSConnection pPSConnection, WrapperInputDetails pWrapperInputDetails) This method wrap (convert) protected file into HTML file and return absolute file location of wrapped file.wrap(PSConnection pPSConnection, String pProtectedFilePath, String pDisplayFileName) This method wrap (convert) protected file into HTML file and return absolute file location of wrapped file.wrap(PSConnection pPSConnection, String pProtectedFilePath, String pDisplayFileName, String pcustomAttributeData) This method wrap (convert) protected file into HTML file and return absolute file location of wrapped file.
-
Method Details
-
isInitialized
public boolean isInitialized()This method returns whether the FSHelper Object is initialized or not.- Returns:
- true if the FSHelper Object is initialized.
-
IsTerminated
public boolean IsTerminated()This method returns whether the FSHelper Object is terminated or not.- Returns:
- true, if the FSHelper Object is terminated.
-
createPSConnection
This method returns an authenticated user connection for the Policy Server which is passed as XML inFSHelperLibrary.initializeHelper(String, String, String, CryptoHandler). Authenticated PSConnection is of the user passed in the same XML. This connection is NOT part of the Connection Pool and is created new every time this method is called. User is required to callreleasePSConnection(PSConnection)for this session after use.
Remark :
This method should typically be used if an application needs an authenticated session but not from the pool
e.g. to redirect to some PS URL. In some scenarios, it is required that the integrating application (typically a web application) may require an authenticated session to redirect the user to some Policy Server URL let's say to create Hot Folder. In such a case, it is suggested that application callscreatePSConnection()instead ofgetPSConnection()since there are high probability that the session is not released properly by callingreleasePSConnection(PSConnection). If the session is from createPSConnection() and not released, it will firstly not block a session from the pool and also if not released explicitly, it will expire after the session expiry.- Returns:
- the instance of
PSConnection - Throws:
FSHelperException
-
getPSConnection
This method returns an authenticated user connection for the Policy Server which is passed as XML inFSHelperLibrary.initializeHelper(String, String, String, CryptoHandler). Authenticated PSConnection is of the user passed in the same XML. This connection is part of the connection pool. User is required to callreleasePSConnection(PSConnection)for this connection after use.- Returns:
- the
PSConnectionfrom the pool. - Throws:
FSHelperException
-
releasePSConnection
This method releases the authenticated PSConnection which has been passed as input parameter.- Parameters:
pPSConnection- PSConnection instance.- Throws:
FSHelperException
-
isProtectedFile
This method returns whether a file is Seclore protected or not. It takes file path as input parameter.- Parameters:
pFilePath- The path of the file which is to be checked for Seclore protection.- Returns:
- true, if the file is protected else false.
- Throws:
FSHelperException
-
isProtectedFile
This method returns whether passed bytes are of Seclore protected file or not.- Parameters:
pFileData- The bytes of the file which is to be checked for Seclore protection. Only first 1 MB of the file data needs to be passed here. If the file size is less than 1 MB then the entire file data should be passed.- Returns:
- true, if the bytes are of Seclore protected file else false.
- Throws:
FSHelperException
-
isSupportedFile
This method returns whether a file is of Seclore supported extension or not.- Parameters:
pFilePath- The path or the name of the file. The extension of the file will be used to determine the support.- Returns:
- true, if the file is Seclore supported extension.
- Throws:
FSHelperException
-
isBasicProtectionSupported
This methods check if the provided filename is supported for basic protection. TheprotectFileWithBasicProtection(PSConnection, String, String, ProtectionType, String, String, String)call should be preceded with this method call.- Parameters:
pstrFileName- File name or path to check for basic protection is supported. File Extension will be used to determine the support.- Returns:
- true if file format is supported for basic protection
- Throws:
FSHelperException
-
protectX
public String protectX(PSConnection pPSConnection, String pFilePath, String pDisplayFilePath, ProtectionType pProtectionType, String pProtectXML, String pProtectorDetails, String pActivityComments) throws FSHelperException This method protects the input file with specific protection details.Code Usage:
{@code import com.seclore.fs.helper.library.FSHelperLibrary; import com.seclore.fs.helper.library.FSHelper; import com.seclore.fs.helper.core.ProtectedFile; import com.seclore.fs.helper.exception.FSHelperException; public class Example { public static void main(String[] args) { try { if(FSHelperLibrary.isInitialized() == true) { FSHelper fsTenant = FSHelperLibrary.getHelper("tenant-1"); // File path of file which is to be protected. String filePath = "D:/Seclore/File.txt" ; // Refer ProtectionType enum for other protection types. ProtectedFile ProtectedFileDetails = fsTenant.protectX(null, filePath, fileDisplayName, ProtectionType.PROTECT_WITH_HF, protectionDetails, protectorDetails, actvityComments); } else { // Please refer initialize() method of FSHelperLibrary for more details } } catch(FSHelperException exception) { Log("Message : " + exception.getMessage()); Log("Error Code : " + exception.getErrorCode()); } } } </pre> <br> @param pPSConnection {@link PSConnection} received from {@link FSHelper#createPSConnection()} or {@link FSHelper#getPSConnection()}. This is an optional parameter. In case it is {@code null}, this API picks up a connection from the connection pool. @param pFilePath The path of the file which is to be protected. @param pDisplayFilePath The logical path of the file which is to be protected. <br> This is a logical path and not necessarily exist on disk. <br> This path is used for logging the protect activity on Policy Server. @param pProtectionType Type of of protection from {@link ProtectionType}. In case of any other value, this method returns an error. @param pProtectXML The protection details XML based on the ProtectionType passed above. It should be in XML format. For details of format for each ProtectionType, please refer documentation of {@link ProtectionType}. @param pProtectorDetails The protector details XML of the file. This is an optional parameter. Following defines XML structure of this parameter: <pre>{@code <!-- The Protector user. This tag is optional.If provided, this entity will be considered as file protector. --> <protector> <entity> <!-- Type of protector entity (1 - User, 2 - Group). --> <type></type> <!-- Unique identifier of the Repository in which the user exist. --> <rep-code></rep-code> <!-- Unique Identifier of User/Group in the repository. --> <id></id> </entity> </protector> }</pre> @param pActivityComments This string will contain activity comments to be sent to Policy Server for this protect request. It is an optional parameter. @return The File Identifier for the protected file. @throws FSHelperException This method may fail due to various reasons. Some important reasons being: <ul> <li>User does not have permission to write and delete the file.</li> <li>File is already opened by another application.</li> <li>There is no enough disk space available to store protected file.</li> <li>Policy Server is not reachable.</li> <li>Policy Server is not up and running.</li> <li>Logged in user does not have license to protect files.</li> </ul> @throws FileSystemException- Throws:
FSHelperException
-
unprotectX
public void unprotectX(PSConnection pPSConnection, String pFilePath, String pDisplayFilePath, String pActivityComments) throws FSHelperException This method unprotects a file. Authenticated PSConnection used to unprotect the file should have rights to unprotect the file.Code Usage:
{@code import com.seclore.fs.helper.library.FSHelperLibrary; import com.seclore.fs.helper.library.FSHelper; import com.seclore.fs.helper.core.ProtectedFile; import com.seclore.fs.helper.exception.FSHelperException; public class Example { public static void main(String[] args) { try { if(FSHelperLibrary.isInitialized() == true) { FSHelper fsTenant = FSHelperLibrary.getHelper("tenant-1"); // File path of protected file String protectedFilePath = "D:/Seclore/protectedFile.txt" ; // Display name of file which will be mentioned in the audit logs. String protectedFileDisplayName = "Protected File.txt" ; String activityComment = "These comments will be visible in the Policy Server Activity logs against this activity"; fsTenant.unprotectX(null, protectedFilePath, protectedFileDisplayName, activityComment); } else { // Please refer initialize() method of FSHelperLibrary for more details } } catch(FSHelperException exception) { Log("Message : " + exception.getMessage()); Log("Error Code : " + exception.getErrorCode()); } } } </pre> @param pPSConnection {@link PSConnection} received from {@link FSHelper#createPSConnection()} or {@link FSHelper#getPSConnection()}. This is an optional parameter. In case it is {@code null}, this API picks up a connection from the connection pool. @param pFilePath This string will contain the path of the file which is to be unprotected. @param pDisplayFilePath This string will contain the logical path of the file which is to be unprotected. @param pActivityComments This string will contain activity comments to be sent to Policy Server for this unprotect request. It is an optional parameter. @throws FSHelperException This method may fail due to various reasons. Some important reasons being: <ul> <li>User does not have permission to write and delete the file.</li> <li>File is not Seclore protected.</li> <li>File is already opened by another application.</li> <li>There is no enough memory available to read the complete file in-memory.</li> <li>There is no enough disk space available to store the file.</li> <li>Policy Server is not reachable.</li> <li>Policy Server is not up and running.</li> <li>Authenticated user does not have rights to unprotect the file.</li> </ul>- Throws:
FSHelperException
-
sendRequest
public String sendRequest(PSConnection pPSConnection, int pRequestType, String pRequestXML) throws FSHelperException This method will send a request to the Seclore Policy Server.- Parameters:
pPSConnection- PSConnection received from createPSConnection or getPSConnection. This is an optional parameter. In case it is NULL, this API picks up a session from the session pool.pRequestType- This parameter specifies the type of request being sent. It can be one of the values ofRequestType.pRequestXML- This string will contain request XML to be sent to the server.- Returns:
- The response XML received from server
- Throws:
FSHelperException
-
wrap
public ProtectedFile wrap(PSConnection pPSConnection, String pProtectedFilePath, String pDisplayFileName) throws FSHelperException This method wrap (convert) protected file into HTML file and return absolute file location of wrapped file. Wrapped HTML file will be created in same directory of pProtectedFilePath and name of the HTML file will be same as protected filename followed by ".html" suffix.
Example: If the given pProtectedFilePath is 'D:/123asdf_SampleFile.pdf' then wrapped HTML file will be 'D:/123asdf_SampleFile.pdf.html'.
Note:
- This method does not delete the protected file after wrapping. Caller should delete both protected file and HTML wrapped file after uses.
- Make sure no file should be exist with the file name of given pProtectedFilePath in same directory. Example: if pProtectedFilePath 'D:/123asdf_SampleFile.pdf' then no file should exist with filename '123asdf_SampleFile.pdf.html'.Code Usage:
import com.seclore.fs.helper.library.FSHelperLibrary; import com.seclore.fs.helper.library.FSHelper; import com.seclore.fs.helper.core.ProtectedFile; import com.seclore.fs.helper.exception.FSHelperException; public class Example { public static void main(String[] args) { try { if(FSHelperLibrary.isInitialized() == true) { FSHelper fsTenant = FSHelperLibrary.getHelper("tenant-1"); // File path of protected file which is to be wrapped. String protectedFilePath = "D:/Seclore/protectedFile.txt" ; String fileDisplayName = "Protected File.txt" ; ProtectedFile wrappedFileDetails = fsTenant.wrap(null, protectedFilePath, fileDisplayName); } else { // Please refer initialize() method of FSHelperLibrary for more details } } catch(FSHelperException exception) { Log("Message : " + exception.getMessage()); Log("Error Code : " + exception.getErrorCode()); } } }- Parameters:
pPSConnection-PSConnectionreceived fromcreatePSConnection()orgetPSConnection(). This is an optional parameter. In case it isnull, this API picks up a connection from the connection pool.pProtectedFilePath- Absolute path of protected file to be Html wrapped.pDisplayFileName- The original file name. It should be just file name.
This is a logical path and not necessarily exist on disk.
This path is used for display and logging the activity on Policy Server.- Returns:
ProtectedFileinstance which contains path of the wrapped file. Note - FileId in this instance is null.- Throws:
FSHelperException- This method may fail due to various reasons. Some important reasons being:- User does not have permission to write and delete the file.
- File is already opened by another application.
- There is no enough disk space available to store wrapped file.
- Policy Server is not reachable.
- Policy Server is not up and running.
-
wrap
public ProtectedFile wrap(PSConnection pPSConnection, String pProtectedFilePath, String pDisplayFileName, String pcustomAttributeData) throws FSHelperException This method wrap (convert) protected file into HTML file and return absolute file location of wrapped file. Wrapped HTML file will be created in same directory of pProtectedFilePath and name of the HTML file will be same as protected filename followed by ".html" suffix.
Example: If the given pProtectedFilePath is 'D:/123asdf_SampleFile.pdf' then wrapped HTML file will be 'D:/123asdf_SampleFile.pdf.html'.
Note:
- This method does not delete the protected file after wrapping. Caller should delete both protected file and HTML wrapped file after uses.
- Make sure no file should be exist with the file name of given pProtectedFilePath in same directory. Example: if pProtectedFilePath 'D:/123asdf_SampleFile.pdf' then no file should exist with filename '123asdf_SampleFile.pdf.html'.- Parameters:
pPSConnection- : An initializedPSConnectionobject received from getPSConnection() or createPSConnection() method. This is an optional parameter. In case it is NULL, this API picks up a session from the session pool.pProtectedFilePath- : Absolute path of protected file to be Html wrapped.pDisplayFileName- : The original file name. It should be just file name.
This is a logical path and not necessarily exist on disk.
This path is used for display and logging the activity on Policy Server.pcustomAttributeData- : Any custom data need to be present in wrapped file. It will be written in sec_x_attrs xml- Returns:
- :
ProtectedFileinstance which contains path of the wrapped file. Note - FileId in this instance is null. - Throws:
FSHelperException- This method may fail due to various reasons. Some important reasons being:- User does not have permission to write and delete the file.
- File is already opened by another application.
- There is no enough disk space available to store wrapped file.
- Policy Server is not reachable.
- Policy Server is not up and running.
-
wrap
public ProtectedFile wrap(PSConnection pPSConnection, WrapperInputDetails pWrapperInputDetails) throws FSHelperException This method wrap (convert) protected file into HTML file and return absolute file location of wrapped file. Wrapped HTML file will be created in same directory of pProtectedFilePath and name of the HTML file will be same as protected filename followed by ".html" suffix.
Example: If the given pProtectedFilePath is 'D:/123asdf_SampleFile.pdf' then wrapped HTML file will be 'D:/123asdf_SampleFile.pdf.html'.
Note:
- This method does not delete the protected file after wrapping. Caller should delete both protected file and HTML wrapped file after uses.
- Make sure no file should be exist with the file name of given pProtectedFilePath in same directory. Example: if pProtectedFilePath 'D:/123asdf_SampleFile.pdf' then no file should exist with filename '123asdf_SampleFile.pdf.html'.- Parameters:
pPSConnection- : An initializedPSConnectionobject received from getPSConnection() or createPSConnection() method. This is an optional parameter. In case it is NULL, this API picks up a session from the session pool.pWrapperInputDetails- : This Object contains all the details that the wrapped file should contain. For more details seeWrapperInputDetails- Returns:
- :
ProtectedFileinstance which contains path of the wrapped file. Note - FileId in this instance is null. - Throws:
FSHelperException- This method may fail due to various reasons. Some important reasons being:- User does not have permission to write and delete the file.
- File is already opened by another application.
- There is no enough disk space available to store wrapped file.
- Policy Server is not reachable.
- Policy Server is not up and running.
-
unwrap
This method unwrap (converts) warpped HTML file into native file and return absolute file location of unwrapped file. Unwrapped native file will be created in same directory of pHtmlWrappedFilePath and name of the native file will be same as original wrapped filename followed by native extension suffix.
Example :- If pHtmlWrappedFilePath is 'D:/123asdf_SampleFile.pdf.html' and original filename is 'SampleFile.docx', then unwrapped file path would be 'D:/123asdf_SampleFile.pdf.docx'
- If pHtmlWrappedFilePath is 'D:/123asdf_SampleFile.pdf.html' and original filename is 'SampleFile.pdf', then unwrapped file path would be 'D:/123asdf_SampleFile.pdf'
Note:
- This method does not delete the HTML file after un-wrapping. Caller should delete both protected file and HTML wrapped file after uses.
- Make sure no file should be exist with the file name of given pHtmlWrappedFilePath in same directory. Example: if pHtmlWrappedFilePath 'D:/123asdf_SampleFile.pdf.html' then no file should exist with filename '123asdf_SampleFile.pdf'.Code Usage:
import com.seclore.fs.helper.library.FSHelperLibrary; import com.seclore.fs.helper.library.FSHelper; import com.seclore.fs.helper.core.ProtectedFile; import com.seclore.fs.helper.exception.FSHelperException; public class Example { public static void main(String[] args) { try { if(FSHelperLibrary.isInitialized() == true) { FSHelper fsTenant = FSHelperLibrary.getHelper("tenant-1"); // File path of HTML wrapped file which is to be unwrapped. String htmlWrappedFilePath = "D:/Seclore/htmlWrappedFile.txt.html" ; ProtectedFile UnwrappedFileDetails = fsTenant.unwrap(htmlWrappedFilePath); } else { // Please refer initialize() method of FSHelperLibrary for more details } } catch(FSHelperException exception) { Log("Message : " + exception.getMessage()); Log("Error Code : " + exception.getErrorCode()); } } }- Parameters:
pHtmlWrappedFilePath- Absolute path of HTML wrapped file.- Returns:
ProtectedFileinstance which contains path of the unwrapped (but protected) file. Note - FileId in this instance is null.- Throws:
FSHelperException- This method may fail due to various reasons. Some important reasons being:- User does not have permission to write and delete the file.
- File is already opened by another application.
- There is no enough disk space available to store unwrapped (protected) file.
- Policy Server is not reachable.
- Policy Server is not up and running.
-
protectMailBody
public IProtectedMailOutput protectMailBody(PSConnection pPSConnection, ProtectionType pProtectionType, String pProtectionXML, String pProtectorDetails, String pActivityComments, IMailInput pMailInput) throws FSHelperException Protect the email body passed in pMailInput. The protected mail content and the new body content will be provided inIProtectedMailOutput.- Parameters:
pPSConnection-PSConnectionreceived fromcreatePSConnection()orgetPSConnection(). This is an optional parameter. In case it isnull, this API picks up a connection from the connection pool.pProtectionType- Type of file protection fromProtectionType.pProtectionXML- Protection details XML based on the ProtectionType passed above. It should be in XML format. For details of format for each ProtectionType, please refer documentation ofProtectionType.pProtectorDetails- Protector details XML of the file. This is an optional parameter. Following defines XML structure of this<!-- The Protector user. This tag is optional. If provided, this entity will be considered as file protector. --> <protector> <entity> <!-- Type of protector entity (1 - User, 2 - Group). --> <type></type> <!-- Unique identifier of the Repository in which the user exist. --> <rep-code></rep-code> <!-- Unique Identifier of User/Group in the repository. --> <id></id> </entity> </protector>pActivityComments- Activity comments to be sent to Policy Server for this protect request. It is an optional parameter.pMailInput- Implementation ofIMailInputcontaining all the information regarding mail(Sender, Recipients, Subject, Body, inline attachments etc.)- Returns:
IProtectedMailOutput, which contains protected original body as attachments and dummy body to replace with.- Throws:
FSHelperException- This method may fail due to various reasons. Some important reasons being:- User does not have permission to write and delete the file.
- File is already opened by another application.
- There is no enough memory available to read the complete file in-memory.
- There is no enough disk space available to store protected file.
- Policy Server is not reachable.
- Policy Server is not up and running.
- Logged in user does not have license to protect files.
-
getSmailBodyBuffer
public IMailBody getSmailBodyBuffer(PSConnection pPSConnection, String pOutputFolderPath) throws FSHelperException This method returnsIMailBodyfor seclore protected mail.- Parameters:
pPsConnection- PSConnection received from createPSConnection or getPSConnection. This is an optional parameter. In case it is NULL, this API picks up a session from the session pool.pOutputFolderPath- Location of the folder where output file needs to be written.- Returns:
IMailBody- Throws:
FSHelperException
-
getCustomAttributesFromHTMLFile
This method returns the custom attributes from Seclore HTML wrapped file.- Parameters:
pFilePath- This string will contain the path of the file.- Returns:
- the custom attributes
- Throws:
FSHelperException- in case file is not FileSecure protected or wrapped or is missing.
-
getLocaleFromHTMLFile
This method returns the Locale of Seclore HTML wrapped file.- Parameters:
pFilePath- This string will contain the path of the file.- Returns:
- the Locale
- Throws:
FSHelperException- in case file is not FileSecure protected or wrapped or is missing.
-
unprotectMailBody
public IMailOutput unprotectMailBody(PSConnection pPSConnection, IProtectedMailInput pProtectedMailInput, String pActivityComments) throws FSHelperException This method unprotects a protected mail file. Authenticated PSConnection used to unprotect the file should have rights to unprotect the file. Also based on<include-inline-attachment-in-mail-body>tag configured in ps config file, this method returns inline attachments separately or embedded in mail body.- Parameters:
pPSConnection-PSConnectionreceived fromcreatePSConnection()orgetPSConnection(). This is an optional parameter. In case it isnull, this API picks up a connection from the connection pool.pProtectedMailInput-IProtectedMailInputcontaining information of protected mail.pActivityComments- Activity comments to be sent to Policy Server for this unprotect request. This is an optional parameter.- Returns:
IMailOutputcontains unprotected mail body, along with other mail details (To, CC, BCC, From, Subject, Inline attachments from protected body etc.)- Throws:
FSHelperException- This method may fail due to various reasons. Some important reasons being:- User does not have permission to write and delete the file.
- File is already opened by another application.
- There is no enough memory available to read the complete file in-memory.
- There is no enough disk space available to store protected file.
- Policy Server is not reachable.
- Policy Server is not up and running.
- Logged in user does not have license to protect files.
-
protectAndGetSMail
public ProtectedSMail protectAndGetSMail(PSConnection pPSConnection, ProtectionType pProtectionType, String pProtectionXML, String pProtectorDetails, String pActivityComments, IMailInput pMailInput) throws FSHelperException Protect the email body passed in pMailInput. The protected SMail will be provided inProtectedFile.- Parameters:
pPSConnection-PSConnectionreceived fromcreatePSConnection()orgetPSConnection(). This is an optional parameter. In case it isnull, this API picks up a connection from the connection pool.pProtectionType- Type of file protection fromProtectionType.pProtectionXML- Protection details XML based on the ProtectionType passed above. It should be in XML format. For details of format for each ProtectionType, please refer documentation ofProtectionType.pProtectorDetails- Protector details XML of the file. This is an optional parameter. Following defines XML structure of this<!-- The Protector user. This tag is optional. If provided, this entity will be considered as file protector. --> <protector> <entity> <!-- Type of protector entity (1 - User, 2 - Group). --> <type></type> <!-- Unique identifier of the Repository in which the user exist. --> <rep-code></rep-code> <!-- Unique Identifier of User/Group in the repository. --> <id></id> </entity> </protector>pActivityComments- Activity comments to be sent to Policy Server for this protect request. It is an optional parameter.pMailInput- Implementation ofIMailInputcontaining all the information regarding mail(Sender, Recipients, Subject, Body, inline attachments etc.)- Returns:
ProtectedSMail, which contains protected original body and SMail details.- Throws:
FSHelperException- This method may fail due to various reasons. Some important reasons being:- User does not have permission to write and delete the file.
- File is already opened by another application.
- There is no enough memory available to read the complete file in-memory.
- There is no enough disk space available to store protected file.
- Policy Server is not reachable.
- Policy Server is not up and running.
- Logged in user does not have license to protect files.
-
isHTMLWrapped
This method checks whether the given file is HTML wrapped or not. An HTML file which not a wrapped file but an original HTML file is not considered as an HTMl wrapped file.- Parameters:
pHtmlWrappedFile- : Absolute path of the file which it is to be checked whether the file is HTML wrapped or not.- Returns:
- TRUE if file is HTML wrapped else returns FALSE
- Throws:
FSHelperException- This method may fail due to following reasons
- File is not present at the given file path.
- Some IO error occurs while reading the file.
-
isHTMLWrapSupported
This method will assert whether the file given can be HTML wrapped or not.- Parameters:
pFilePath- : Absolute path of the file which is to be checked for HTML wrapping.- Returns:
- TRUE if this file can be HTML wrapp else returns FALSE
- Throws:
FSHelperException- This method may fail due to following reasons.- File is not present at the given file path.
- Some IO error occurs while reading the file path for its extension.
-
getFileId
This method returns the File Identifier of protected or HTML wrapped file.- Parameters:
pFilePath- This string will contain the path of the file.- Returns:
- the File Identifier
- Throws:
FSHelperException- in case file is not Seclore protected.
-
getHTMLWrappedFileId
This method returns the File Identifier of Seclore HTML wrapped file.- Parameters:
pFilePath- This string will contain the path of the file.- Returns:
- the File Identifier
- Throws:
FSHelperException- in case file is not Seclore protected or wrapped or is missing.
-
getFileHeader
This method returns the header XML of the protected or HTML wrapped file.- Parameters:
pFilePath- This string will contain the path of the file.- Returns:
- the FileHeader XML
- Throws:
FSHelperException- in case file is not Seclore protected.
-
decryptJWEToken
public com.seclore.fs.ws.client.encryption.jwe.JWTData decryptJWEToken(String pJWEToken) throws FSHelperException Decrypt and validate the JWE token. The Token should be in a standard JWE Format. Following is the standard format
BASE64URL(UTF8(JWE Protected Header)) || '.' ||
BASE64URL(JWE Encrypted Key) || '.' ||
BASE64URL(JWE Initialization Vector) || '.' ||
BASE64URL(JWE Cipher text) || '.' ||
BASE64URL(JWE Authentication Tag)
For decryptionCryptoHandlerwill be used. if no implementation ofCryptoHandleris provided while initiating theFSHelperobject then the method will throwFSHelperException- Parameters:
pJWEToken-- Returns:
- Throws:
FSHelperException
-
protectAndWrap
public ProtectedFile protectAndWrap(PSConnection pPSConnection, String pFilePath, String pDisplayFilePath, ProtectionType pProtectionType, String pProtectXML, String pProtectorDetails, String pActivityComments) throws FSHelperException This method protects the given unprotected input file using protection details and wraps (convert) it into HTML file and returns object of ProtectedFile This wrapped HTML file will replace the file at pFilePath and name of the HTML file will be same as filename followed by ".html" suffix.
Example: If the given FilePath is 'D:/123asdf_SampleFile.pdf' then protected file will be 'D:/123asdf_SampleFile.pdf.html'.
Note:
- Make sure no file should be exist with the file name of given pProtectedFilePath in same directory. Example: if pProtectedFilePath 'D:/123asdf_SampleFile.pdf' then no file should exist with filename '123asdf_SampleFile.pdf.html'. The output files name can be retrieved from the returned object ProtectedFile.- Parameters:
pPSConnection-PSConnectionreceived fromcreatePSConnection()orgetPSConnection(). This is an optional parameter. In case it isnull, this API picks up a connection from the connection pool.pFilePath- The path of the file which is to be protected.pDisplayFilePath- The logical path of the file which is to be protected.
This is a logical path and not necessarily exist on disk.
This path is used for logging the protect activity on Policy Server.pProtectionType- Type of of protection fromProtectionType. In case of any other value, this method returns an error.pProtectXML- The protection details XML based on the ProtectionType passed above. It should be in XML format. For details of format for each ProtectionType, please refer documentation ofProtectionType.pProtectorDetails- The protector details XML of the file. This is an optional parameter. Following defines XML structure of this parameter:<!-- The Protector user. This tag is optional.If provided, this entity will be considered as file protector. --> <protector> <entity> <!-- Type of protector entity (1 - User, 2 - Group). --> <type></type> <!-- Unique identifier of the Repository in which the user exist. --> <rep-code></rep-code> <!-- Unique Identifier of User/Group in the repository. --> <id></id> </entity> </protector>pActivityComments- This string will contain activity comments to be sent to Policy Server for this protectAndWrap request. It is an optional parameter.- Returns:
ProtectedFilewith File Id and File path.- Throws:
FSHelperException- This method may fail due to various reasons. Some important reasons being:- User does not have permission to write and delete the file.
- File is already opened by another application.
- There is no enough disk space available to store protected file.
- Policy Server is not reachable.
- Policy Server is not up and running.
- Logged in user does not have license to protect files.
-
unwrapAndUnprotect
public UnprotectedFile unwrapAndUnprotect(PSConnection pPSConnection, String pstrFilePath, String pstrDisplayFilePath, String pstrActivityComments) throws FSHelperException This method is used to unwrap and unprotect the seclore protected seclore supported and basic files.- Parameters:
pPSConnection-PSConnectionreceived fromcreatePSConnection()orgetPSConnection(). This is an optional parameter. In case it isnull, this API picks up a connection from the connection pool.pFilePath- This string will contain the path of the file which is to be unprotected.pDisplayFilePath- This string will contain the logical path of the file which is to be unprotected.pActivityComments- This string will contain activity comments to be sent to Policy Server for this unprotectAndUnwrap request. It is an optional parameter.- Throws:
FSHelperException- This method may fail due to various reasons. Some important reasons being:- User does not have permission to write and delete the file.
- File is not Seclore protected.
- File is already opened by another application.
- There is no enough memory available to read the complete file in-memory.
- There is no enough disk space available to store the file.
- Policy Server is not reachable.
- Policy Server is not up and running.
- Authenticated user does not have rights to unprotect the file.
-