Skip to content

link hash SHA256 base64 encoding, and length integerΒ #57

@danielweck

Description

@danielweck

https://readium.org/lcp-specs/releases/lcp/latest.html#35-pointing-to-external-resources-the-links-object

length - Content length in octets - Integer

hash - SHA-256 hash of the resource - Base 64 encoded octet sequence

"example 3":

    { "rel": "publication",
      "href": "https://www.example.com/file.epub",
      "type": "application/epub+zip",
      "length": "264929",
      "hash": "8b752f93e5e73a3efff1c706c1c2e267dffc6ec01c382cbe2a6ca9bd57cc8378"
    },

...as you can see, the example shows hash as a hex-encoded value, not b64. Furthermore, length is a string, not an integer.

The Go implementation produces hash as hex-encoding, and length as number value:

See examples of LCP license JSONs generated by the Go implementation:

https://www.edrlab.org/readium-lcp/testing-readium-lcp-compliant-devices/

Suggested fix:

  1. replace "base64" with "hex encoding"
  2. fix the length example by replacing the string with an integer

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions