GithubHelp home page GithubHelp logo

immateriel / lcp-testing-tools Goto Github PK

View Code? Open in Web Editor NEW

This project forked from edrlab/lcp-testing-tools

0.0 4.0 0.0 4.53 MB

Compliance testing tools for Readium LCP

Java 17.76% Batchfile 0.51% Shell 0.54% Python 81.19%

lcp-testing-tools's Introduction

Compliance tests for LCP/LSD server

Requirements

This software is developed using Python 3. You must install it on your computer before you can use the tool.

The lcpencrypt module (from the readium-lcp-server project in the Readium repository), must be installed locally if the processing of unprotected EPUB files (--epub option) is required.

Recommendation

To avoid a pollution of you global python environment, we advise you to use venv, unless you need to debug it using e.g. VS Code:

python3 -m venv Pythonenv/lcpcheck

Prepare VS Code for debugging the app

In VSCode, in launch.json, remplace

"pythonPath": "${config.python.pythonPath}"

by

"pythonPath": "/Library/Frameworks/Python.framework/Versions/3.6/bin/python3"

Install the required Python modules

pip3 install jsonschema
pip3 install pyyaml
pip3 install lxml
pip3 install requests
pip3 install pycrypto
pip3 install strict-rfc3339
pip3 install rfc3987
pip3 install python-dateutil

Configuration file

A sample of configuration file is provided in etc/config.yml.dist

# Configuration of the lcp testing tool
lcp_encrypt:
  # cmd_path: Path to the lcpencrypt command
  cmd_path: /Work/gospace/bin/lcpencrypt
  
lcp_server:
  # base_uri: Url of the lcp server
  base_uri: <lcp-server-uri>
  auth:
    # user: Auth username to connect to lcp server
    user: <value>
    # passwd: Auth password to connect to lcp server
    passwd:"<value>
  # external_repository_path: External path where LCP server files are stored 
  # useful if the server is installed on a docker
  external_repository_path: <lcpfiles>
  # internal_repository_path: Path where LCP server files are stored
  internal_repository_path: <lcpfiles>
  # user_passphrase_hint: User passphrase hint used for license generation
  user_passphrase_hint: <hint-value>
  # user_passphrase: User passphrase  used for license generation
  user_passphrase: <passphrase-value>

lsd_server:
  # base_uri: Url of the lsd server
  base_uri: <lsd-server-uri>
  auth:
    # user: Auth username to connect to lsd server
    user: <value>
    # passwd: Auth password to connect to lsd server
    passwd: <value>
# working_path: Working path of the test suite
working_path: <value>
# root_cert_path: Path to the root certificate file
root_cert_path: <value>

Run tests

Testing requires:

  • a customized config.yml (or .yaml)
  • an unprotected EPUB file
  • or a protected EPUB file
  • or an LCP license file

Then you can launch different tests:

Encrypt an EPUB file, generate a license and a protected file:

python3 src/lcpcheck.py -vv config.yml -e <path-unprotected-epub>

Check a protected EPUB file:

python3 src/lcpcheck.py -vv config.yml -p <path-protected-epub>

Check an LCP liense:

python3 src/lcpcheck.py -vv config.yml -l <path-lcp-license>

Check the dynamic features (register, renew, return) of an LCP liense:

python3 src/lcpcheck.py -vv config.yml -s <path-lcp-license>

The different tests can be easily chained. For exemple, if you have a protected EPUB file at hands, you can check the file, the embedded license and its dynamic features using:

python3 src/lcpcheck.py -vv config.yml -p <path-protected-epub> -l -s

And if you have an LCP license at hands, you can check the license and its dynamic features using:

python3 src/lcpcheck.py -vv config.yml -l <path-lcp-license> -s

The verbose option allows you to get more and more verbose information:

  • "-v": only error messages are displayed
  • "-vv": info and error messages are displayed
  • "-vvv": debug, info and error messages are displayed

lcp-testing-tools's People

Contributors

llemeurfr avatar danielweck avatar clebeaupin avatar julbouln avatar

Watchers

Bertra[N]d Gauriat avatar  avatar James Cloos avatar Xavier Cazin avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.