百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
R

readium-lcp-server

> 编程语言
开源

Readium LCP 服务器存储库

99 stars0 点赞2 次浏览
访问官网GitHub

工具介绍

Readium LCP 服务器存储库

Readium LCP Server

Documentation

As a retailer, public library or specialized e-distributor, you are distributing EPUB or PDF ebooks, audiobooks packaged using the LPF or RPF (.audiobook) formats, or comics packaged using the RPF (.divina) format. You want them protected by the Readium LCP DRM. Your CMS (Content Management system) already handles publications, users, purchases or loans, your technical team is able to integrate this CMS with a License server by creating a new http endpoint in the CMS and requesting the License Server via its REST interface, and this team is also able to compile and deploy a Go open-source codebase. If you are in this situation, this open-source codebase is made for you.

Using the tools provided in this project you can:

  • Encrypt your entire catalog of publications and store these encrypted files in a file system or S3 bucket, ready for download from any LCP compliant reading application;
  • Generate LCP licenses;
  • Let users request a loan extension or an early return;
  • Cancel a license in case a user has declared he wasn't able to use it;
  • Revoke a license in case of oversharing.

A detailed documentation is found in the Wiki pages of the project. You really have to read it before you start testing this application.

A new v2 codebase has been developed in the EDRLab GitHub space, lcp-server repository, and this new version has been sufficiently tested to now be ready for production. For existing users, moving from LCP Server v1 to v2 is not recommended in 2026. The two codebases are functionally equivalent, but there is no ETL (Extract Transform Load) procedure ready yet.

Prerequisites

Binaries are only pre-built on demand and for a service fee, therefore in the general case you'll need to get a working Golang installation. Please refer to the official Go documentation for installation procedures at https://golang.org/.

This software is working with go 1.19 or higher. It is currently maintained using go 1.21 (February 2024).

You must put in place:

1/ the License Server, active in your intranet, not accessible from the Web, only accessible from your CMS via a REST API.

2/ the Status Server, accessible from the Web via a REST API, using https (you'll need to install a reverse proxy).

3/ a License Gateway, i.e. a piece of sofware you'll have to develop, which takes a request for an existing LCP license from a reading app, interrogates your database in order to get user information relative to this license, calls the License Server endpoint and returns this fresh LCP license back to the caller app (more information in the project Wiki).

4/ a large storage volume for encrypted publications. It can be either a file system accessible from the Web via HTTP URLs, or an S3 bucket. Note that publications are encrypted once: every license generated for such publication is pointing at the same encrypted file. Because these publications are stronlgy encrypted and the decryption key is secured in your SQL database, public access to these files is not problematic.

The servers require the setup of an SQL Database.

  • SQLite is sufficient for most needs. If the "database" property of each server defines a sqlite3 driver, the db setup is dynamically achieved when the server runs for the first time. SQLite database creation scripts are also provided in the "dbmodel" folder in case they are useful. A warning: the lcpserverand lsdserver processes require separate database names, i.e. separate SQLite files.
  • MySQL, MS SQL and PostgreSQL database creation scripts are provided in the "dbmodel" folder. These scripts must be applied before launching the servers for the first time.

Encryption Profiles

Out of the box, this open-source software is using what we call the "basic" (or "test") LCP profile, i.e. a testing mode provided by the LCP open standard. Licenses generated with this "basic" profile are perfectly handled by reading applications based on Readium Mobile, as well as by Thorium Reader.

But this profile, because it is open, does not offer any security. Security is provided by a "production" profile, i.e. confidential crypto information and a personal X.509 certificate delivered to trusted implementers by EDRLab. EDRLab is the wordwide LCP Certification Authority. Licenses generated with the "production" profile are handled by any LCP compliant Reading System.

Executables

The server software is composed of several independant parts:

[lcpencrypt]

A command line utility for content encryption. This utility can be included in any processing pipeline.

lcpencrypt can:

  • Take an unprotected publication as input and generates an encrypted file as output.
  • Store the encrypted file into a file system or S3 bucket.
  • Notify the License server of the generation of the encrypted file.
  • Optionnaly, notify the CMS of the generation of the encrypted file.

[lcpserver]

A License server implements Readium Licensed Content Protection.

Its functionalities can only be accessed after client authentication.

Its private functionalities are:

  • Generate a license or returns a fresh license
  • Update the rights associated with a license
  • Get a list of licenses (optionally filtered by publication)

[lsdserver]

A Status Server implements Readium License Status Document.

Its public functionalities are:

  • Return a license status document
  • Process a device registration request
  • Process a lending return request
  • Process a lending renewal request

Its private functionalities (authentication required) are:

  • Be notified of the generation of a new license
  • Filter licenses by count of registered devices
  • List all registered devices for a given license
  • Revoke or cancel a license

[frontend]

A Frontend Test Server is also provided in the project. This is a demo server we developed to provide a micro-CMS and a user interface for testing LCP licenses. It is active on https://front-prod.edrlab.org/frontend/. We do not consider it production ready, we don't update it (despite evolutions in node, npm, and the multiple node modules used a dependencies) and it will disappear in the next major version of the codebase. The Frontend Test Server MUST NOT be used in production.

This is why the installation of the Frontend Test Server is not described in the following instructions.

Install

Assuming a working Go installation (go 1.16 or higher) ...

On Linux and MacOS: the easy route

Simply use the go install command.

bash
# fetch, build and install the different packages and their dependencies
go install github.com/readium/readium-lcp-server/lcpencrypt@latest
go install github.com/readium/readium-lcp-server/lcpserver@latest
go install github.com/readium/readium-lcp-server/lsdserver@latest

"@latest" can be replaced by a specific version, e.g. "@V1.8.0" (warning: use a capital V).

You should now find the generated binaries in $GOPATH/bin:

  • lcpencrypt: the command line encryption tool,
  • lcpserver: the license server,
  • lsdserver: the status server.

On Linux and MacOS: the developer's route

The project supports Go modules. Developers can therefore clone the codebase in the directory of their choice. This will be required to move the LCP Server to its production mode later.

Our recommendation is to use a structure like the one below:

|- 
 |-readium
   |- readium-lcp-server  // where the codebase is cloned
   |-   // see below, configuration 

Move to the readium directory and use:

bash
git clone https://github.com/readium/readium-lcp-server.git 

Then compile the code with:

bash
cd readium-lcp-server
go build -o $GOPATH/bin ./lcpencrypt
go build -o $GOPATH/bin ./lcpserver
go build -o $GOPATH/bin ./lsdserver

You should now find the generated binaries in $GOPATH/bin (or $GOBIN if this environment variable is set).

Note: on a Linux Alpine server, the addition of the musl tag is required for building lcpserver.

bash
go build -tags musl -o $GOPATH/bin ./lcpencrypt

On Windows 10

You must first install a GCC compiler in order to compile the SQLite module and to later move to "production mode". TDM-GCC gives great results.

Also, in the previous instructions, replace:

  • $GOPATH with %GOPATH%
  • forward slashes with backslashes in paths.

Configuration

Config structure

Our recommendation is to use a structure like the one below:

|- 
 |-readium
   |- readium-lcp-server  // where the codebase is cloned
   |- config          // where the configuration files and X509 certificates are maintained 
   |- db              // where the sqlite database files are stored (if sqlite is used) 
   |- tmp             // where temporary files are created

Environment variables

The server is controlled by a yaml configuration file (e.g. "config.yaml") stored in a convenient folder, eg. /usr/local/var/lcp.

The License Server and Status Server will search their configuration file in the go bin directory by default; but the path to the file should be changed using an environment variable:

  • READIUM_LCPSERVER_CONFIG for the License server
  • READIUM_LSDSERVER_CONFIG for the Status server

The value of the each global variable is an absolute path to the configuration file for the given server. The two servers may share the same configuration file (useful if they are executed on the same server) or each server may get its own configuration file; this is your choice.

Password file

The LCP and LSD servers also require authenticated API requests for some of their functionalities. A password file formatted as an Apache "htpasswd" file is used for such authentication data. The htpasswd file format is of the form:

bash
	User:$apr1$OMWGq53X$Qf17b.ezwEM947Vrr/oTh0

An example of password file generator is found here.

The password file may be shared between the LCP and LSD servers if the same credentials are used for both. The exact location and name of the file have no importance, as it will be referenced from the configuration file; but we recommand to name it htpasswd and place this file in the same folder as the configuration file, eg. /usr/local/var/lcp.

Certificate

The License server requires an X509 certificate and its associated private key. The exact location and name of these files have no importance, as they will be referenced from the configuration file; but we recommand to keep the file name of the file provided by EDRLab and place these files in a subfolder of the previous one, eg. /usr/local/var/lcp/cert.

A test certificate (cert-edrlab-test.pem) and private key (privkey-edrlab-test.pem) are provided in the test/cert directory of the project. These files are be used as long as the LCP server is configured in test mode (profile = basic). They are replaced by a provider specific certificate and private key when the server is moved to its production mode.

Quick-start configuration

A quick-start configuration meant only for test purposes is available in test/config.yaml. This file includes a default configuration for the the LCP, LSD and frontend servers.

  1. Create a `` folder, eg. /usr/local/var/lcp
  2. Copy the test/config.yaml file into LCP_HOME
  3. Replace any occurrence of `` in config.yaml with the absolute path to the LCP_HOME folder
  4. Setup the READIUM_*_CONFIG env variables, which must reference the configuration file
  5. Generate a password file and place it into LCP_HOME
  6. Create cert, db,

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Gogolanglcp

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言