Coder Social home page Coder Social logo

peacedata0 / readium-lcp-client Goto Github PK

View Code? Open in Web Editor NEW

This project forked from readium/readium-lcp-client

0.0 1.0 0.0 12.85 MB

This repository is for the Readium Licenced Content Protection (LCP) client side implementation work.

License: BSD 3-Clause "New" or "Revised" License

Shell 4.74% Makefile 1.31% C++ 42.04% C 34.91% Java 0.33% Objective-C 0.54% Objective-C++ 0.39% CMake 0.85% Batchfile 0.26% Perl 2.46% Assembly 0.58% M4 3.05% Roff 5.84% Visual Basic 0.06% HTML 0.23% Awk 0.02% DIGITAL Command Language 1.23% Perl 6 0.06% Python 1.09%

readium-lcp-client's Introduction

readium-lcp-client

This repository is for the Readium Lightweight Content Protection (LCP) client side implementation work.

Created by Artem Brazhnikov, Mickaël Menu.

Overview

Cross-platform (iOS, Android and Windows) C++ decryption library for LCP protected documents.

  • Open and read metadata from a License Document.
  • Securely save User Keys on the device.
  • Handle License rights consumption (eg. Copy n characters).
  • Download a publication from a standalone LCPL file.
  • Implementation of a Content Filter compatible with Readium SDK to decrypt resources. With support for random access in media streams.

The library is a standalone solution and can be used without the Readium SDK. An optional Content Filter is available to add Readium compatiblity.

It is composed of several sub-projects:

  • LCP Client Library, which is the standalone LCP C++ client library
  • LCP Content Filter, an implementation of Readium SDK's Content Filter for LCP protected EPUB.
  • Obj-C bridge, for the public API of LcpCryptoLib, to use on iOS and OS X.

Getting Started

IDE projects are available for major supported platforms under platform/. Public headers to use in your application are put in include/.

Building for iOS

The Xcode project for Apple platforms is located in platform/apple/. An iOS target is part of this project.

By default the target will build the library with Readium's Content Filter. You have to set the path to the SDK in LCP Client.xcconfig > READIUM_PATH. Or set FEATURES_READIUM to 0 to remove any dependency to Readium.

Library API

This section summarizes the concept and main classes of the library. Please refer to the public headers in include/ for the documentation of individual API.

LCP Service

C++: lcp::ILcpService, Obj-C: LCPService

The LCP Service is the main gateway to the public API of the library. You must create an instance and initialize it with a LCP Root Certificate. Multiple instances with different configurations can live side-by-side.

The service is used to open a License from its JSON, acquire a new publication, decrypt content, add user keys and handle License rights consumption.

Providers

The LCP Service expects a number of Provider interface implementations at the initialization. These interfaces are here to make profit of specific platform tools, or remove dependency to third-party libraries (eg. cURL). For example, on iOS the implementation of IStorageProvider will use the iOS KeyChain to securely store rights consumption and User Keys. Also, the implementation of INetProvider will use NSURLSession instead of cURL.

The library offers a C++ cross-platform implementation of all providers, except for the IStorageProvider. If need to implement it your platform, make sure that data is securely stored.

  • IFileSystemProvider for IO operations on the file system.
  • INetProvider for HTTP network requests.
  • IStorageProvider for secure persistence of library's data.
  • ICryptoProvider for data decryption.

License

C++: lcp::ILicense, Obj-C: LCPLicense

The License object represents a single License Document (LCPL file). It is passed around to almost every other API.

All the metadata contained in the License Document will be available through the License object, thanks to its accessors.

Encryption

A License instance can be in two states: encrypted or decrypted. If its User Key was already stored in the device, the LCP Service will decrypt the License automatically on opening. Otherwise, the License will be in the state encrypted. Some APIs (eg. for decrypting content) need a decrypted License to operate.

Shared Instances

The owner of the License instance is the LCP Service that created it. And the same License object will be returned for subsequent calls using the same canonical JSON.

You can take profit of that to have different components of your application using the same License object. For example, the Readium Content Filter will open a License using the shared LCP Service, but will not try to decrypt it since it doesn't have any way to prompt the User for the passphrase. It is the host app that should ask the user for his passphrase, if needed, and decrypt the shared License instance.

Thread Safety

The library is thread-safe. The IValueIterator, IReadableStream, IWritableStream implementations are not thread-safe. They must be used only by one thread at a time.

Ownership Strategy

All the methods with Create prefix implement the Factory Method pattern. The client of such methods takes ownership of the returned pointer. Other methods just use pointers owned by the ILcpService instance.

Error Handling Strategy

The library returns the Status object to notify the client about LCP-specific errors. In other cases, when some error occurs inside of the library, STL exceptions can be thrown.

Attributions

Thanks to the following pieces of technology that made this library possible:

readium-lcp-client's People

Contributors

danielweck avatar 0xartem avatar mickael-menu-mantano avatar clebeaupin avatar artembrazhnikov avatar mickael-menu avatar drminside avatar

Watchers

James Cloos 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.