You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Shinichiro Abe <sh...@gmail.com> on 2011/04/25 11:57:49 UTC

support for reading password of excel

Hi.

When Tika run text extraction, a excel files protected reading password throws exception like attachment text bellow.
(not writing password but reading password)
Is this  known ploblem?

Regards,
Shinichiro Abe.


Reading password:'2'

Re: [WARNING : MESSAGE ENCRYPTED] support for reading password of excel

Posted by wuqing <qi...@toshiba-sol.co.jp>.
The ways to read Excel 2003(xls) and Excel 2007(xlsx) files are different .

1 2003(xls)
  Please use the Biff8EncryptionKey Class to specify the password,and POI
can automatically validate
whether the specied password is right. and open the excel file.

 Example (code)
   POIFSFileSystem pois = new POIFSFileSystem(new
FileInputStream("test.xls"));
    Biff8EncryptionKey.setCurrentUserPassword("password");
    HSSFWorkbook book = new HSSFWorkbook(pois);

 The method of setCurrentUserPassword is thread safe.

2 2007(xlsx)
  The difference with 2007's way is that password validate is not
automatical, 

 Example (code) ->  the Junit test code from POI source package
(DecryptorTest.java)
    POIFSFileSystem fs = new
POIFSFileSystem(POIDataSamples.getPOIFSInstance().openResourceAsStream("protect.xlsx"));
        EncryptionInfo info = new EncryptionInfo(fs);
        Decryptor d = new Decryptor(info);
        d.verifyPassword("password");
        d.getDataStream(fs); -> inputStream 



--
View this message in context: http://apache-poi.1045710.n5.nabble.com/support-for-reading-password-of-excel-tp4338009p4340476.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: [WARNING : MESSAGE ENCRYPTED] support for reading password of excel

Posted by Shinichiro Abe <sh...@gmail.com>.
Thank you. I understand.

Shinichiro Abe 

On 2011/04/26, at 19:27, Maxim Valyanskiy wrote:

> Hello!
> 
> 25.04.2011 19:20, Shinichiro Abe пишет:
>> Hello.Thank you for your reply.
>> If you know, please let me know.
>> In fact, I use the function of text extracraction on solr which uses solr cell(Tika).
>> In this situation,the same error threw.
>> Where should I specify the password for decryption, TikaConfig or else?
> 
> Use static method setCurrentUserPassword(String password) of
> org.apache.poi.hssf.record.crypto.Biff8EncryptionKey. It sets thread local
> variable. Do not forget to reset it to null after text extraction.
> 
> best wishes, Max
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: [WARNING : MESSAGE ENCRYPTED] support for reading password of excel

Posted by wuqing <qi...@toshiba-sol.co.jp>.
Thank you for your comment

the method of setCurrentUserPassword is static method, but in JavaDoc the
method's comment is that
「Sets the BIFF8 encryption/decryption password for the current thread.」

The Class of ThreadLocal which is threadsafe  is used in the POI source
code.  
 

--
View this message in context: http://apache-poi.1045710.n5.nabble.com/support-for-reading-password-of-excel-tp4338009p4342405.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: [WARNING : MESSAGE ENCRYPTED] support for reading password of excel

Posted by Maxim Valyanskiy <ma...@jet.msk.su>.
Hello!

25.04.2011 19:20, Shinichiro Abe пишет:
> Hello.Thank you for your reply.
> If you know, please let me know.
> In fact, I use the function of text extracraction on solr which uses solr cell(Tika).
> In this situation,the same error threw.
> Where should I specify the password for decryption, TikaConfig or else?

Use static method setCurrentUserPassword(String password) of
org.apache.poi.hssf.record.crypto.Biff8EncryptionKey. It sets thread local
variable. Do not forget to reset it to null after text extraction.

best wishes, Max

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: [WARNING : MESSAGE ENCRYPTED] support for reading password of excel

Posted by Shinichiro Abe <sh...@gmail.com>.
Hello.Thank you for your reply.
If you know, please let me know.
In fact, I use the function of text extracraction on solr which uses solr cell(Tika).
In this situation,the same error threw.
Where should I specify the password for decryption, TikaConfig or else?

Thank you,
Shinichiro Abe.

On 2011/04/25, at 19:12, Maxim Valyanskiy wrote:

> Hello!
> 
> 25.04.2011 13:57, Shinichiro Abe пишет:
>> When Tika run text extraction, a excel files protected reading password throws exception like attachment text bellow.
>> (not writing password but reading password)
>> Is this  known ploblem?
> Tika does not know your password, you need to specify it to decrypt file data. Unfortunately, there is not way to do it in Tika command line application (afaik)
> 
> best wishes, Max
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: [WARNING : MESSAGE ENCRYPTED] support for reading password of excel

Posted by Maxim Valyanskiy <ma...@jet.msk.su>.
Hello!

25.04.2011 13:57, Shinichiro Abe пишет:
> When Tika run text extraction, a excel files protected reading password throws exception like attachment text bellow.
> (not writing password but reading password)
> Is this  known ploblem?
Tika does not know your password, you need to specify it to decrypt file data. 
Unfortunately, there is not way to do it in Tika command line application (afaik)

best wishes, Max

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org