1

I am using Tika server 2.5, when trying to parse pdf document which is password protected getting exeption of EncryptedDocumentException, so is their any way to parse this document or send the password to tika server for parsing?

BChe
  • 13
  • 4
  • 1
    As per https://issues.apache.org/jira/browse/TIKA-1494 what happens if you pass the password along in the `Password` HTTP header with the request? – Gagravarr Oct 17 '22 at 11:21
  • tried with adding non standard Http request header as below but still having same issue. --> var client=new HttpClient(); var stream=File.OpenRead(fileName); var content=new MultipartForm DataContent{{new StreamContent(stream) }}; HttpRequestMessage request=new HttpRequestMessage(){ requestUri= new Uri("Your Endpoints Address"), Method= HttpMethod.Post, Headers={{"X-Password", "Password"}}, content=content }; HttpResponseMessage response= client.SendAsync(request).Result; – BChe Oct 17 '22 at 15:50
  • @Gagravarr any other apporaches which we can do? – BChe Oct 18 '22 at 05:47
  • 1
    My understanding from reading that issue is that it's "Password" and not "X-Password". Like it's done in this unit test: http://svn.apache.org/viewvc/tika/trunk/tika-server/src/test/java/org/apache/tika/server/MetadataResourceTest.java?r1=1646707&r2=1646706&pathrev=1646707 – Tilman Hausherr Oct 18 '22 at 09:00
  • @TilmanHausherr As it is non standard Http request header followed naming convention.tried with Password text as well but still the same issue. – BChe Oct 18 '22 at 11:01
  • 1
    I just answered in the mailing list where you also posted. I got it to work with "Password". – Tilman Hausherr Oct 18 '22 at 17:36

1 Answers1

2

it worked for me by using the header Password:

Curl -T "Simple-40-bit-RC4-encrypted.pdf" http://localhost:9998/rmeta/form --header "Password:1234567890abcdefghijk1234567890abcdefghijk"

Tilman Hausherr
  • 17,731
  • 7
  • 58
  • 97