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>
Get the decrypted version of the resource metadata. If the resource is not encrypted, this method simply returns the passed instance.
Get a decrypted version of the response. If the resource is not encrypted, this method simply returns the passed instance.
The resource response to decrypt
Get a named encryption method implementation from this DrmManager instance.
Get all encryption methods added to this DrmManager.
Get the XML encryption info object which defines which resources are encrypted and with what encryption method.
Check if a resource is encrypted and needs to be decrypted before consumption.
true if the resource is encrypted, false otherwise.
Remove an encryption method implementation from this DrmManager instance.
Set the XML encryption info object which defines which resources are encrypted and with what encryption method.
Generated using TypeDoc
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.
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.