File Encryption

<< Click to Display Table of Contents >>

Navigation:  Encrypting features - GDPR >

File Encryption

vpxPrint allows to protect the xpr files by encoding them. They are no more human readable and can be opened only if the right password is provided.

 

 

File encrypting:

 

1.Insert a "<CRYPT>" tag in the first line of the xpr file. This tag must be written like that, in uppercase letters without any parameter.
This tag has no effect on the xpr file, it will be ignored by the rendering process.

 

1.After creating the xpr file, the file can be encrypted or not, the presence of the <CRYPT> tag in the file has no importance.
To encrypt a file, call the xCrypt procedure of xprint.dll with:
 

Example:

 
 DEF VAR retCode        AS INT.
 RUN xCrypt("myFile.xpr", "MyPassword", OUTPUT retCode ).                /* Crypts the file using MyPassword as a key */
 
Return values:

0: Success
1: File not found
2: Empty password
3: File is already encrypted (.xprx suffix)
4: No <CRYPT> tag in the file
5: Unexpected encrypting error
6: Rename to *.xprX error
 

 
A file can be encrypted if and only if a "<CRYPT>" tag exists in the file.
 
After xCrypt, the file *.xpr (or other suffix) is encoded and renamed to *.xprX file.
 about_24_h The *.xpr file does not exist anymore.

 

When trying to open a such *.xprx file, the user will be asked for the password:
 passWord
about_24_h IMPORTANT: There is absolutely no way to recover a *.xprX file without knowing the right password.
 

 

warning_24 IMPORTANT:

As .xpr files are text files, there is a risk of exposure of their contents during the time of their creation and encryption.

If this is a security issue, use that writes encrypted data directly from the authoring program.

 

Using the file programmatically:

 

1.An encrypted file can be decrypted from within an application with:
 
DEF VAR retCode        AS INT.
RUN xUnCrypt("myFile.xprx", "MyPassword", OUTPUT retCode).        /* decrypts a xprx file */
 
Return values:
       0: Success
       1: File not found
       2: Empty password
       3: Invalid file suffix
       4: Error during decoding
       5: Password error
 
The "xprx" suffix is mandatory to decrypt a file. Of course, the password must match the one used to encrypt the file, otherwise the file will not be decrypted.
about_24_h After the xUnCrypt call, the *.xprx file is renamed as *.xpr file and becomes readable and usable by anyone without asking for a password.
 

2.An encrypted file can be printed directly without calling xUncrypt with:
 
RUN printXFile("myFile.xprx", "MyPassword").        /* executes a *.xprx file */
 

3.Setting a permanent password:

A permanent password can be set for the application session. (as the dll is permanently loaded in memory, the password retains the value specified during the session)

So, if the file has a .xprX suffix, printFile() and printFilestat() run as if the file was not encrypted.

 

This makes it easy to migrate applications with numerous occurrences of printFile() / printfilestat() must be replaced by printXFile().

 

         RUN setPassword("MyPassword").

 

about_24_h printFile() and printFileStat() can then be used with encrypted files.