Please help me in retrieving password from pdf

  • senthil kumar

    senthil kumar - 2014-07-22

    Hi there

    I got to see through jpdf code, it looks good for pdf manipulation tool. I want to find out the password for the password protected pdf, I got to see the following snippet of your code in de.intarsys.pdf.crypt.StandardSecurityHandler:

    protected byte[] getU() {
    COSString u = getEncryption().cosGetField(DK_U).asString();
    for(byte b : u.byteValue())
    System.out.println("----------------"+new String(u.byteValue(),"UTF-16BE"));
    //how to display password ?
    catch(Exception e)
    if (u == null) {
    return null;
    return u.byteValue();

    Please help me with your solution asap.


    Last edit: senthil kumar 2014-07-22
  • mtraut

    mtraut - 2014-07-25

    It would not make much sense if you could read out the password, does it?

    • senthil kumar

      senthil kumar - 2014-07-25


      Our requirement is to get the password from the pdf document and render the passwordless.
      I got the code snippet where I have explicitly set the password to user entered password in de.intarsys.pdf.crypt.StandardSecurityHandlerR3:

      public boolean authenticateUser(byte[] user) throws COSSecurityException {

      byte[] entryU = getU();
      // byte[] tempU = createUserPassword(user);
      // Commented by me
      tempU = getU();
      //Explicitly setting the user password to doc password
      .....//rest of the code goes here

      The attached password.pdf has the password as 'test'
      But it get the blank document as attached without password, the file size is
      len1 : : : 49755 //Before the document is decrypted
      len2 : : : 49226 //After the document is decrypted
      Please help me asap.


      Last edit: senthil kumar 2014-07-26

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks