Examples of StandardSecurityHandler


Examples of nz.govt.natlib.adapter.pdf.crypt.StandardSecurityHandler

        allowTextNotes = permissions.getBit(5);
      }
      userToken = encrypt.getString("U");
      ownerToken = encrypt.getString("O");

      securityHandler = new StandardSecurityHandler(this);
    } else {
      securityHandler = new NoEncryptionSecurityHandler();
    }

    if (rootRef != null) {
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.encryption.StandardSecurityHandler

        if (!isEncrypted())
        {
            encryption = new PDEncryption();
        }

        getEncryption().setSecurityHandler(new StandardSecurityHandler(
                new StandardProtectionPolicy(ownerPassword, userPassword, new AccessPermission())));
    }
View Full Code Here

Examples of org.pdfbox.pdmodel.encryption.StandardSecurityHandler

    }
    }


  private boolean isPassword(String password, boolean userPassword) throws IOException, BadSecurityHandlerException, CryptographyException {
        final StandardSecurityHandler secHandler = getSecurityHandler();
     
        PDEncryptionDictionary dictionary = getPDFDocument().getEncryptionDictionary();

        int dicPermissions = dictionary.getPermissions();
        int dicRevision = dictionary.getRevision();
        int dicLength = dictionary.getLength()/8;

        COSString id = (COSString) getPDFDocument().getDocument().getDocumentID().getObject( 0 );
        byte[] u = dictionary.getUserKey();
        byte[] o = dictionary.getOwnerKey();

        if (userPassword)
        {
          return secHandler.isUserPassword(password.getBytes(), u,
              o, dicPermissions, id.getBytes(), dicRevision, dicLength );
        }
        else
        {
          return secHandler.isOwnerPassword(password.getBytes(), u,
              o, dicPermissions, id.getBytes(), dicRevision, dicLength );
        }
  }
View Full Code Here

Examples of org.pdfbox.pdmodel.encryption.StandardSecurityHandler

  }

  private StandardSecurityHandler getSecurityHandler() throws IOException,
      BadSecurityHandlerException {
    PDEncryptionDictionary dict = getPDFDocument().getEncryptionDictionary();
        StandardSecurityHandler secHandler = (StandardSecurityHandler) SecurityHandlersManager.getInstance().getSecurityHandler(dict.getFilter());
    return secHandler;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.