Use Java call KRPano encrypting XML

Use Java call KRPano encrypting XML

KRPano's command line tool krpanotools can encrypt the XML specific parameters are described below
Syntax:

krpanotools32.exe encrypt[OPTIONS] inputfiles

Inputfiles parameter can be an arbitrary number of files (support *)

Options:
-h5 … Using the HTML5-compatible encryption methods
-bin … Supports only Flash encryption
-p … Using public key encryption
-z … Encrypted and compressed files
-ow … Overwrite the source file
-bk … Overwrite the source file and the backup source files
-in=# … Manually set the file to be encrypted path
-out=# … To manually set the output file path
-q … Do not display output messages

 

For example, the following example will tour directory. XML encryption, encrypted is saved as tour_enc. XML

 krpanotools32 encrypt -in="tour.xml" -out="tour_enc.xml"

 

We can call the command line Java code and implements programs to encrypt XML file

import java.io.IOException;
import java.lang.ProcessBuilder;
import java.io.*;

public class KrXmlEncryption {
    public static void main(String[] args) throws IOException {
        encryptXML("tour.xml", "tour_enc.xml");
    }

    public static void encryptXML(String srcPath, String outPath) throws IOException {
        Process process = new ProcessBuilder("krpanotools32.exe", "encrypt", "-z", String.format("-in="%s"", srcPath),
                String.format("-out="%s"", outPath)).start();
        BufferedReader input = new BufferedReader(new InputStreamReader(process.getInputStream()));
        String line;
        while ((line = input.readLine()) != null) {
            System.out.println(line);
        }
    }
}

 

EncryptXML function has two parameters

SrcPath: the path to the XML source file

OutPath: XML path to save encrypted files

You can call this function saves the XML encryption to outPath srcPath

 

If you need stronger encryption methods, you can refer to this article

KRPano资源分析工具强力加密KRPano项目(XML防破解,切片图保护,JS反调试)

 

This post was published on: http://www. krpano. tech/archives/546

Posted by: dragon slayer

Reprinted please specify the source, thank you!