Options
All
  • Public
  • Public/Protected
  • All
Menu

NOTE: This API is in early development and will probably change before the final 1.0 release.

The DRM manager is used to decrypt publication resources.

At this moment, the DrmManager is specific to the encryption features present in the EPUB OCF specification: https://www.w3.org/publishing/epub3/epub-ocf.html#sec-container-metainf-encryption.xml

The DRM manager does not have any built-in implementation of encryption methods. Instead, you are required to add the specific encryption method implementations using the addEncryptionMethod() method.

example

EPUB: Add support for the font obfuscation method defined in the OCF specification

... let epubOcf = await OcfResourceProvider.createFromBlob(epubFile); let drmManager = epubOcf.getDrmManager(); drmManager.addEncryptionMethod(new IdpfObfuscationEncryptionMethod(epubOcf)); // epubOcf will now give us the de-obfuscated resource data, for the obfuscated files.

Hierarchy

  • DrmManager

Implements

Index

Constructors

constructor

Methods

addEncryptionMethod

  • Add an IEncryptionMethod implementation to this DrmManager instance.

    When a Resource is being requested using an OcfResourceProvider, the DrmManager will check if the Resource is present in the encryption.xml and find a matching IEncryptionMethod for decrypting the resource data.

    In this example the BKANT.TTF font is encrypted with the IPDF obfuscation algorithm. The DRM manager will look for an IEncryptionMethod implementation where IEncryptionMethod.getName() matches "http://www.idpf.org/2008/embedding". It will then use that IEncryptionMethod instance to decrypt the resource data.

     <enc:EncryptedData>
    <enc:EncryptionMethod Algorithm="http://www.idpf.org/2008/embedding"/>
    <enc:CipherData>
    <enc:CipherReference URI="EPUB/Fonts/BKANT.TTF"/>
    </enc:CipherData>
    </enc:EncryptedData>

    Parameters

    Returns void

getDecryptedResourceMetadata

getDecryptedResourceResponse

getEncryptionMethod

getEncryptionMethods

getXmlEncryptionInfo

isEncrypted

  • isEncrypted(url: URL): boolean
  • Check if a resource is encrypted and needs to be decrypted before consumption.

    Parameters

    • url: URL

    Returns boolean

    true if the resource is encrypted, false otherwise.

removeEncryptionMethod

  • removeEncryptionMethod(methodName: string): void
  • Remove an encryption method implementation from this DrmManager instance.

    Parameters

    • methodName: string

    Returns void

setXmlEncryptionInfo

Generated using TypeDoc