3) SDF SDK API Specification
scsl.jar Class API Function Description
▶ void SettingPathForProperty() : A function that provides the path to the configuration file.
- Control Method:
- Package name: SCSL
- Class Name: SLDsFile
- Description: A function that provides the path to the configuration information file.
Parameter
| Type | Variable Name | Description | Note |
|---|---|---|---|
| [IN] String | propertyPath | Set the path for the configuration information file (SOFTCAMP.properties). | Including file name For example) c:/SOFTCAMP.properties |
Return Value
- None
Note
If you do not use a configuration information file, it will operate with default settings, but if you are using a 4.x key file, you must use a configuration information file due to enhanced security features.
| Name | Settings | Description | default value |
|---|---|---|---|
| LogWrite | If 0, do not log. | Log file creation status | 1 |
| LogPath | Log file creation path | Log file creation path | ./log/ |
| FileExt | The delimiter is ';' and uses lowercase letters. | Supported Extension List | doc;xls;ppt;csv;hwp;gul;txt;pdf;bmp;jpg;jpeg;gif;tif;tiff;rtf;jtd;pptx;docx;xlsx;tmp |
| ServiceID | ID | Service ID related to key file authentication | |
| useServiceLinkerIcon | If 0, then unused | Service linker icon support (SCDSA004 document does not apply) | 0 |
| nEncCache | 1 If Cache Mode | When encrypting, if the target file exists, do not encrypt the file (only MAC encryption API is supported) | 0 |
| nMaxLoopCache | Value greater than 1 | Maximum wait loop count when in a waiting state in Cache Mode | 300 |
| FileBufferSize | Value greater than 1 | Size of the buffer when reading during File I/O | 65536 |
| LogFilter | The delimiter is ';' | Types of logs to be recorded in the log file | ERROR; INFO; WARNING; |
| Algorithm | AES or ARIA | Encryption algorithms used for document encryption (when set to ARIA, the key algorithm uses RSA) | AES |
| DocumentVersion | If it is 4, SCDSA004 document | Document Header Version (If the Algorithm setting value is not AES, DocumentVersion is set to 4) | 3 |
| AnsiCharset | Character Set | Setting when using a Character Set different from the system's default Locale | Default Locale of the System |
| KeyFileOffset | If 0, then unused | A feature that loads and processes only a part of the key file to improve performance when loading the key file into memory. | 4.1.3.0 Previous: 0 After 4.1.3.0: 1 |
-
When setting up useServiceLinkerIcon, files encrypted with the service linker will be displayed with a red icon on the client. (Please check whether it is supported on the client before setting it up.)
-
FileBufferSize has been modified to use a buffer for Read/Write to improve File I/O performance, and the size of the buffer can be configured as it is affected by the performance of the respective network. The appropriate buffer size for the system can be found using the SCSL.FindBufferSize class.
-
Usage : java -classpath scsl.jar SCSL.FindBufferSize testFile (to execute a jar file) or java SCSL.FindBufferSize testFile (to execute a class)
Example
import SCSL.*;
public final class MainTest
{
public static void main(String[] args)
{
SLDsFile sFile = new SLDsFile();
sFile.SettingPathForProperty( "C:\\softcamp\\softcamp.properties" );
/* do working */
}
}
▶ public void SLDsInitDAC() : Initialization function
- Control Method: DAC
- Package name: SCSL
- Class Name: SLDsFile
- Description: Initialization function for using the Service Linker.
Parameter
- None
Return Value
- None
Note
- Initialize the information added by SLDsAddUserDAC() or SLDsAddGroupDAC()
▶ int SLDsAddUserDAC() : User addition function
- Control Method: DAC
- Package name: SCSL
- Class Name: SLDsFile
- Description: A function to add users to the security policy in the header of a security document.
Parameter
| Type | Variable Name | Description | Note |
|---|---|---|---|
| [IN] String | userID | User ID | |
| [IN] String | auth | Permission String | Permission String Referencehttps://wiki.softcamp.co.kr/x/ng1YB |
| [IN] int/String | expireDate | Setting Expiration Date | int - 0: no deadline, 1: only today, 2: by the due date, n: by n days String - Format YYYYMMDD e.g. "20231231" |
| [IN] int | readLimit | Read Count | 0: No limit on reading count, n: Can read n times |
| [IN] int | printLimit | Print count | 0: No limit on the number of outputs, n: Can output n times |
Return Value
- 0 : Success
- Other values: Failure
Note
- None
▶ int SLDsAddGroupDAC() : Group addition function
- Control Method: DAC
- Package name: SCSL
- Class Name: SLDsFile
- Description: A function to add a group to the security policy of the header of a security document.
Parameter
| Type | Variable Name | Description | Note |
|---|---|---|---|
| [IN] String | groupID | Group ID | |
| [IN] String | auth | Permission String | Permission String Referencehttps://wiki.softcamp.co.kr/x/ng1YB |
| [IN] int/String | expireDate | Setting Expiration Date | int - 0: no deadline, 1: only today, 2: by the due date, n: by n days String - Format YYYYMMDD e.g. "20231231" |
| [IN] int | readLimit | Read Count | 0: No limit on reading count, n: Can read n times |
| [IN] int | printLimit | Print count | 0: No limit on the number of outputs, n: Can output n times |
Return Value
- 0 : Success
- Other values: Failure
Note
- None
▶ int SLDsAddUserDACCL() : Add User DAC information
- Control Method: DAC
- Package name: SCSL
- Class Name: SLDsFile
- Description: A function to add a group to the security policy of the header of a security document.
Parameter
| Type | Variable Name | Description | Note |
|---|---|---|---|
| [IN] String | SERVERID | Server ID | |
| [IN] String | userID | User ID | |
| [IN] String | auth | Permission String | Permission String Referencehttps://wiki.softcamp.co.kr/x/ng1YB |
| [IN] int/String | expireDate | Setting Expiration Date | int - 0: no deadline, 1: only today, 2: by the due date, n: by n days String - Format YYYYMMDD e.g. "20231231" |
| [IN] int | readLimit | Read Count | 0: No limit on reading count, n: Can read n times |
| [IN] int | printLimit | Print count | 0: No limit on the number of outputs, n: Can output n times |
Return Value
- 0 : Success
- Other values: Failure
Note
- None
▶ public void SLDsInitGrade() : Initialization function
- Control Method: DAC
- Package name: SCSL
- Class Name: SLDsFile
- Description: Initialization function for using the Service Linker.
Parameter
- None
Return Value
- None
Note
- Initialize the information added with SLDsAddUserGrade()
▶ int SLDsAddUserGrade() : Function to add users who can access the grade document
- Control Method: DAC
- Package name: SCSL
- Class Name: SLDsFile
- Description: A function to add users to the security policy in the header of a security document.
Parameter
| Type | Variable Name | Description | Note |
|---|---|---|---|
| [IN] String | userID | User ID, Group ID, Grade ID | ** When setting the grade ID - Only expiration date can be set - auth must be set to 0000000. |
| [IN] String | auth | Permission String | Permission String Referencehttps://wiki.softcamp.co.kr/x/ng1YB |
| [IN] int/String | expireDate | Setting Expiration Date | int - 0: no deadline, 1: only today, 2: by the due date, n: by n days String - Format YYYYMMDD e.g. "20231231" |
| [IN] int | readLimit | Read Count | 0: No limit on reading count, n: Can read n times |
| [IN] int | printLimit | Print count | 0: No limit on the number of outputs, n: Can output n times |
Return Value
- 0 : Success
- Other values: Failure
Note
- None
Example
SCSL.SLDsFile sFile = new SCSL.SLDsFile();
sFile.SLDsInitGrade();
sFile.SLDsAddUserGrade("0000005", "000000000", "20231231", 0, 0); //등급에 유효 기간 설정
sFile.SLDsAddUserGrade("SECURITYDOMAIN", "111001101", "20231231", 0, 0); //사용자 권한 및 유효기간 설정
▶ public int SLDsEncFileDAC(...) : DAC method encryption function
- Control Method: DAC
- Package name: SCSL
- Class Name: SLDsFile
- Description: File encryption function using DAC method
Parameter
| Type | Variable Name | Description | Note |
|---|---|---|---|
| [IN] String | keyFilePath | Key file name (including path) | |
| [IN] String | srcFilePath | Original file name (including path) | |
| [IN] String | dstFilePath | Encrypted file name (including path) | |
| [IN] int | option | Re-encryption option if the original file is an encrypted file | 0: No encryption 1: Decrypt and re-encrypt |
Return Value
- 0 : Success
- Other values: Failure
Note
- None
Example
import SCSL.*;
public final class MainTest
{
public static void main(String[] args)
{
SLDsFile sFile = new SLDsFile();
sFile.SLDsInitDAC();
sFile.SLDsAddUserDAC("hcjeong;bbbb", "011100110", 0, 0, 0);
sFile.SLDsAddGroupDAC("group1;group2","111100011", 0, 0, 0);
sFile.SLDsAddUserDAC("hong;ddd", "001100110", 0, 0, 0);
int ret = sFile.SLDsEncFileDAC("c:\\keyFile\\keyDAC.sc", "c:/a.doc", "c:/a(암호).doc", 1);
/* 리턴 값에 따른 예외처리 */
}
}
▶ public int SLDsEncFileDACV2(...) : DAC method encryption function
- Control Method: DAC
- Package name: SCSL
- Class Name: SLDsFile
- Description: File encryption function using DAC method
Parameter
| Type | Variable Name | Description | Note |
|---|---|---|---|
| [IN] String | keyFilePath | Key file name (including path) | |
| [IN] String | systemName | Integration System Name | The name of the integration system is included in the creator information. |
| [IN] String | srcFilePath | Original file name (including path) | |
| [IN] String | dstFilePath | Encrypted file name (including path) | |
| [IN] int | option | Re-encryption option if the original file is an encrypted file | 0: No encryption 1: Decrypt and re-encrypt |
Return Value
- 0 : Success
- Other values: Failure
Note
- None
Example
import SCSL.*;
public final class MainTest
{
public static void main(String[] args)
{
SLDsFile sFile = new SLDsFile();
sFile.SLDsInitDAC();
sFile.SLDsAddUserDAC("hcjeong;bbbb", "011100110", 0, 0, 0);
sFile.SLDsAddGroupDAC("group1;group2","111100011", 0, 0, 0);
sFile.SLDsAddUserDAC("hong;ddd", "001100110", 0, 0, 0);
int ret = sFile.SLDsEncFileDACV2("c:\\keyFile\\keyDAC.sc", "EDMS", "c:/a.doc", "c:/a(암호).doc", 1);
/* 리턴 값에 따른 예외처리 */
}
}
▶ public int CreateDecryptFileDAC(...) : DAC method decryption function
- Control Method: DAC
- Package name: SCSL
- Class Name: SLDsFile
- Description: File decryption function using DAC method
Parameter
| Type | Variable Name | Description | Note |
|---|---|---|---|
| [IN] String | keyFilePath | Key file name (including path) | |
| [IN] String | groupID | Group ID for applying differentiated permissions | User ID is also possible |
| [IN] String | srcFilePath | Original file name (including path) | Encryption Document |
| [IN] String | dstFilePath | Encrypted file name (including path) | Decryption Document |
| [IN] String | authInfo | Permission Information (Base64 Encode) | Permission information created by SCGetFileType.dll - Can be omitted if not used |
Return Value
- 0 : Success
- -36: Original file is a regular document (non-encrypted document) -> No error handling required and applies the same as success.
- Other values: Refer to error codeshttps://wiki.softcamp.co.kr/x/ow1YB
Note
- If the original file is an unencrypted file, return a -36 code value after copying the file to the target path.
If the encrypted file is a MAC file, see changes in ※13.
Example
import SCSL.*;
public final class MainTest
{
public static void main(String[] args)
{
SLDsFile sFile = new SLDsFile();
int ret = sFile. CreateDecryptFileDAC (
"c:\\keyDAC.sc", //키 파일 경로
"user0001", // 아이디
"c:\\a(암호).doc", // 복호화 할 소스 경로
"c:\\a(복호).doc", // 복호화 할 대상 경로
"" // 권한 정보 ( 사용하지 않는 경우 생략 가능 )
);
/* 리턴 값에 따른 예외처리 */
}
}
▶ public int CreateEncryptFile(...) : MAC method encryption function
- Control Method: MAC
- Package name: SCSL
- Class Name: SLDsFile
- Description: MAC-based file encryption function
Parameter
| Type | Variable Name | Description | Note |
|---|---|---|---|
| [IN] String | keyFilePath | Key file name (including path) | |
| [IN] String | categoryID | Category ID for Permission Classification | |
| [IN] String | categoryName | Category names for permission separation | Enter 'Server' if the category name is not specified. |
| [IN] String | srcFilePath | Original file name (including path) | Original Document |
| [IN] String | dstFilePath | Encrypted file name (including path) | Encryption Document |
| [IN] int | option | Re-encryption option if the original file is an encrypted file | 0: No encryption 1: Decrypt and re-encrypt |
Return Value
- 0 : Success
- Other values: Refer to error codeshttps://wiki.softcamp.co.kr/x/ow1YB
Note
- None
Example
import SCSL.*;
public final class MainTest
{
public static void main(String[] args)
{
SLDsFile sFile = new SLDsFile();
int ret = sFile.CreateEncryptFile(
"c\\key.sc", //키 파일 경로
"0000001", // 범주 아이디
"기밀문서", // 범주명을 넣어준다.
" c\\a.doc", // 암호화 할 소스 경로
" c\\a(암호).doc", // 암호화 할 목적 경로
1 // 원본 파일이 암호화 된 경우 옵션 값
);
/* 리턴 값에 따른 예외처리 */
}
}
▶ public int DSAPIEncFileV2(...) : MAC method encryption function
- Control Method: MAC
- Package name: SCSL
- Class Name: SLDsFile
- Description: MAC-based file encryption function
Parameter
| Type | Variable Name | Description | Note |
|---|---|---|---|
| [IN] String | keyFilePath | Key file name (including path) | |
| [IN] String | categoryID | Category ID for Permission Classification | |
| [IN] String | categoryName | Category names for permission separation | Enter 'Server' if the category name is not specified. |
| [IN] String | systemName | Integration System Name | The name of the integration system is included in the creator information. |
| [IN] String | srcFilePath | Original file name (including path) | Original Document |
| [IN] String | dstFilePath | Encrypted file name (including path) | Encryption Document |
| [IN] int | option | Re-encryption option if the original file is an encrypted file | 0: No encryption 1: Decrypt and re-encrypt |
Return Value
- 0 : Success
- Other values: Refer to error codeshttps://wiki.softcamp.co.kr/x/ow1YB
Note
- The system name received as a parameter is used as the creator information in the Document Security Information View tab of the encrypted file.
Example
import SCSL.*;
public final class MainTest
{
public static void main(String[] args)
{
SLDsFile sFile = new SLDsFile();
int ret = sFile. DSAPIEncFileV2 (
"c\\key.sc", //키 파일 경로
"0000001", // 범주 아이디
"기밀문서", // 범주명을 넣어준다.
"EDMS", // 연동 시스템 이름
" c\\a.doc", // 암호화 할 소스 경로
" c\\a(암호).doc", // 암호화 할 목적 경로
1 // 원본 파일이 암호화 된 경우 옵션 값
);
/* 리턴 값에 따른 예외처리 */
}
}
▶ public int DSAPIEncFileV2AddExpireDate(...) : MAC method encryption function
- Control Method: MAC
- Package name: SCSL
- Class Name: SLDsFile
- Description: MAC-based file encryption function
- The document generated through this function is only usable until the specified ExpireDate.
- After the specified date, it may not be visible or may be destroyed depending on the destruction option.
Parameter
| Type | Variable Name | Description | Note |
|---|---|---|---|
| [IN] String | keyFilePath | Key file name (including path) | |
| [IN] String | categoryID | Category ID for Permission Classification | |
| [IN] String | categoryName | Category names for permission separation | Enter 'Server' if the category name is not specified. |
| [IN] String | systemName | Integration System Name | The name of the integration system is included in the creator information. |
| [IN] String | srcFilePath | Original file name (including path) | Original Document |
| [IN] String | dstFilePath | Encrypted file name (including path) | Encryption Document |
| [IN] String | expireDate | Expiration Date | format like "20250101" |
| [IN] String | autoDestroy | Destruction Options | "0" : Unable to open, "4" : Destroy |
| [IN] int | option | Re-encryption option if the original file is an encrypted file | 0: No encryption 1: Decrypt and re-encrypt |
Return Value
- 0 : Success
- Other values: Refer to error codeshttps://wiki.softcamp.co.kr/x/ow1YB
Note
- None
Example
import SCSL.*;
public final class MainTest
{
public static void main(String[] args)
{
SLDsFile sFile = new SLDsFile();
int ret = sFile.DSAPIEncFileV2AddExpireDate(
"c:/keyFile/key.sc",
"0000001",
"1등급",
"KM",
"c:/test/test.doc",
"c:/test/testAddDestroyEnc.doc",
"20071101", // 예) "20070820" 같은로직
"4", // "0" : 열지 못하게, "4" : 파기
1 // 원본 파일이 암호화 된 경우 옵션 값
);
/* 리턴 값에 따른 예외처리 */
}
}
▶ public int CreateDecryptFile(...) : MAC method decryption function
- Control Method: MAC
- Package name: SCSL
- Class Name: SLDsFile
- Description: MAC method file decryption function
Parameter
| Type | Variable Name | Description | Note |
|---|---|---|---|
| [IN] String | keyFilePath | Key file name (including path) | |
| [IN] String | categoryID | Category ID for Permission Classification | |
| [IN] String | srcFilePath | Original file name (including path) | Original Document |
| [IN] String | dstFilePath | Encrypted file name (including path) | Encryption Document |
| [IN] String | authInfo | Permission Information (Base64 Encode) | Permission information created by SCGetFileType.dll - Can be omitted if not used |
Return Value
- 0 : Success
- -36: Original file is a regular document (non-encrypted document) -> No error handling required and applies the same as success.
- Other values: Refer to error codeshttps://wiki.softcamp.co.kr/x/ow1YB
Note
- If the original file is an unencrypted file, return a -36 code value after copying the file to the target path.
If the encrypted file is not DAC, refer to note 13 for changes.
Example
import SCSL.*;
public final class MainTest
{
public static void main(String[] args)
{
SLDsFile sFile = new SLDsFile();
int ret = sFile.CreateDecryptFile(
"c:\\key.sc", //키 파일 경로
"0000001", // 범주 아이디
"c:\\a(암호).doc", // 복호화 할 소스 경로
"c:\\a(복호).doc", // 복호화 할 대상 경로
authInfo // 권한 정보 ( 사용하지 않는 경우 생략 가능 )
);
/* 리턴값에 따른 예외처리 */
}
}
▶ public int isEncryptFile(...) : Function to determine encryption status
- Control Method: ALL
- Package name: SCSL
- Class Name: SLBsUtil
- Description: Function to determine whether the document is encrypted.
Parameter
| Type | Variable Name | Description | Note |
|---|---|---|---|
| [IN] String | filePath | Check file name (including path) |
Return Value
- 1 : Encrypted File
- 0 : General File
- -1 : When an Exception Occurs
Note
- None
Example
import SCSL.*;
public final class MainTest
{
public static void main(String[] args)
{
SLBsUtil sUtil = new SLBsUtil();
int encrypted = sUtil.isEncryptFile("./a.doc");
}
}
▶ public int DSEncMethod(...) : Function to determine the encryption method of the encrypted file.
- Control Method: ALL
- Package name: SCSL
- Class Name: SLDsEncDecHeader
- Description: Function to check the encryption method of the file.
Parameter
| Type | Variable Name | Description | Note |
|---|---|---|---|
| [IN] String | filePath | Check file name (including path) |
Return Value
- 0: MAC Method Encrypted File
- 1: DAC method encryption file
- 2: GRADE method encrypted file
- -1 : Abnormal encrypted file
- -36 : General File
- Other values: Refer to error codeshttps://wiki.softcamp.co.kr/x/ow1YB
Note
- None
Example
DSSimpleEncFileDAC 함수에 있음.
** 선언 시 properties에 Key 파일 경로를 설정 하거나 Key 파일 경로 또는 DS HeaderKey 와 Custom Key를 넣어 주어야 한다.
- SLDsEncDecHeader()
=> properties 에 DSKEYENCRYPT_KEYFILE 설정 필요(Document Security 하드코딩된 암호화 키 노출 취약점 개선)
- SLDsEncDecHeader(String KeyFilePath)
- SLDsEncDecHeader(String DSHeaderKey, String CustomHeaderKey)
▶ public int DSIsSupportFile(...) : Function to check if the file is a supported extension.
- Control Method: ALL
- Package name: SCSL
- Class Name: SLDsFile
- Description: Checks if the received parameter is a supported extension file.
Parameter
| Type | Variable Name | Description | Note |
|---|---|---|---|
| [IN] String | filePath | Check file name (including path) |
Return Value
- 1 : Supported Extensions
- 0 : Unsupported file extension
- Other values: Refer to error codeshttps://wiki.softcamp.co.kr/x/ow1YB
Note
- None
Example
DSSimpleEncFileDAC 함수에 있음.
▶ public int DSSimpleEncFile(...) : Simple file encryption function using MAC method
- Control Method: MAC
- Package name: SCSL
- Class Name: SLDsFile
- Description: Performs file encryption using the MAC method.
- Encrypt with ".dsd" even for unsupported extensions and return 0.
- a.log encryption => a.log.dsd
Parameter
| Type | Variable Name | Description | Note |
|---|---|---|---|
| [IN] String | keyFilePath | Key file name (including path) | |
| [IN] String | categoryID | Category ID for Permission Classification | |
| [IN] String | categoryName | Defined category name | Enter 'Server' if the category name is not specified. |
| [IN] String | srcFilePath | Original file name (including path) | Original Document |
| [IN] String | dstFilePath | Encrypted file name (including path) | Encryption Document |
| [IN] int | option | Re-encryption option if the original file is an encrypted file | 0: No encryption 1: Decrypt and re-encrypt |
Return Value
- 0: Success
- Other values: Refer to error codeshttps://wiki.softcamp.co.kr/x/ow1YB
Note
- None
Example
DSSimpleEncFileDAC 함수에 있음.
▶ public int DSSimpleEncFileDAC(...) : DAC method's Simple file encryption function
- Control Method: DAC
- Package name: SCSL
- Class Name: SLDsFile
- Description: Performs file encryption using the DAC method.
- Encrypt with ".dsd" even for unsupported extensions and return 0.
- a.log encryption => a.log.dsd
Parameter
| Type | Variable Name | Description | Note |
|---|---|---|---|
| [IN] String | keyFilePath | Key file name (including path) | |
| [IN] String | srcFilePath | Original file name (including path) | Original Document |
| [IN] String | dstFilePath | Encrypted file name (including path) | Encryption Document |
| [IN] int | option | Re-encryption option if the original file is an encrypted file | 0: No encryption 1: Decrypt and re-encrypt |
Return Value
- 0: Success
- Other values: Refer to error codeshttps://wiki.softcamp.co.kr/x/ow1YB
Note
- For unsupported file extensions, permissions for reading, extracting, exporting, and changing permissions are granted.
- Branch by checking if it is a supported extension using the DSIsSupportFile API.
Example
import SCSL.*;
public final class MainTest
{
public static void main(String[] args)
{
SLDsFile sFile = new SLDsFile();
// 키 파일 입력 할 경우
String keyDACPath = "S:\\TFS_Project2\\Linker\\ServiceLinker\\src\\JavaServiceLinker\\keyfiles\\test44\\KeyDAC_44.sc";
SLDsEncDecHeader DsEncDecHeader = new SLDsEncDecHeader(keyDACPath);
// 키 직접 입력 할 경우
SLDsEncDecHeader SLDSHeader = new SLDsEncDecHeader("DS Server Header Key", "Custom Header Key");
int ret = 0;
// 암호화 방식 체크
ret = DsEncDecHeader.DSEncMethod( "c:/test/b(MAC보안).txt" );
System.out.println( "ret : " + ret );
// 확장자 체크
ret = sFile.DSIsSupportFile( "c:/test/a.log" );
System.out.println( "지원되는 확장자 여부 a.log : " + ret );
ret = sFile.DSIsSupportFile( "c:/test/.txt" );
System.out.println( "지원되는 확장자 여부 a.txt : " + ret );
// 간단 암호화 테스트 MAC
int nSimple = sFile.DSSimpleEncFile(
"c:/keyFile/key.sc",
"0000010",
"Server",
"c:/test/a.log",
"c:/test/a(MAC암호).log",
1
);
System.out.println( "nSimple : " + nSimple );
// 간단 암호화 테스트 DAC
String srcPath = new String( "c:/test/a.log" );
sFile.SLDsInitDAC();
if( sFile.DSIsSupportFile( srcPath ) == 0 )
{
// 지원하지 않는 확장자일 경우 읽기, 해제, 반출, 권한 변경 권한을 준다.
sFile.SLDsAddUserDAC( "hcjeong", "010110001", 0, 0, 0 );
}
else
sFile.SLDsAddUserDAC( "hcjeong", "010000000", 0, 0, 0 );
}
int nSimpleDAC = sFile.DSSimpleEncFileDAC( "c:/keyFile/keyDAC.sc", "c:/test/a.log",
"c:/test/a(simDAC암호).log",
1
);
}
▶ public int DSSimpleEncFileV2(...) : Simple file encryption function using MAC method
- Control Method: MAC
- Package name: SCSL
- Class Name: SLDsFile
- Description: Performs file encryption using the MAC method.
- Encrypt with ".dsd" even for unsupported extensions and return 0.
- a.log encryption => a.log.dsd
Parameter
| Type | Variable Name | Description | Note |
|---|---|---|---|
| [IN] String | keyFilePath | Key file name (including path) | |
| [IN] String | categoryID | Category ID for Permission Classification | |
| [IN] String | categoryName | Defined category name | Enter 'Server' if the category name is not specified. |
| [IN] String | systemName | Integration System Name | The name of the integration system is included in the creator information. |
| [IN] String | srcFilePath | Original file name (including path) | Original Document |
| [IN] String | dstFilePath | Encrypted file name (including path) | Encryption Document |
| [IN] int | option | Re-encryption option if the original file is an encrypted file | 0: No encryption 1: Decrypt and re-encrypt |
Return Value
- 0: Success
- Other values: Refer to error codeshttps://wiki.softcamp.co.kr/x/ow1YB
Note
- The system name received as a parameter is used as the creator information in the Document Security Information View tab of the encrypted file.
Example
DSSimpleEncFileDACV2 함수에 있음.
▶ public int DSSimpleEncFileDACV2(...) : Simple file encryption function using DAC method
- Control Method: DAC
- Package name: SCSL
- Class Name: SLDsFile
- Description: Performs file encryption using the DAC method.
- Encrypt with ".dsd" even for unsupported extensions and return 0.
- a.log encryption => a.log.dsd
Parameter
| Type | Variable Name | Description | Note |
|---|---|---|---|
| [IN] String | keyFilePath | Key file name (including path) | |
| [IN] String | systemName | Integration System Name | The name of the integration system is included in the creator information. |
| [IN] String | srcFilePath | Original file name (including path) | |
| [IN] String | dstFilePath | Encrypted file name (including path) | |
| [IN] int | option | Re-encryption option if the original file is an encrypted file | 0: No encryption 1: Decrypt and re-encrypt |
Return Value
- 0: Success
- Other values: Refer to error codeshttps://wiki.softcamp.co.kr/x/ow1YB
Note
- The system name received as a parameter is used as the creator information in the Document Security Information View tab of the encrypted file.
- For unsupported file extensions, permissions for reading, extracting, exporting, and changing permissions are granted.
- Branch by checking if it is a supported extension using the DSIsSupportFile API.
Example
import SCSL.*;
public final class MainTest
{
public static void main(String[] args)
{
SLDsFile sFile = new SLDsFile();
// 키 파일 입력 할 경우
String keyDACPath = "S:\\TFS_Project2\\Linker\\ServiceLinker\\src\\JavaServiceLinker\\keyfiles\\test44\\KeyDAC_44.sc";
SLDsEncDecHeader DsEncDecHeader = new SLDsEncDecHeader(keyDACPath);
// 키 직접 입력 할 경우
SLDsEncDecHeader SLDSHeader = new SLDsEncDecHeader("DS Server Header Key", "Custom Header Key");
int ret = 0;
// 암호화 방식 체크
ret = DsEncDecHeader.DSEncMethod( "c:/test/b(MAC보안).txt" );
System.out.println( "ret : " + ret );
// 확장자 체크
ret = sFile.DSIsSupportFile( "c:/test/a.log" );
System.out.println( "지원되는 확장자 여부 a.log : " + ret );
ret = sFile.DSIsSupportFile( "c:/test/.txt" );
System.out.println( "지원되는 확장자 여부 a.txt : " + ret );
// 간단 암호화 테스트 MAC 버전2
int nSimple = sFile.DSSimpleEncFileV2("c:/keyFile/key.sc",
"0000010",
"1등급",
"EDMS",
"c:/test/a.log",
"c:/test/a(MAC암호).log",
1
);
System.out.println( "nSimple : " + nSimple );
// 간단 암호화 테스트 DAC
String srcPath = new String( "c:/test/a.log" );
sFile.SLDsInitDAC();
if( sFile.DSIsSupportFile( srcPath ) == 0 )
{
// 지원하지 않는 확장자일 경우 읽기, 해제, 반출, 권한 변경 권한을 준다.
sFile.SLDsAddUserDAC( "hcjeong", "010110001", 0, 0, 0 );
}
else
{
sFile.SLDsAddUserDAC( "hcjeong", "010000000", 0, 0, 0 );
}
int nSimpleDAC = sFile.DSSimpleEncFileDACV2( "c:/keyFile/keyDAC.sc",
"EDMS",
"c:/test/a.log",
"c:/test/a(simDAC암호).log",
1
);
System.out.println( "암호화 결과 값(0이면 성공) : " + nSimpleDAC );
}
}
▶ public int GetFileInfoOfHeader(...) : Function to obtain file information of an encrypted file header
- Control Method: ALL
- Package name: SCSL
- Class Name: SLDsEncDecHeader
- Description: A function to retrieve file information from an encrypted file header.
Parameter
| Type | Variable Name | Description | Note |
|---|---|---|---|
| [IN] String | keyFilePath | Key file name (including path) | |
| [OUT]byte[] | sfiInfo | Byte array containing file information | You need to allocate a byte array space for the size that will hold the file information. The size of the file header information is 396. |
Return Value
- 0: Success
- Other values: Refer to the error codes in the Service Linker specification.https://wiki.softcamp.co.kr/x/ow1YB
Note
- ※ If you are using a document header encryption key, it cannot be used, and you must use the SLDsEncFile Class.
- The file header structure (sfiInfo) is composed sequentially from the front byte of the array as follows.
-
Data Size Description Note 16 Creation Time 260 Generation Path 20 Author ID 50 Author Name 50 Author Group - When declaring, you must set the Key file path in properties or provide the Key file path, DS HeaderKey, and Custom Key.
- SLDsEncDecHeader()
=> properties requires setting DSKEYENCRYPT_KEYFILE (Improvement of the vulnerability of hardcoded encryption key exposure in Document Security) - SLDsEncDecHeader(String KeyFilePath)
- SLDsEncDecHeader(String DSHeaderKey, String CustomHeaderKey)
- SLDsEncDecHeader()
Example
import SCSL.*;
public final class MainTest
{
public static void main(String[] args)
{
// 키 파일 입력 할 경우
String keyDACPath = "S:\\TFS_Project2\\Linker\\ServiceLinker\\src\\JavaServiceLinker\\keyfiles\\test44\\KeyDAC_44.sc";
SLDsEncDecHeader DsEncDecHeader = new SLDsEncDecHeader(keyDACPath);
// 키 직접 입력 할 경우
SLDsEncDecHeader SLDSHeader = new SLDsEncDecHeader("DS Server Header Key", "Custom Header Key");
byte[] sfiInfo = new byte[396];
// 파일 정보( SFI ) 를 가져온다.
int ret = DsEncDecHeader.GetFileInfoOfHeader( "c:/test/a(dac).doc", sfiInfo );
System.out.println( "ret : " + ret);
String strCreateTime = new String(sfiInfo, 0, 16 );
String strCreatePath = new String(sfiInfo, 16, 260 );
String strWriterID = new String(sfiInfo, 16 + 260, 20 );
String strWriterName = new String(sfiInfo, 16 + 260 + 20, 50 );
String strWriterGroup = new String(sfiInfo, 16 + 260 + 20 + 50, 50 );
System.out.println( "strCreateTime : " + strCreateTime );
System.out.println( "strCreatePath : " + strCreatePath );
System.out.println( "strWriterID : " + strWriterID );
System.out.println( "strWriterName : " + strWriterName );
System.out.println( "strWriterGroup : " + strWriterGroup );
}
}
▶ public int GetFileInfoOfHeaderV2(...) : Function to retrieve file information of an encrypted file header.
- Control Method: ALL
- Package name: SCSL
- Class Name: SLDsEncDecHeader
- Description: A function to retrieve file information from an encrypted file header.
Parameter
| Type | Variable Name | Description | Note |
|---|---|---|---|
| [IN] String | keyFilePath | Key file name (including path) | |
| [OUT]byte[] | sfiInfo | Byte array containing file information | You need to allocate a byte array space for the size that will hold the file information. The size of the file header information is 2791. |
Return Value
- 0: Success
- Other values: Refer to the error codes in the Service Linker specification.https://wiki.softcamp.co.kr/x/ow1YB
Note
-
※ If you are using a document header encryption key, it cannot be used, and you must use the SLDsEncFile Class.
-
The file header structure (sfiInfo) is composed sequentially from the front byte of the array as follows.
-
Data Size Description Note 16 Creation Time 260 Generation Path 20 Author ID 50 Author Name 50 Author Group 20 Creation Location CREATEPLACE 1024 Group Hierarchy List of group IDs from your group ID to the top-level department 1 Encryption Type 20 Server ID The actual size of the server ID is 28 bytes, and for server IDs exceeding 20 bytes, there is an issue where the latter part is truncated. 50 Server Name 128 Document Types 128 Document Grade 1024 Other Information SFI_EXTRA_INFO
In ServiceLinker, custom fields -
When declaring, you must set the Key file path in properties or provide the Key file path, DS HeaderKey, and Custom Key.
- SLDsEncDecHeader()
=> It is necessary to set DSKEYENCRYPT_KEYFILE in properties (Improvement of the vulnerability of hardcoded encryption key exposure in Document Security) - SLDsEncDecHeader(String KeyFilePath)
- SLDsEncDecHeader(String DSHeaderKey, String CustomHeaderKey)
- SLDsEncDecHeader()
Example
import SCSL.*;
public final class MainTest
{
public static void main(String[] args)
{
// 키 파일 입력 할 경우
String keyDACPath = "S:\\TFS_Project2\\Linker\\ServiceLinker\\src\\JavaServiceLinker\\keyfiles\\test44\\KeyDAC_44.sc";
SLDsEncDecHeader DsEncDecHeader = new SLDsEncDecHeader(keyDACPath);
// 키 직접 입력 할 경우
SLDsEncDecHeader SLDSHeader = new SLDsEncDecHeader("DS Server Header Key", "Custom Header Key");
byte[] arData = new byte[2791];
// 파일 정보( SFI ) 를 가져온다.
int ret = DsEncDecHeader.GetFileInfoOfHeader( "c:/test/a(dac).doc", arData );
System.out.println( "ret : " + ret );
String strCreateTime = new String( arData, 0, 16 );
String strCreatePath = new String( arData, 16, 260 );
String strWriterID = new String( arData, 16 + 260, 20 );
String strWriterName = new String( arData, 16 + 260 + 20, 50 );
String strWriterGroupName = new String( arData, 16 + 260 + 20 + 50, 50 );
String strCreatePlace = new String( arData, 16 + 260 + 20 + 50 + 50, 20 );
String strGroupHierarchy = new String( arData, 16 + 260 + 20 + 50 + 50 + 20, 1024 );
String strEncType = new String( arData, 16 + 260 + 20 + 50 + 50 + 20 + 1024, 1 );
String strServerID = new String( arData, 16 + 260 + 20 + 50 + 50 + 20 + 1024 + 1, 20 );
String strServerName = new String( arData, 16 + 260 + 20 + 50 + 50 + 20 + 1024 + 1 + 20, 50 );
String strDocuKind = new String( arData, 16 + 260 + 20 + 50 + 50 + 20 + 1024 + 1 + 20 + 50, 128 );
String strGradeInfo = new String( arData, 16 + 260 + 20 + 50 + 50 + 20 + 1024 + 1 + 20 + 50 + 128, 128 );
String strExtraInfo = new String( arData, 16 + 260 + 20 + 50 + 50 + 20 + 1024 + 1 + 20 + 50 + 128 + 128, 1024 );
System.out.println( "strCreateTime : " + strCreateTime );
System.out.println( "strCreatePath : " + strCreatePath );
System.out.println( "strWriterID : " + strWriterID );
System.out.println( "strWriterName : " + strWriterName );
System.out.println( "strWriterGroupName : " + strWriterGroupName );
System.out.println( "strCreatePlace : " + strCreatePlace );
System.out.println( "strGroupHierarchy : " + strGroupHierarchy );
System.out.println( "strEncType : " + strEncType );
System.out.println( "strServerID : " + strServerID );
System.out.println( "strServerName : " + strServerName );
System.out.println( "strDocuKind : " + strDocuKind );
System.out.println( "strGradeInfo : " + strGradeInfo );
System.out.println( "strExtraInfo : " + strExtraInfo );
}
}
▶ public int GetMacOfHeader(...) : Function to retrieve the MAC information of the encrypted file header.
- Control Method: ALL
- Package name: SCSL
- Class Name: SLDsEncDecHeader
- Description: A function to retrieve the MAC information of an encrypted file header.
Parameter
| Type | Variable Name | Description | Note |
|---|---|---|---|
| [IN] String | keyFilePath | Key file name (including path) | |
| [OUT]byte[] | macInfo | Byte array containing MAC information | You need to allocate a byte array space equal to the size that contains the MAC information. The size of the file header information is 50. |
Return Value
- 0: Success
- Other values: Refer to the error codes in the Service Linker specification.https://wiki.softcamp.co.kr/x/ow1YB
Note
-
※ If you are using a document header encryption key, it cannot be used, and you must use the SLDsEncFile Class.
-
The file header structure (macInfo) is composed sequentially from the front byte of the array as follows.
-
Data Size Description Note 50 Category Name -
Use DSEncMethod() to check if it is an encrypted file in MAC format before using it.
-
When declaring, you must set the Key file path in properties or provide the Key file path, DS HeaderKey, and Custom Key.
- SLDsEncDecHeader()
=> It is necessary to set DSKEYENCRYPT_KEYFILE in properties (Improvement of the vulnerability of hardcoded encryption key exposure in Document Security) - SLDsEncDecHeader(String KeyFilePath)
- SLDsEncDecHeader(String DSHeaderKey, String CustomHeaderKey)
- SLDsEncDecHeader()
Example
import SCSL.*;
public final class MainTest
{
public static void main(String[] args)
{
// 키 파일 입력 할 경우
String keyDACPath = "S:\\TFS_Project2\\Linker\\ServiceLinker\\src\\JavaServiceLinker\\keyfiles\\test44\\KeyDAC_44.sc";
SLDsEncDecHeader DsEncDecHeader = new SLDsEncDecHeader(keyDACPath);
// 키 직접 입력 할 경우
SLDsEncDecHeader SLDSHeader = new SLDsEncDecHeader("DS Server Header Key", "Custom Header Key");
byte[] macInfo = new byte[50];
// 먼저 DSEncMethod()를 통해 MAC 으로 암호화 되어 있는지 체크한다.
int macEncrypted = DsEncDecHeader.DSEncMethod("c:/test/a(mac).doc" );
System.out.println( "macEncrypted :" + macEncrypted );
// 파일이 MAC 암호화가 아닐 경우 다른 예외처리를 해 준다.
if( macEncrypted != 0 )
{
System.out.println( "기타 다른 예외처리 처리..." );
return;
}
int ret = DsEncDecHeader.GetMacOfHeader( filePath, macInfo );
System.out.println( " ret: " + ret );
String categoryName = new String( macInfo, 0, 50 );
System.out.println( "CategoryName : " + categoryName );
}
}
▶ public int GetMacOfHeaderV2(...) : Function to obtain the MAC information of the encrypted file header.
- Control Method: ALL
- Package name: SCSL
- Class Name: SLDsEncDecHeader
- Description: A function to retrieve the MAC information of an encrypted file header.
Parameter
| Type | Variable Name | Description | Note |
|---|---|---|---|
| [IN] String | keyFilePath | Key file name (including path) | |
| [OUT]byte[] | macInfo | Byte array containing MAC information | You need to allocate a byte array space equal to the size that contains the MAC information. The size of the file header information is 70. |
Return Value
- 0: Success
- Other values: Refer to the error codes in the Service Linker specification.https://wiki.softcamp.co.kr/x/ow1YB
Note
-
※ If you are using a document header encryption key, it cannot be used, and you must use the SLDsEncFile Class.
-
The file header structure (macInfo) is composed sequentially from the front byte of the array as follows.
-
Data Size Description Note 20 category id 50 Category Name -
Use DSEncMethod() to check if it is an encrypted file in MAC format before using it.
-
When declaring, you must set the Key file path in properties or provide the Key file path, DS HeaderKey, and Custom Key.
- SLDsEncDecHeader()
=> It is necessary to set DSKEYENCRYPT_KEYFILE in properties (Improvement of the vulnerability of hardcoded encryption key exposure in Document Security) - SLDsEncDecHeader(String KeyFilePath)
- SLDsEncDecHeader(String DSHeaderKey, String CustomHeaderKey)
- SLDsEncDecHeader()
Example
import SCSL.*;
public final class MainTest
{
public static void main(String[] args)
{
// 키 파일 입력 할 경우
String keyDACPath = "S:\\TFS_Project2\\Linker\\ServiceLinker\\src\\JavaServiceLinker\\keyfiles\\test44\\KeyDAC_44.sc";
SLDsEncDecHeader DsEncDecHeader = new SLDsEncDecHeader(keyDACPath);
// 키 직접 입력 할 경우
SLDsEncDecHeader SLDSHeader = new SLDsEncDecHeader("DS Server Header Key", "Custom Header Key");
byte[] macInfo = new byte[70];
// 먼저 DSEncMethod()를 통해 MAC 으로 암호화 되어 있는지 체크한다.
int macEncrypted = DsEncDecHeader.DSEncMethod("c:/test/a(mac).doc" );
System.out.println( "macEncrypted :" + macEncrypted );
// 파일이 MAC 암호화가 아닐 경우 다른 예외처리를 해 준다.
if( macEncrypted != 0 )
{
System.out.println( "기타 다른 예외처리 처리..." );
return;
}
int ret = DsEncDecHeader.GetMacOfHeader( filePath, macInfo );
System.out.println( " ret: " + ret );
String categoryID = new String( macInfo, 0, 20 );
String categoryName = new String( macInfo, 20, 50 );
System.out.println( "CategoryID : " + categoryID );
System.out.println( "CategoryName : " + categoryName );
}
}
▶ public int GetDacCountOfHeader(...) : A function that tells the number of DACs in the encrypted file header.
- Control Method: ALL
- Package name: SCSL
- Class Name: SLDsEncDecHeader
- Description: A function that tells the number of DACs in the encrypted file header.
Parameter
| Type | Variable Name | Description | Note |
|---|---|---|---|
| [IN] String | filePath | Key file name (including path) |
Return Value
- Return the number of DACs
- Value less than 0: Refer to the error codes in the Service Linker specificationhttps://wiki.softcamp.co.kr/x/ow1YB
Note
- ※ If you are using a document header encryption key, it cannot be used, and you must use the SLDsEncFile Class.
- It is a function used in the GetDacOfHeader function.
- Use DSEncMethod() to check if it is an encrypted file in MAC format before using it.
- When declaring, you must set the Key file path in properties or provide the Key file path, DS HeaderKey, and Custom Key.
- SLDsEncDecHeader()
=> It is necessary to set DSKEYENCRYPT_KEYFILE in properties (Improvement of the vulnerability of hardcoded encryption key exposure in Document Security) - SLDsEncDecHeader(String KeyFilePath)
- SLDsEncDecHeader(String DSHeaderKey, String CustomHeaderKey)
- SLDsEncDecHeader()
Example
GetDacOfHeader 참조
▶ public int GetDacOfHeaderV2(...) : Function to retrieve DAC information of an encrypted file header.
- Control Method: ALL
- Package name: SCSL
- Class Name: SLDsEncDecHeader
- Description: A function to retrieve DAC information from an encrypted file header.
Parameter
| Type | Variable Name | Description | Note |
|---|---|---|---|
| [IN] String | filePath | Key file name (including path) | |
| [OUT]byte[] | dacInfo | Byte array containing DAC information | You need to allocate a byte array space equal to the size that will hold the DAC information. The size of one DAC information is 4200. For example, if there are 3 DAC information, you need to allocate space of size 4200 * 3. |
|
Return Value
- 0: Success
- Other values: Refer to the error codes in the Service Linker specification.https://wiki.softcamp.co.kr/x/ow1YB
Note
-
※ If you are using a document header encryption key, it cannot be used, and you must use the SLDsEncFile Class.
-
Use DSEncMethod() to check if it is an encrypted file in DAC format before using it.
-
It is configured as follows for the number of DACs.
-
The number of DACs can be found through GetDacCountOfHeader().
-
Data Size Description Note 1 Type 20 id 50 Name 1 Read Permission 1 byte character 4 Number of Readable Times 1 Edit Permissions 1 byte character 1 Release Permission 1 byte character 1 Export Permission 1 byte character 1 Print Permission 1 byte character 4 Print count 1 Print Marking 1 byte character 16 Expiration Date 1 Automatic Destruction 1 byte character 1 Permission Change 1 byte character 1024 List of Classification IDs Accessible for Grade Documents 1024 List of Group IDs with Access to Grade Documents 1024 List of User IDs with Access to Grade Documents 1024 Restricted Document Access Exclusion User ID List 1 Subgroup Access Denied 1 byte character
If it is '1', only that group can access.
Subgroup is inaccessible. -
When declaring, you must set the Key file path in properties or provide the Key file path, DS HeaderKey, and Custom Key.
- SLDsEncDecHeader()
=> It is necessary to set DSKEYENCRYPT_KEYFILE in properties (Improvement of the vulnerability of hardcoded encryption key exposure in Document Security) - SLDsEncDecHeader(String KeyFilePath)
- SLDsEncDecHeader(String DSHeaderKey, String CustomHeaderKey)
- SLDsEncDecHeader()
Example
import SCSL.*;
public final class MainTest
{
public static void main(String[] args)
{
// 키 파일 입력 할 경우
String keyDACPath = "S:\\TFS_Project2\\Linker\\ServiceLinker\\src\\JavaServiceLinker\\keyfiles\\test44\\KeyDAC_44.sc";
SLDsEncDecHeader DsEncDecHeader = new SLDsEncDecHeader(keyDACPath);
// 키 직접 입력 할 경우
SLDsEncDecHeader SLDSHeader = new SLDsEncDecHeader("DS Server Header Key", "Custom Header Key");
int dacEncrypted = DsEncDecHeader.DSEncMethod("c:/test/a(DAC Enc).txt" );
System.out.println( " dacEncrypted :" + dacEncrypted );
// 파일이 DAC 암호화가 아닐 경우 다른 예외처리를 해 준다.
if(dacEncrypted != 1 )
{
System.out.println( "기타 다른 예외처리 처리..." );
return;
}
int dacCount = DsEncDecHeader.GetDacCountOfHeader("c:/test/a(DAC Enc).txt" );
System.out.println( " dacCount : " + dacCount );
// 크기는 dacCount * 4200으로 해주어야 한다.
byte[] dacInfo = new byte[4200 * nCountOfDac];
dacEncrypted = DsEncDecHeader.GetDacOfHeader("c:/test/a(DAC Enc).txt", dacInfo );
System.out.println( " dacEncrypted : " + dacEncrypted );
for( int k = 0; k < dacCount; k++ )
{
String printInfo = new String( dacInfo, k * 4200, 4200 );
System.out.println( printInfo );
}
}
}
▶ public int GetRuiCountOfHeader(...) : A function that tells the number of RUI in the encrypted file header.
- Control Method: ALL
- Package name: SCSL
- Class Name: SLDsEncDecHeader
- Description: A function that tells the number of RUI in the encrypted file header.
Parameter
| Type | Variable Name | Description | Note |
|---|---|---|---|
| [IN] String | filePath | Key file name (including path) |
Return Value
- Return the number of RUI
- Value less than 0: Refer to the error codes in the Service Linker specificationhttps://wiki.softcamp.co.kr/x/ow1YB
Note
- ※ If you are using a document header encryption key, it cannot be used, and you must use the SLDsEncFile Class.
- It is a function used in the GetRuiOfHeader function.
- Use DSEncMethod() to check if it is an encrypted file in MAC format before using it.
- When declaring, you must set the Key file path in properties or provide the Key file path, DS HeaderKey, and Custom Key.
- SLDsEncDecHeader()
=> It is necessary to set DSKEYENCRYPT_KEYFILE in properties (Improvement of the vulnerability of hardcoded encryption key exposure in Document Security) - SLDsEncDecHeader(String KeyFilePath)
- SLDsEncDecHeader(String DSHeaderKey, String CustomHeaderKey)
- SLDsEncDecHeader()
Example
GetRuiOfHeader 참조
▶ public int GetRuiOfHeader(...) : Function to obtain the RUI information of an encrypted file header
- Control Method: ALL
- Package name: SCSL
- Class Name: SLDsEncDecHeader
- Description: A function to retrieve the RUI information from the encrypted file header.
Parameter
| Type | Variable Name | Description | Note |
|---|---|---|---|
| [IN] String | filePath | Key file name (including path) | |
| [OUT]byte[] | ruiInfo | Byte array containing RUI information | You need to allocate a byte array space equal to the size to hold RUI information. The size of a single RUI information is 145. For example, if there are 3 RUI information, space should be allocated for a size of 145 * 3. |
|
Return Value
- 0: Success
- Other values: Refer to the error codes in the Service Linker specification.https://wiki.softcamp.co.kr/x/ow1YB
Note
- ※ If you are using a document header encryption key, it cannot be used, and you must use the SLDsEncFile Class.
- Use DSEncMethod() to check if it is an encrypted file in DAC format before using it.
- It is composed as follows, according to the number of RUI.
- The number of RUI can be found through GetRuiCountOfHeader().
-
Data Size Description Note 20 id 50 Name 50 Group Name 1 Viewing Status 1 byte character 4 Number of Reads 4 Print count 16 Recent Viewing Time - When declaring, you must set the Key file path in properties or provide the Key file path, DS HeaderKey, and Custom Key.
- SLDsEncDecHeader()
=> It is necessary to set DSKEYENCRYPT_KEYFILE in properties (Improvement of the vulnerability of hardcoded encryption key exposure in Document Security) - SLDsEncDecHeader(String KeyFilePath)
- SLDsEncDecHeader(String DSHeaderKey, String CustomHeaderKey)
- SLDsEncDecHeader()
Example
import SCSL.*;
public final class MainTest
{
public static void main(String[] args)
{
// 키 파일 입력 할 경우
String keyDACPath = "S:\\TFS_Project2\\Linker\\ServiceLinker\\src\\JavaServiceLinker\\keyfiles\\test44\\KeyDAC_44.sc";
SLDsEncDecHeader DsEncDecHeader = new SLDsEncDecHeader(keyDACPath);
// 키 직접 입력 할 경우
SLDsEncDecHeader SLDSHeader = new SLDsEncDecHeader("DS Server Header Key", "Custom Header Key");
int ruiCount = DsEncDecHeader.GetRuiCountOfHeader("c:/test/a(DAC Enc).txt" );
System.out.println( " ruiCount : " + ruiCount );
if(ruiCount <= 0 )
{
System.out.println( "예외 처리" );
}
// 크기는 카운트 * 145로 해준다.
byte[] ruiInfo = new byte[145 * ruiCount];
int ret = DsEncDecHeader.GetRuiOfHeader("c:/test/a(DAC Enc).txt", ruiInfo);
System.out.println( " ret : " + ret );
// RUI의 갯수 만큼 루프를 돈다.
for( int n4 = 0; n4 < ruiCount; n4++ )
{
String printInfo = new String(ruiInfo, n4 * 145, 145 );
System.out.println( printInfo );
}
}
}
▶ public void SLDsEnvSet(...) : A function that sets whether to check the extension.
- Control Method: ALL
- Package name: SCSL
- Class Name: SLDsFile
- Description: Sets whether to check the file extension.
Parameter
| Type | Variable Name | Description | Note |
|---|---|---|---|
| [IN] int | checkExt | Value to check | If it is 0, do not check; any other value means check. |
Return Value
- None
Note
- Call this function to determine whether to check for extension differences before using the encryption API.
- If not called, the encryption API checks the extension by default.
Example
import SCSL.*;
public final class MainTest
{
public static void main(String[] args)
{
SLDsFile sFile = new SLDsFile();
sFile.SLDsEnvSet( 0 ); // 0이면 확장자를 체크하지 않음.
int ret = sFile.DSAPIEncFileV2( "c:/keyFile/key.sc",
"0000010",
"기밀문서",
"KM3",
"c:/test/테스트.log",
"c:/test/테스트(암호).log",
1
);
System.out.println( " ret : " + ret );
// 암호화 API의 파라미터가 유효할 경우, 확장자를 체크하면 -71 이, 체크하지 않으면 0 리턴 됨.
}
}
▶ public int DSGetDocuGradeDocument(...) : Function that returns the grade document ID.
- Control Method: ALL
- Package name: SCSL
- Class Name: SLDsEncDecHeader
- Description: A function that provides the grade document ID.
Parameter
| Type | Variable Name | Description | Note |
|---|---|---|---|
| [IN] String | filePath | File path (including file name) | |
| [OUT]byte[] | gradeID | Array to receive grade ID | Allocate 20 bytes in advance. |
Return Value
- 0 : Not a grade document
- 1 : Rating Document
- -36 : Not an encrypted file
- -1 : Error
Note
- ※ If you are using a document header encryption key, it cannot be used, and you must use the SLDsEncFile Class.
- When declaring, you must set the Key file path in properties or provide the Key file path, DS HeaderKey, and Custom Key.
- SLDsEncDecHeader()
=> It is necessary to set DSKEYENCRYPT_KEYFILE in properties (Improvement of the vulnerability of hardcoded encryption key exposure in Document Security) - SLDsEncDecHeader(String KeyFilePath)
- SLDsEncDecHeader(String DSHeaderKey, String CustomHeaderKey)
Example
import SCSL.*;
public final class MainTest
{
public static void main(String[] args)
{
// 키 파일 입력 할 경우
String keyDACPath = "S:\\TFS_Project2\\Linker\\ServiceLinker\\src\\JavaServiceLinker\\keyfiles\\test44\\KeyDAC_44.sc";
SLDsEncDecHeader DsEncDecHeader = new SLDsEncDecHeader(keyDACPath);
// 키 직접 입력 할 경우
SLDsEncDecHeader SLDSHeader = new SLDsEncDecHeader("DS Server Header Key", "Custom Header Key");
byte[] gradeID = new byte[22];
int ret = DsEncDecHeader. DSGetDocuGradeDocument ( "c:/test/a(등급 암호).doc", gradeID );
String strGradeID = new String(gradeID, 2, 20 );
System.out.println( "ret : " + ret );
System.out.println( "strGradeID : " + strGradeID );
}
}
▶ public int DSSLDocuGradeEnc(...) : Grade Document Encryption API
- Control Method: DAC
- Package name: SCSL
- Class Name: SLDsFile
- Description: Grade Document Encryption API
Parameter
| Type | Variable Name | Description | Note |
|---|---|---|---|
| [IN] String | docuKeyFilePath | Key file name (including path) | You must enter the path and filename of the graded encryption key file. |
| [IN] String | systemName | System Name | |
| [IN] String | docuKind | Document Types | If not in use, enter "none". |
| [IN] String | docuGradeID | Rating Document ID | required |
| [IN] String | loginID | Logged-in ID | |
| [IN] String | groupPath | Group path of the corresponding ID | It refers to the group hierarchy, which can be obtained through the APIs of other modules besides the service linker. |
| [IN] String | extraInfo | Custom Field | If not in use, enter "none". |
| [IN] String | srcFilePath | Original file name (including path) | |
| [IN] String | dstFilePath | Encrypted file name (including path) | |
| [IN] int | simple | Use of Simple Encryption | 0 : Do not use simple encryption feature 1 : Use Simple Encryption Feature |
| [IN] int | option | Re-encryption option if the original file is an encrypted file | 0: No encryption 1: Decrypt and re-encrypt |
|
Return Value
- 0: Success
- Other values: Refer to error values
Note
- Used with SettingPathForProperty(), used like a property file
Example
import SCSL.*;
public final class MainTest
{
public static void main(String[] args)
{
SLDsFile sFile = new SLDsFile();
sFile.SettingPathForProperty( "D:\\propertisData\\softcamp.properties" );
int ret = sFile.DSSLDocuGradeEnc( "c:/keyFile/GradeInfo.sc",
"GW System",
"none",
"0000002",
"hcjeong",
"SCDS_0000000009;SCDS_0000000001;SECURITYDOMAIN;",
"aaa",
"c:/test/a.doc",
"c:/test/a(복사 되는 등급 암호).doc",
0,
1
);
System.out.println( "Return value : " + ret );
}
}
▶ public int DSSLDocuGradeEncAddCreator(...) : Grade Document Encryption API
- Control Method: DAC
- Package name: SCSL
- Class Name: SLDsFile
- Description: Grade Document Encryption API
Parameter
| Type | Variable Name | Description | Note |
|---|---|---|---|
| [IN] String | docuKeyFilePath | Key file name (including path) | You must enter the path and filename of the graded encryption key file. |
| [IN] String | systemName | System Name | |
| [IN] String | docuKind | Document Types | If not in use, enter "none". |
| [IN] String | docuGradeID | Rating Document ID | required |
| [IN] String | loginID | Logged-in ID | |
| [IN] String | groupPath | Group path of the corresponding ID | It refers to the group hierarchy, which can be obtained through the APIs of other modules besides the service linker. |
| [IN] String | extraInfo | Custom Field | If not in use, enter "none". |
| [IN] String | srcFilePath | Original file name (including path) | |
| [IN] String | dstFilePath | Encrypted file name (including path) | |
| [IN] String | creatorID | Constructor ID | |
| [IN] String | creatorGroupPath | Constructor Group Path | It refers to the group hierarchy, which can be obtained through the APIs of other modules besides the service linker. |
| [IN] String | keyFileDACName | Key file name (including path) | DAC key file name with the creator key |
| [IN] int | simple | Use of Simple Encryption | 0 : Do not use simple encryption feature 1 : Use Simple Encryption Feature |
| [IN] int | option | Re-encryption option if the original file is an encrypted file | 0: No encryption 1: Decrypt and re-encrypt |
|
Return Value
- 0: Success
- Other values: Refer to error values
Note
- Used with SettingPathForProperty(), used like a property file
Example
import SCSL.*;
public final class MainTest
{
public static void main(String[] args)
{
SLDsFile slFile = new SLDsFile();
slFile.SettingPathForProperty( "D:\\propertisData\\softcamp.properties" );
/* 초기화 함수 */
slFile.SLDsInitGrade();
slFile.SLDsAddUserGrade("SECURITYDOMAIN", "111001101", 0, 0, 0); //사용자 권한 및 유효기간 설정
int ret = slFile. DSSLDocuGradeEncAddCreator ( "c:/keyFile/GradeInfo.sc",
"GW System",
"none",
"0000002",
"hcjeong",
"SCDS_0000000009;SCDS_0000000001;SECURITYDOMAIN;",
"aaa",
"c:/test/a.doc",
"c:/test/a(복사 되는 등급 암호).doc",
"oriskunk",
"SCDS_0000000009;SCDS_0000000001;SECURITYDOMAIN;",
"c:/keyFile/keyDAC.sc",
0,
1
);
System.out.println( "Return value : " + ret );
}
}
▶ public String getInfo(...) : Function to obtain encrypted file header information
- Control Method: ALL
- Package name: SCSL
- Class Name: SLDsEncFile
- Description: Function to obtain encrypted file header information
Parameter
| Type | Variable Name | Description | Note |
|---|---|---|---|
| [IN] String | type | Header Type Identifier | Example Code Reference |
Return Value
- Empty string: When there is no data
- Header information string: When there is data
Note
- ※ After using the object, be sure to call the clear() function. (If not called, Resource issues may occur.)
Example
import SCSL.*;
public final class MainTest
{
public static void main(String[] args)
{
SLDsEncFile sEncFile = new SLDsEncFile("암호화파일", "키파일"); // 암호화 헤더 키를 사용하지 않는 경우 키 파일은 생략 가능
String createTime = sEncFile.getInfo("CREATE_TIME");
String createPath = sEncFile.getInfo("CREATE_PATH");
String writerID = sEncFile.getInfo("WRITER_ID");
String writerName = sEncFile.getInfo("WRITER_NAME");
String writerGroupName = sEncFile.getInfo("WRITER_GROUP_NAME");
String createPlace = sEncFile.getInfo("CREATE_PLACE");
String writerGroupHierarchy = sEncFile.getInfo("WRITER_GROUP_HIERARCHY");
String encType = sEncFile.getInfo("ENC_TYPE");
String serverID = sEncFile.getInfo("SERVER_ID");
String serverName = sEncFile.getInfo("SERVER_NAME");
String documentType = sEncFile.getInfo("DOCUMENT_TYPE");
String documentGrade = sEncFile.getInfo("DOCUMENT_GRADE");
String extraInfo = sEncFile.getInfo("EXTRA_INFO");
sEncFile.clear();
}
}
▶ public String getInfoMAC(...) : Function to obtain the MAC information of the encrypted file header.
- Control Method: ALL
- Package name: SCSL
- Class Name: SLDsEncFile
- Description: Function to obtain MAC information from the encrypted file header.
Parameter
| Type | Variable Name | Description | Note |
|---|---|---|---|
| [IN] int | index | MAC Index | 0 ~ getInfoMACCount() - 1 |
| [IN] String | type | Header Type Identifier | Example Code Reference |
Return Value
- Empty string: When there is no data
- Header information string: When there is data
Note
- ※ After using the object, be sure to call the clear() function. (If not called, Resource issues may occur.)
Example
import SCSL.*;
public final class MainTest
{
public static void main(String[] args)
{
SLDsEncFile sEncFile = new SLDsEncFile("암호화파일", "키파일"); // 암호화 헤더 키를 사용하지 않는 경우 키 파일은 생략 가능
String category = sEncFile.getInfo("MAC_CATEGORY");
String categoryName = sEncFile.getInfo("MAC_CATEGORY_NAME");
sEncFile.clear();
}
}
▶ public String getInfoDAC(...) : Function to obtain DAC information from the encrypted file header.
- Control Method: ALL
- Package name: SCSL
- Class Name: SLDsEncFile
- Description: Function to obtain DAC information from the encrypted file header.
Parameter
| Type | Variable Name | Description | Note |
|---|---|---|---|
| [IN] int | index | DAC Index | 0 ~ getInfoDACCount() - 1 |
| [IN] String | type | Header Type Identifier | Example Code Reference |
Return Value
- Empty string: When there is no data
- Header information string: When there is data
Note
- ※ After using the object, be sure to call the clear() function. (If not called, Resource issues may occur.)
Example
import SCSL.*;
public final class MainTest
{
public static void main(String[] args)
{
SLDsEncFile sEncFile = new SLDsEncFile("암호화파일", "키파일"); // 암호화 헤더 키를 사용하지 않는 경우 키 파일은 생략 가능
String type = sEncFile.getInfoDAC(0, "DAC_TYPE");
String typeID = sEncFile.getInfoDAC(0, "DAC_TYPE_ID");
String typeName = sEncFile.getInfoDAC(0, "DAC_TYPE_NAME");
String read = sEncFile.getInfoDAC(0, "DAC_READ");
String readNumLimit = sEncFile.getInfoDAC(0, "DAC_READ_NUM_LIMIT");
String edit = sEncFile.getInfoDAC(0, "DAC_EDIT");
String decrypt = sEncFile.getInfoDAC(0, "DAC_DECRYPT");
String som = sEncFile.getInfoDAC(0, "DAC_SOM");
String print = sEncFile.getInfoDAC(0, "DAC_PRINT");
String printNumLimit = sEncFile.getInfoDAC(0, "DAC_PRINT_NUM_LIMIT");
String printMarking = sEncFile.getInfoDAC(0, "DAC_PRINT_MARKING");
String expireDate = sEncFile.getInfoDAC(0, "DAC_EXPIRE_DATE");
String autoDestroy = sEncFile.getInfoDAC(0, "DAC_AUTO_DESTROY");
String change = sEncFile.getInfoDAC(0, "DAC_CHANGE_AUTH");
String classID = sEncFile.getInfoDAC(0, "DAC_GRADE_ACCESS_CLASS_ID");
String groupID = sEncFile.getInfoDAC(0, "DAC_GRADE_ACCESS_GROUP_ID");
String userIDInclude = sEncFile.getInfoDAC(0, "DAC_GRADE_ACCESS_USER_ID_INCLUDE");
String userIDExclude = sEncFile.getInfoDAC(0, "DAC_GRADE_ACCESS_USER_ID_EXCLUDE");
String subGroupExclude = sEncFile.getInfoDAC(0, "DAC_SUBGROUP_EXCLUDE");
//String type = sEncFile.getInfoDAC(1, "DAC_TYPE");
sEncFile.clear();
}
}
▶ public String getInfoGRADE(...) : Function to obtain the DAC information (grade) of the encrypted file header.
- Control Method: ALL
- Package name: SCSL
- Class Name: SLDsEncFile
- Description: Function to obtain the Grade of an encrypted file (Dac type=2) information.
Parameter
| Type | Variable Name | Description | Note |
|---|---|---|---|
| [IN] String | type | Header Type Identifier | Example Code Reference |
Return Value
- Empty string: When there is no data
- Header information string: When there is data
Note
- ※ After using the object, be sure to call the clear() function. (If not called, Resource issues may occur.)
Example
import SCSL.*;
public final class MainTest
{
public static void main(String[] args)
{
SLDsEncFile sEncFile = new SLDsEncFile("암호화파일", "키파일"); // 암호화 헤더 키를 사용하지 않는 경우 키 파일은 생략 가능
String type = sEncFile.getInfoGrade("DAC_TYPE");
String typeID = sEncFile.getInfoGrade("DAC_TYPE_ID");
String typeName = sEncFile.getInfoGrade("DAC_TYPE_NAME");
String read = sEncFile.getInfoGrade("DAC_READ");
String readNumLimit = sEncFile.getInfoGrade("DAC_READ_NUM_LIMIT");
String edit = sEncFile.getInfoGrade("DAC_EDIT");
String decrypt = sEncFile.getInfoGrade("DAC_DECRYPT");
String som = sEncFile.getInfoGrade("DAC_SOM");
String print = sEncFile.getInfoGrade("DAC_PRINT");
String printNumLimit = sEncFile.getInfoGrade("DAC_PRINT_NUM_LIMIT");
String printMarking = sEncFile.getInfoGrade("DAC_PRINT_MARKING");
String expireDate = sEncFile.getInfoGrade("DAC_EXPIRE_DATE");
String autoDestroy = sEncFile.getInfoGrade("DAC_AUTO_DESTROY");
String change = sEncFile.getInfoGrade("DAC_CHANGE_AUTH");
String classID = sEncFile.getInfoGrade("DAC_GRADE_ACCESS_CLASS_ID");
String groupID = sEncFile.getInfoGrade("DAC_GRADE_ACCESS_GROUP_ID");
String userIDInclude = sEncFile.getInfoGrade("DAC_GRADE_ACCESS_USER_ID_INCLUDE");
String userIDExclude = sEncFile.getInfoGrade("DAC_GRADE_ACCESS_USER_ID_EXCLUDE");
String subGroupExclude = sEncFile.getInfoGrade("DAC_SUBGROUP_EXCLUDE");
//String type = sEncFile.getInfoGrade("DAC_TYPE");
sEncFile.clear();
}
}
▶ public String getInfoRUI(...) : Function to obtain RUI information from the encrypted file header.
- Control Method: ALL
- Package name: SCSL
- Class Name: SLDsEncFile
- Description: Function to obtain RUI information from the encrypted file header.
Parameter
| Type | Variable Name | Description | Note |
|---|---|---|---|
| [IN] int | index | RUI Index | 0 ~ getInfoRUICount() - 1 |
| [IN] String | type | Header Type Identifier | Example Code Reference |
Return Value
- Empty string: When there is no data
- Header information string: When there is data
Note
- ※ After using the object, be sure to call the clear() function. (If not called, Resource issues may occur.)
Example
import SCSL.*;
public final class MainTest
{
public static void main(String[] args)
{
SLDsEncFile sEncFile = new SLDsEncFile("암호화파일", "키파일"); // 암호화 헤더 키를 사용하지 않는 경우 키 파일은 생략 가능
String category = sEncFile.getInfo("MAC_CATEGORY");
String userID = sEncFile.getInfo("RUI_USER_ID");
String userName = sEncFile.getInfo("RUI_USER_NAME");
String groupName = sEncFile.getInfo("RUI_GROUP_NAME");
String expireFlag = sEncFile.getInfo("RUI_EXPIRE_FLAG");
String readNum = sEncFile.getInfo("RUI_READ_NUM");
String printNum = sEncFile.getInfo("RUI_PRINT_NUM");
String recentReadTime = sEncFile.getInfo("RUI_RECENT_READ_TIME");
sEncFile.clear();
}
}
▶ public int getInfoMACCount(...) : Function to get the number of MACs in the encrypted file header.
- Control Method: ALL
- Package name: SCSL
- Class Name: SLDsEncFile
- Description: Function to get the number of MACs in the encrypted file header.
Parameter
- None
Return Value
- Number of MACs
Note
- ※ After using the object, be sure to call the clear() function. (If not called, Resource issues may occur.)
Example
import SCSL.*;
public final class MainTest
{
public static void main(String[] args)
{
SLDsEncFile sEncFile = new SLDsEncFile("암호화파일", "키파일"); // 암호화 헤더 키를 사용하지 않는 경우 키 파일은 생략 가능
int macCount = sEncFile.getInfoMAC();
sEncFile.clear();
}
}
▶ public int getInfoDACCount(...) : Function to get the number of DACs in the encrypted file header.
- Control Method: ALL
- Package name: SCSL
- Class Name: SLDsEncFile
- Description: Function to get the number of MACs in the encrypted file header.
Parameter
- None
Return Value
- Number of DACs
Note
- ※ After using the object, be sure to call the clear() function. (If not called, Resource issues may occur.)
Example
import SCSL.*;
public final class MainTest
{
public static void main(String[] args)
{
SLDsEncFile sEncFile = new SLDsEncFile("암호화파일", "키파일"); // 암호화 헤더 키를 사용하지 않는 경우 키 파일은 생략 가능
int dacCount = sEncFile.getInfoDAC();
sEncFile.clear();
}
}
▶ public int getInfoRUICount(...) : Function to get the count of RUI in the encrypted file header.
- Control Method: ALL
- Package name: SCSL
- Class Name: SLDsEncFile
- Description: Function to get the number of RUI in the encrypted file header.
Parameter
- None
Return Value
- Number of RUI
Note
- ※ After using the object, be sure to call the clear() function. (If not called, Resource issues may occur.)
Example
import SCSL.*;
public final class MainTest
{
public static void main(String[] args)
{
SLDsEncFile sEncFile = new SLDsEncFile("암호화파일", "키파일"); // 암호화 헤더 키를 사용하지 않는 경우 키 파일은 생략 가능
int ruiCount = sEncFile.getInfoRUI();
sEncFile.clear();
}
}
▶ public String dsGetFullHeaderEx(...) : Returns the header information of the encrypted document as JSON data.
- Control Method: ALL
- Package name: SCSL
- Class Name: SLDsEncDecHeader
- Description: Returns the header information of the encrypted document as JSON data.
Parameter
| Type | Variable Name | Description | Note |
|---|---|---|---|
| [IN] String | srcFileName | Source file (encrypted file) path |
Return Value
- Return as Json Value
- On Failure
{
"errcode": -1
}- Value other than 0 failed
- -1 : error, -36 : general document
- On Success
- Return security document header information in JSON format
- Security Document Header Structure: PreHeader, SFI, DAC or MAC, RUI
- DAC, RUI is a JsonArray
- There may be no RUI data.
- DAC value and MAC value cannot coexist.
- [DAC]
{
"errcode": 0,
"Custom_Type": 0,
"Document_ID": "[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]",
"Server_ID_Hash": "[-67, 41, -119, -28, -95, 1, ....]",
"DAC": [
{
"DAC_PRINT_MARKING": "1",
"DAC_PRINT_NUM_LIMIT": "",
"DAC_GRADE_ACCESS_CLASS_ID": "",
"DAC_TYPE_NAME": "송지훈",
"DAC_TYPE": "0",
"DAC_READ_NUM_LIMIT": "",
"DAC_DECRYPT": "0",
"DAC_SUBGROUP_EXCLUDE": "",
"DAC_PRINT": "1",
"DAC_GRADE_ACCESS_USER_ID_EXCLUDE": "",
"DAC_AUTO_DESTROY": "0",
"DAC_READ": "1",
"DAC_EXPIRE_DATE": "0",
"DAC_TYPE_ID": "jihoon.song",
"DAC_EDIT": "1",
"DAC_SOM": "0",
"DAC_GRADE_ACCESS_GROUP_ID": "",
"DAC_GRADE_ACCESS_USER_ID_INCLUDE": "",
"DAC_CHANGE_AUTH": "0"
},
{
"DAC_PRINT_MARKING": "1",
"DAC_PRINT_NUM_LIMIT": "",
"DAC_GRADE_ACCESS_CLASS_ID": "",
"DAC_TYPE_NAME": "소프트캠프",
"DAC_TYPE": "1",
"DAC_READ_NUM_LIMIT": "",
"DAC_DECRYPT": "0",
"DAC_SUBGROUP_EXCLUDE": "",
"DAC_PRINT": "1",
"DAC_GRADE_ACCESS_USER_ID_EXCLUDE": "",
"DAC_AUTO_DESTROY": "0",
"DAC_READ": "1",
"DAC_EXPIRE_DATE": "0",
"DAC_TYPE_ID": "SCDP00000",
"DAC_EDIT": "1",
"DAC_SOM": "0",
"DAC_GRADE_ACCESS_GROUP_ID": "",
"DAC_GRADE_ACCESS_USER_ID_INCLUDE": "",
"DAC_CHANGE_AUTH": "1"
}
],
"RUI": [
{
"RUI_PRINT_NUM": "",
"RUI_RECENT_READ_TIME": "2022-07-27 04:39",
"RUI_USER_NAME": "한상혁",
"RUI_READ_NUM": "",
"RUI_USER_ID": "shhan",
"RUI_GROUP_NAME": "SaaS개발3부",
"RUI_EXPIRE_FLAG": "0"
},
{
"RUI_PRINT_NUM": "",
"RUI_RECENT_READ_TIME": "2022-05-10 08:46",
"RUI_USER_NAME": "송지훈",
"RUI_READ_NUM": "",
"RUI_USER_ID": "jihoon.song",
"RUI_GROUP_NAME": "구축2부",
"RUI_EXPIRE_FLAG": "0"
}
],
"Encrypted_Header_Size": 2208,
"Header_Hash": "[-23, 112, -60, 45, -63, -2, 126, -61....]",
"Document_Type": 2,
"Algorithm": "AES",
"DESC": "SCDSA004\u0000\u0000",
"Create_Place": 0,
"SFI": {
"DOC_BRANCH_UID": "server5040",
"CREATE_PATH": "Test Server(44)/_test.xlsx",
"VERIFICATION_DATA": "",
"SERVER_ID": "SCAM-ED72-262C-433A-0004",
"WRITER_GROUP_HIERARCHY": "",
"EXTRA_INFO": "",
"WRITER_NAME": "Test Server(44)",
"WRITER_GROUP_NAME": "Test Server(44)",
"ENC_TYPE": "",
"DOCUMENT_GRADE": "",
"WRITER_ID": "Test Server(44)",
"DOC_PARENT_BRANCH_UID": "server5038",
"DOC_UID": "",
"CREATE_TIME": "2023-04-14 11:31",
"SERVER_NAME": "SCI Server 44",
"DOCUMENT_TYPE": ""
},
"Normal_Doc_Size": 27057
} - [MAC]
{
"Custom_Type": 0,
"errcode": 0,
"Document_ID": "[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]",
"Server_ID_Hash": "[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]",
"RUI": [
{
"RUI_PRINT_NUM": "",
"RUI_RECENT_READ_TIME": "2012-08-14 13:45",
"RUI_USER_NAME": "신성범",
"RUI_READ_NUM": "",
"RUI_USER_ID": "sbshin",
"RUI_GROUP_NAME": "제품개발부",
"RUI_EXPIRE_FLAG": "0"
}
],
"Encrypted_Header_Size": 1296,
"Header_Hash": "[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]",
"Document_Type": 0,
"Algorithm": "AES",
"DESC": "SCDSA002\u0000\u0000",
"MAC": {
"MAC_CATEGORY_NAME": "범주1",
"MAC_CATEGORY": "0000001"
},
"Create_Place": 0,
"SFI": {
"DOC_BRANCH_UID": "server5040",
"CREATE_PATH": "Test Server(44)/_test.xlsx",
"VERIFICATION_DATA": "",
"SERVER_ID": "SCAM-ED72-262C-433A-0004",
"WRITER_GROUP_HIERARCHY": "",
"EXTRA_INFO": "",
"WRITER_NAME": "Test Server(44)",
"WRITER_GROUP_NAME": "Test Server(44)",
"ENC_TYPE": "",
"DOCUMENT_GRADE": "",
"WRITER_ID": "Test Server(44)",
"DOC_PARENT_BRANCH_UID": "server5038",
"DOC_UID": "",
"CREATE_TIME": "2023-04-14 11:31",
"SERVER_NAME": "SCI Server 44",
"DOCUMENT_TYPE": ""
},
"Normal_Doc_Size": 0
}
- On Failure
Note
- ** When declaring, you must set the Key file path in properties or provide the Key file path, DS HeaderKey, and Custom Key.
- SLDsEncDecHeader()
=> It is necessary to set DSKEYENCRYPT_KEYFILE in properties (Improvement of the vulnerability of hardcoded encryption key exposure in Document Security) - SLDsEncDecHeader(String KeyFilePath)
- SLDsEncDecHeader(String DSHeaderKey, String CustomHeaderKey)
Example
import SCSL.*;
public final class MainTest
{
public static void main(String[] args)
{
// 키 파일 입력 할 경우
String keyDACPath = "S:\\TFS_Project2\\Linker\\ServiceLinker\\src\\JavaServiceLinker\\keyfiles\\test44\\KeyDAC_44.sc";
SLDsEncDecHeader DsEncDecHeader = new SLDsEncDecHeader(keyDACPath);
// 키 직접 입력 할 경우
SLDsEncDecHeader SLDSHeader = new SLDsEncDecHeader("DS Server Header Key", "Custom Header Key");
String header = ds.dsGetFullHeaderEx("c:\\temp\\test1.docx");
}
}
▶ public int CheckKeyFile(...) : Validates the Key file.
- Control Method: ALL
- Package name: SCSL
- Class Name: SLDsFile
- Description: Validates the key file.
Parameter
| Type | Variable Name | Description | Note |
|---|---|---|---|
| [IN] String | keyFileName | key file path | Not in use |
| [IN] int | keyVersion | Key file version (option) 0: not defined, 3: version 3, 4: version 4 | Not in use |
| [IN] String | serverID | Server ID, if entered, will be compared and ignored if entered as "". |
Return Value
- 0 : Success
- Value other than 0: Refer to error value
- 2000 : NULL_PARAMETER
- 3001 : No key data in the key file
3014 : Unknown key file type3050 : Different encryption methods- 3051 : Different ServerID
3052 : different key version
Note
- None
Example
import SCSL.*;
public final class MainTest
{
public static void main(String[] args)
{
SLDsFile sFile = new SLDsFile();
sFile.SettingPathForProperty( "D:\\propertisData\\softcamp.properties" );
ret = sFile.CheckKeyFile(keyDACPath, 4, "SCAM-ED72-262C-433A-0000");
}
}
▶ public void SLDsEncDecEnvSet(...) : Function to set values for encryption and decryption.
- Control Method: ALL
- Package name: SCSL
- Class Name: SLDsFile
- Description: Sets the configuration values used for encryption and decryption.
- Prioritize over the values in the properties file
- Only APIs related to DAC are supported. (SLDsEncFileDAC, SLDsEncFileDACV2, SLDsEncFileDACV2AddCreator, SLDsEncFileDACV3, CreateDecryptFileDAC)
- Before using this function, you must initialize it with the SLDsInitDAC(); function.
- The declaration of SCSL.SLDsFile() should not be static.
Parameter
| Type | Variable Name | Description | Note |
|---|---|---|---|
| [IN] String | key | Key to set - Key value defined in SLDsFile For example) SLDsFile.SLDS_ENC_DEC_POLICY_KEYSERVICEID SLDsFile.SLDS_ENC_DEC_POLICY_ALGORITHM SLDsFile.SLDS_ENCDEC_SET_SFI | |
| [IN] int | value | Data values that match the key - SLDsFile.SLDS_ENC_DEC_POLICY_KEYSERVICEID => Key Service ID - SLDsFile.SLDS_ENC_DEC_POLICY_ALGORITHM => Header settings to update to Json => Refer to the example below |
Return Value
- 0 : Success
- Value other than 0: Refer to error value
Note
- Detailed Wiki: DAC Encryption and Decryption API Additional Development -https://wiki.softcamp.co.kr/x/LRzeBw
Example
import SCSL.*;
public final class MainTest
{
public static void main(String[] args)
{
// ARIA 암호화인 경우
SCSL.SLDsFile sFile = new SCSL.SLDsFile();
sFile.SLDsInitDAC();
sFile.SLDsEncDecEnvSet(SLDsFile.SLDS_ENCDEC_KEYSERVICEID, "02"); //키 서비스 아이디가 02 인 경우
sFile.SLDsEncDecEnvSet(SLDsFile.SLDS_ENCDEC_ALGORITHM, SLDsFile.SLDS_ENCDEC_ALGORITHM_ARIA); //ARIA 암호화
sFile.SLDsAddUserDAC("hkmc01", "011100110", 0, 0, 0);
sFile.SLDsAddUserDAC("test01", "011100110", 0, 0, 0);
int ret = sFile.SLDsEncFileDACV2(keyDACPath, "Server", srcFilePath, encFile, 0);
// AES 암호화인 경우
SCSL.SLDsFile sFile = new SCSL.SLDsFile();
sFile.SLDsInitDAC();
sFile.SLDsEncDecEnvSet(SLDsFile.SLDS_ENCDEC_KEYSERVICEID, "31"); //키 서비스 아이디가 31 인 경우
sFile.SLDsEncDecEnvSet(SLDsFile.SLDS_ENCDEC_ALGORITHM, SLDsFile.SLDS_ENCDEC_ALGORITHM_AES); //AES 암호화
sFile.SLDsAddUserDAC("test01", "011100110", 0, 0, 0);
int ret = sFile.SLDsEncFileDACV2(keyDACPath, "Server", srcFilePath, encFile, 0);
}
}
▶ public int DSSetHeaderInfo(...) : Updates the header of a secure document.
- Control Method: ALL
- Package name: SCSL
- Class Name: SLDsFile
- Description: Updates the header of the security document.
- Only SLBsInfoType.DSBSIT_SFI and SLBsInfoType.DSBSIT_RUI are supported.
- public static final int DSBSIT_SFI=1010;
- public static final int DSBSIT_RUI=1050;
- Only SLBsInfoType.DSBSIT_SFI and SLBsInfoType.DSBSIT_RUI are supported.
Parameter
| Type | Variable Name | Description | Note |
|---|---|---|---|
| [IN] String | keyFileName | Key file path (null if not available) | |
| [IN] String | srcPath | Security Document | |
| [IN] String | destPath | Document to be updated (if null, updates the srcPath document) | |
| [IN] String | jsonData | update jsonData | |
| [IN] String | dataAdd | 0: Update only when there is data, 1: Add in case there is no data |
- Example of jsonData
{
"1010": {
"5040": "server5040",
"5028": "server5028",
"5038": "server5038"
}
}
// ** 주의 root 는 한 개만 있어야 함
Return Value
- 0 : Success
- Value other than 0: Refer to error value
- -95 : No data to add/update
- -96 : Unsupported data type
- 2000 : NULL_PARAMETER
- 3001 : No key data in the key file- 3014 : Unknown key file type - 3050 : Different encryption methods~~- 3051 : Different ServerID~~
- 3052 : different key version
Note
- None
Example
import SCSL.*;
public final class MainTest
{
public static void main(String[] args)
{
SCSL.SLDsFile sFile = new SCSL.SLDsFile();
JSONObject mainObj = new JSONObject();
JSONObject parmObj = new JSONObject();
parmObj.put(SLBsDataType.DSBSDT_SFI_DOC_UID, "server5028");
parmObj.put(SLBsDataType.DSBSDT_SFI_DOC_PARENT_BRANCH_UID, "server5038");
parmObj.put(SLBsDataType.DSBSDT_SFI_DOC_BRANCH_UID, "server5040");
mainObj.put(SLBsInfoType.DSBSIT_SFI,parmObj);
String strJsonData = mainObj.toString();
sFile.DSSetHeaderInfo(keyDACPath,encFile,null,strJsonData,0);
}
}
▶ public String dsGetHeaderInfo(...) : Retrieves specific data from the header of an encrypted file.
- Control Method: ALL
- Package name: SCSL
- Class Name: SLDsEncDecHeader
- Description: Retrieves specific data from the file.
Parameter
| Type | Variable Name | Description | Note |
|---|---|---|---|
| [IN] String | dataType | Data ID to query For example) DOC_UID | |
| [IN] String | filePath | File path (including file name) |
Return Value
- 0: MAC Method Encrypted File
- 1: DAC method encryption file
- 2: Graded Method Encryption File
- -1 : Abnormal encrypted file
- -36 : General File
- Other values: Refer to error codeshttps://wiki.softcamp.co.kr/x/ow1YB
Note
- None
Example
import SCSL.*;
public final class MainTest
{
public static void main(String[] args)
{
// ** 선언 시 Key 파일 경로 또는 DS HeaderKey 와 Custom Key를 넣어 주어야 한다.
// SLDsEncDecHeader(String KeyFilePath)
// SLDsEncDecHeader(String DSHeaderKey, String CustomHeaderKey)
SLDsEncDecHeader SLDSHeader = new SLDsEncDecHeader(keyDACPath);
String strDocUID = SLDSHeader.dsGetHeaderInfo("DOC_UID", encFile);
}
}
▶ public int CreateEncryptFileAIP(...) : Converts a regular document to an AIP document
- Control Method: ALL
- Package name: SCSL
- Class Name: SLDsFile
- Description: Convert regular documents to AIP documents
Parameter
| Type | Variable Name | Description | Note |
|---|---|---|---|
| [IN] String | labelId | Label ID to apply | |
| [IN] String | labelName | Label name to apply (apply using labelName if labelId is not available) | |
| [IN] String | srcFilePath | Original general document path | |
| [IN] String | dstFilePath | Converted AIP document path | |
| [IN] String | extraInfo | Input additional information in JSON format (refer to the extraInfo data description table and sample data below) | |
| [IN] int | setProtect | Protect setting status | 0: Unused, 1: Used |
extraInfo Data Description Table
Key Required Type Description source required json name required string Call System Name from required string Call System URL user json id string User ID name string Username depart string All User Departments (Top Group/Middle Group/Lower Group) duty string User Job Title
Return Value
| Type | Variable Name | Description | Note |
|---|---|---|---|
| [IN] int | code | 0 : Success Value other than 0: Error | |
| [IN] String | message | "OK" : Success Other Value Error Message |
Note
- None
Example
import SCSL.*;
public final class MainTest
{
public static void main(String[] args)
{
SLDsFile slFile = new SLDsFile();
slFile.SettingPathForProperty( "D:\\propertisData\\softcamp.properties" );
int retVal = slFile.CreateEncryptFileAIP(
"070b7e3a-bb66-47e0-8196-7d030d54190d",
"",
"D:\\opt\\shieldrm\\data\\테스트.pptx",
"D:\\opt\\shieldrm\\data\\AIP.pptx",
"",
0
);
System.out.println("retVal : " + retVal);
}
}
▶ public int CreateDecryptFileAIP(...) : Converts an AIP document to a regular document
- Control Method: ALL
- Package name: SCSL
- Class Name: SLDsFile
- Description: Convert AIP documents to regular documents
Parameter
| Type | Variable Name | Description | Note |
|---|---|---|---|
| [IN] String | srcFilePath | Original AIP document path | |
| [IN] String | dstFilePath | Released General Document Path | |
| [IN] String | extraInfo | Input additional information in JSON format (refer to the extraInfo data description table and sample data below) |
extraInfo Data Description Table
Key Required Type Description source required json name required string Call System Name from required string Call System URL user json id string User ID name string Username depart string All User Departments (Top Group/Middle Group/Lower Group) duty string User Job Title
Return Value
| Type | Variable Name | Description | Note |
|---|---|---|---|
| [IN] int | code | 0 : Success Value other than 0: Error | |
| [IN] String | message | "OK" : Success Other Value Error Message |
Note
- None
Example
import SCSL.*;
public final class MainTest
{
public static void main(String[] args)
{
SLDsFile slFile = new SLDsFile();
slFile.SettingPathForProperty( "D:\\propertisData\\softcamp.properties" );
int retVal = slFile.CreateDecryptFileAIP(
"D:\\opt\\shieldrm\\data\\AIP.pptx",
"D:\\opt\\shieldrm\\data\\AIP_dec.pptx",
""
);
System.out.println("retVal : " + retVal);
}
}
▶ public String GetLabelInfoAIP(...) : Retrieve label information of AIP document
- Control Method: ALL
- Package name: SCSL
- Class Name: SLDsFile
- Description: Querying label information of AIP documents
Parameter
| Type | Variable Name | Description | Note |
|---|---|---|---|
| [IN] String | srcFilePath | Original AIP document path |
Return Value
- Return as Json Value
- On Success
// label 조회 성공
{
"code": 0,
"labelId": "070b7e3a-bb66-47e0-8196-7d030d54190d",
"labelName": "Protected by SHIELDRM(DEV)"
}
// 일반 문서인 경우
{
"code": 1,
"message": "This document is not Protected."
} - On Failure
{
"code": 40001,
"message": "Invalid token"
}
{
"code": 60001,
"message": "com.microsoft.informationprotection.internal.gen.Error: NoAuthTokenError: Client application failed to provide authentication token for HTTP request., CorrelationId=a2d2f6b1-4265-482b-bc7d-18c88f8284bd, CorrelationId.Description=PolicyProfile"
}
{
"code": 50001,
"message": "400 : \"{\"code\":40011,\"message\":\"Unable to AzureInfo\",\"detail\":\"OpenidTenant is Empty\"}\""
}
- On Success
Note
- None
Example
import SCSL.*;
public final class MainTest
{
public static void main(String[] args)
{
SLDsFile slFile = new SLDsFile();
slFile.SettingPathForProperty( "D:\\propertisData\\softcamp.properties" );
String ret = sFile.GetLabelInfoAIP(srcFilePath);
System.out.println("ret : " + ret);
}
}
▶ public String getCustomProperties(...) : Retrieve hidden information
- Control Method: ALL
- Package name: SCSL
- Class Name: SLDsFile
- Description: Viewing hidden information in office documents
- Supported Extensions
- Word : doc, docx, docm, dot, dotx, dotm, rtf, odt
- Excel : xls, xlsx, xlsm, xlt, xltx, xltm, xlsb, xlam, ods
- PowerPoint : ppt, pptx, pptm, pot, potx, potm, pps, ppsx, ppsm, odp
- Supported Extensions
Parameter
| Type | Variable Name | Description | Note |
|---|---|---|---|
| [IN] String | filePath | Target file path |
Return Value
- Return as Json Value
- On Success
{
"code": 0,
"info": "{\"filePath\":\"D:\\\\opt\\\\shieldrm\\\\data\\\\none.xlsx\",\"properties\":[{\"value\":\"1\",\"key\":\"key1\"},{\"value\":\"22\",\"key\":\"key2\"}]}"
} - On Failure
// 지원하지 않는 확장자
{
"code": -1,
"message": "Unsupported file type: D:\\opt\\shieldrm\\data\\테스트.txt"
}
// AIP 문서일 경우
{
"code": -1,
"message": "Permission is required to open this file."
}
{
"code": -1,
"message": "Unknown file format."
}
// DS 문서일 경우
{
"code": -1,
"message": "zip END header not found"
}
{
"code": -1,
"message": "Unsupported file format: Unknown"
}
// 내부 서비스 에러
{
"code": 40101,
"message": "{\"code\":40107,\"message\":\"No matching license found\",\"detail\":\"License skms_connector_info information is empty.\"}"
}
- On Success
Note
- None
Example
import SCSL.*;
public final class MainTest
{
public static void main(String[] args)
{
SLDsFile slFile = new SLDsFile();
slFile.SettingPathForProperty( "D:\\propertisData\\softcamp.properties" );
String ret = slFile.getCustomProperties("D:\\opt\\shieldrm\\data\\none.xlsx");
JSONObject obj = new JSONObject(ret);
int code = obj.optInt("code");
String info = obj.optString("info");
System.out.println("code : " + code);
System.out.println("info : " + info);
}
}
▶ public String addDocCustomProperties(...) : Add hidden information
- Control Method: ALL
- Package name: SCSL
- Class Name: SLDsFile
- Description: Adding hidden information to office documents
- Supported Extensions
- Word : doc, docx, docm, dot, dotx, dotm, rtf, odt
- Excel : xls, xlsx, xlsm, xlt, xltx, xltm, xlsb, xlam, ods
- PowerPoint : ppt, pptx, pptm, pot, potx, potm, pps, ppsx, ppsm, odp
- Supported Extensions
Parameter
| Type | Variable Name | Description | Note |
|---|---|---|---|
| [IN] String | obj | List of files to save and hidden information | String in JSONObject format |
| String | filePath | Target file path | |
| JsonArray | info | List of hidden information to be saved | |
| propertiesKey | propertiesKey | hidden information key | Update value if already added |
| propertyValue | propertyValue | hidden information value |
{
"filePath": "D:\\opt\\shieldrm\\data\\none.xlsx",
"info": [
{
"propertiesKey": "key1",
"propertyValue": "1"
}
]
}
Return Value
- Return as Json Value
- On Success
{
"code": 0
} - On Failure
// 지원하지 않는 확장자
{
"code": -1,
"message": "Unsupported file type: D:\\opt\\shieldrm\\data\\테스트.txt"
}
// AIP 문서일 경우
{
"code": -1,
"message": "Permission is required to open this file."
}
{
"code": -1,
"message": "Unknown file format."
}
// DS 문서일 경우
{
"code": -1,
"message": "zip END header not found"
}
{
"code": -1,
"message": "Unsupported file format: Unknown"
}
// 내부 서비스 에러
{
"code": 40101,
"message": "{\"code\":40107,\"message\":\"No matching license found\",\"detail\":\"License skms_connector_info information is empty.\"}"
}
- On Success
Note
- None
Example
import SCSL.*;
public final class MainTest
{
public static void main(String[] args)
{
SLDsFile slFile = new SLDsFile();
slFile.SettingPathForProperty(propertiesPath);
JSONObject obj = new JSONObject();
JSONArray info = new JSONArray();
String filePath = "D:\\opt\\shieldrm\\data\\none.xlsx";
JSONObject item = new JSONObject();
item.put("propertiesKey", "key1");
item.put("propertyValue", "1");
info.put(item);
obj.put("filePath", filePath);
obj.put("info", info);
String ret = slFile.addDocCustomProperties(obj.toString());
System.out.println("ret : " + ret);
}
}
▶ public String removeCustomSetProperties(...) : Delete hidden information
- Control Method: ALL
- Package name: SCSL
- Class Name: SLDsFile
- Description: Deleting hidden information from Office documents
- Supported Extensions
- Word : doc, docx, docm, dot, dotx, dotm, rtf, odt
- Excel : xls, xlsx, xlsm, xlt, xltx, xltm, xlsb, xlam, ods
- PowerPoint : ppt, pptx, pptm, pot, potx, potm, pps, ppsx, ppsm, odp
- Supported Extensions
Parameter
| Type | Variable Name | Description | Note |
|---|---|---|---|
| [IN] String | obj | List of files and hidden information to be deleted | String in JSONObject format |
| String | filePath | Target file path | |
| JsonArray | info | List of hidden information to be deleted | |
| propertiesKey | propertiesKey | hidden information key | |
| propertyValue | propertyValue | hidden information value |
{
"filePath": "D:\\opt\\shieldrm\\data\\none.xlsx",
"info": [
{
"propertiesKey": "key1",
"propertyValue": "1"
}
]
}
Return Value
- Return as Json Value
- On Success
{
"code": 0
} - On Failure
// 지원하지 않는 확장자
{
"code": -1,
"message": "Unsupported file type: D:\\opt\\shieldrm\\data\\테스트.txt"
}
// AIP 문서일 경우
{
"code": -1,
"message": "Permission is required to open this file."
}
{
"code": -1,
"message": "Unknown file format."
}
// DS 문서일 경우
{
"code": -1,
"message": "zip END header not found"
}
{
"code": -1,
"message": "Unsupported file format: Unknown"
}
// 내부 서비스 에러
{
"code": 40101,
"message": "{\"code\":40107,\"message\":\"No matching license found\",\"detail\":\"License skms_connector_info information is empty.\"}"
}
- On Success
Note
- None
Example
import SCSL.*;
public final class MainTest
{
public static void main(String[] args)
{
SLDsFile slFile = new SLDsFile();
slFile.SettingPathForProperty(propertiesPath);
JSONObject obj = new JSONObject();
JSONArray info = new JSONArray();
String filePath = "D:\\opt\\shieldrm\\data\\none.xlsx";
JSONObject item = new JSONObject();
item.put("propertiesKey", "key1");
item.put("propertyValue", "1");
info.put(item);
obj.put("filePath", filePath);
obj.put("info", info);
String ret = slFile.removeCustomSetProperties(obj.toString());
System.out.println("ret : " + ret);
}
}
▶ public boolean isSOMFile(...) : Function to determine if it is a SOM file
- Control Method: ALL
- Package name: SCSL
- Class Name: SLBsUtil
- Description: Checks whether the file passed as a parameter is a SOM file.
Parameter
| Type | Variable Name | Description | Note |
|---|---|---|---|
| [IN] String | filePath | File path (including file name) |
Return Value
- false : Not a SOM file
- true : SOM file
Note
- None
Example
import SCSL.*;
public final class MainTest
{
public static void main(String[] args)
{
SCSL.SLBsUtil util = new SCSL.SLBsUtil();
boolean isSomFile = util.isSOMFile("C:/somfile.exe");
}
}
▶ public int getSOMFileType(...) : Function to check the SOM file type
- Control Method: ALL
- Package name: SCSL
- Class Name: SLBsUtil
- Description: Function to check SOM file type
Parameter
| Type | Variable Name | Description | Note |
|---|---|---|---|
| [IN] String | filePath | File path (including file name) |
Return Value
- -1 : Not a SOM file
- 0 : Normal SOM File
- 1 : OLE SOM File
- 2 : Simple SOM File
Note
- None
Example
import SCSL.*;
public final class MainTest
{
public static void main(String[] args)
{
SCSL.SLBsUtil util = new SCSL.SLBsUtil();
int fileType = util.getSOMFileType("C:/somfile.exe");
}
}
▶ public void DSSOMSetProperty(...) : Function to set the file path for dssom.properties
- Control Method: SOM
- Package name: DSSOMSL
- Class Name: SLSomFIleLinker
- Description: Function to set the path for the dssom.properties file
Parameter
| Type | Variable Name | Description | Note |
|---|---|---|---|
| [IN] String | szProperty | dssom.properties path |
Return Value
- None
Note
- None
Example
import SCSL.*;
public final class MainTest {
public static void main(String[] args) {
SLSomFileLinker sSomFileLinker = new SLSomFileLinker();
sSomFileLinker.DSSOMSetProperty("D:\\AMS\\data\\ams\\dssom.properties");
}
}
▶ public void DSSOMSetRights(...) : User authentication password and permission setting function
- Control Method: SOM
- Package name: DSSOMSL
- Class Name: SLSomFIleLinker
- Description: User authentication password and permission setting function
Parameter
| Type | Variable Name | Description | Note |
|---|---|---|---|
| [IN] String | szAuthPwd | Password string | When opening the SOM file, you must enter a password. The password can only contain English letters and numbers. |
| [IN] int | nSave | Save As Permission | The SOM file is in exe format, and when opened, it opens according to the respective file extensions, so it is saved as "Save As" instead of just saving. 1 : Has permission 0 : No Permission |
| [IN] int | nPrint | Print Permission | Set print permissions. 1 : Has permission 0 : No Permission |
| [IN] int | nAccNum | Read Count | 0 : Infinity 1 : 1 time N : N times |
| [IN] int | nPrintNum | Print count | 0 : Infinity 1 : 1 time N : N times |
| [IN] int | nDestroy | Destruction Permission | 1 : Destroyed 0 : Not destroyed |
| [IN] int | nExpireDate | Expiration Date | 0 : Infinity 1 : By tomorrow N : Valid until N days |
| [IN] int | nOleSupport | OLESOM Viewer Support | 0: OLESOM Viewer not supported 1: OLESOM Viewer Support |
| [IN] int | nImgViewer | Image Viewer Support | 0: Image Viewer not supported 1: Image Viewer Support |
| [IN] int | nTxtViewer | Text Viewer Support | 0: Text Viewer not supported 1: Text Viewer Support |
| [IN] int | nUIMode | 2 | |
| [IN] boolean | bUnicode | true | |
| [IN] String | szMacAddress | Only PCs with the same MAC address can be opened. | MAC address (if null, do not check) Format: 00-00-00-00-00-00 |
Return Value
- None
Note
- None
Example
import SCSL.*;
public final class MainTest {
public static void main(String[] args) {
SLSomFileLinker sSomFileLinker = new SLSomFileLinker();
sSomFileLinker.DSSOMSetProperty("D:\\AMS\\data\\ams\\dssom.properties");
sSomFileLinker.DSSOMSetRights(
"1234", // 패스워드
1, // 다른 이름 저장 권한
1, // 프린트 권한
2, // 읽기 횟수
0, // 프린트 횟수
0, // 파기 권한
1, // 유효기간
1, // OLESOM Viewer 지원
0, // Image Viewer 지원
0, // Text Viewer 지원
2,
true,
"10-FF-E0-7F-06-C6" // MAC address
);
}
}
▶ public int DSSOMCreateFile(...) : API for creating a SOM file
- Control Method: SOM
- Package name: DSSOMSL
- Class Name: SLSomFIleLinker
- Description: API for generating SOM files
Parameter
| Type | Variable Name | Description | Note |
|---|---|---|---|
| [IN] String | szSrcFileName | Absolute path of the original file | Including file name If the document is a som file, return success after copying the file. |
| [IN] String | szOutFileName | Absolute path of the external transfer security file to be generated | Including file name - The file extension must be indicated as exe. |
| [IN] String | szKeyFileName | Absolute path of the key file | Not in use |
Return Value
- 0: Success
- Other values: Failure
Note
- in consultation with the Technology HeadquartersSecurity DocumentSOM file creation is not supported.
Example
import SCSL.*;
public final class MainTest {
public static void main(String[] args) {
SLSomFileLinker sSomFileLinker = new SLSomFileLinker();
sSomFileLinker.DSSOMSetProperty("D:\\AMS\\data\\ams\\dssom.properties");
sSomFileLinker.DSSOMSetRights(
"1234", // 패스워드
1, // 다른 이름 저장 권한
1, // 프린트 권한
2, // 읽기 횟수
0, // 프린트 횟수
0, // 파기 권한
1, // 유효기간
1, // OLESOM Viewer 지원
0, // Image Viewer 지원
0, // Text Viewer 지원
2,
true,
"10-FF-E0-7F-06-C6" // MAC address
);
int retVal = sSomFileLinker.DSSOMCreateFile(
"D:\\opt\\shieldrm\\data\\test\\test.pptx",
"D:\\opt\\shieldrm\\data\\test\\test.exe",
""
);
System.out.println(retVal);
}
}