Using Java to call Krpano to encrypt XML

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.