Krpano command-line tool krpanotools can encrypt XML, the specific parameters are described as follows
Grammar:
Krpanotools32.exe encrypt [OPTIONS] Inputfiles
inputfiles parameter can be any number of files (support *)
Options:
-h5 ... Using HTML5-compatible encryption
-bin ... Use only flash-enabled encryption
- P ... Using public key encryption
- z ... Encrypt and Compress files
-ow ... Overwrite source files
-BK ... Overwrite source files and back up source files
-in=# ... Manually set the path to the file you want to encrypt
-out=# ... Manually set the output file path
- Q ... Do not display output information
For example, the following example encrypts the Tour.xml under the directory and saves it as Tour_enc.xml
Krpanotools32 encrypt-in= "Tour.xml"-out= "Tour_enc.xml"
We can invoke the command line in Java code to implement a program to encrypt an 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 Processbuilde R ("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);}} }
The Encryptxml function has two parameters
srcpath: path to the XML source file
outpath: path to file save after XML encryption
Call this function to encrypt Srcpath XML and save it to Outpath
If you need more powerful encryption, you can refer to this article
http://www.krpano.tech/archives/187
This blog post was posted in: http://www.krpano.tech/archives/546
Posted by: Dragon Slayer
Reprint please indicate the source, thank you!
Using Java to call Krpano to encrypt XML