如何使用LuceneTransform使用密码加密Lucene索引文件

时间:2013-10-19 11:37:26

标签: lucene indexing

我正在尝试从HTML文件创建Lucene Index数据,但它抛出异常 实际上我想用密码加密我的lucene索引。还有其他选择吗?

     try{

       File outputdir=new File("path upto output directory");
       byte[] salt = new byte[16];
       String password = "lucenetransform";
       DataEncryptor enc = new DataEncryptor("AES/ECB/PKCS5Padding", password, salt,    128,false);
       DataDecryptor dec = new DataDecryptor(password, salt,false);

       IndexWriter indexwriter=new IndexWriter(new TransformedDirectory(FSDirectory.open(outputdir), enc, dec), new StandardAnalyzer(Version.LUCENE_36),true, IndexWriter.MaxFieldLength.LIMITED);


       }

       catch(Exception ex)
       {
         ex.printStackTrace();

       }

0 个答案:

没有答案