L

libvmod-blobsha256

Varnish module (VMOD) for creating SHA256 digests and hmacs with the VCL data type BLOB.

vmod_blobsha256

SHA256 digests and hmacs for the VCL blob type

Manual section: 3

SYNOPSIS

import blobsha256 [from "path"] ;

CONTENTS

  • hmac(BLOB)
  • blob(BLOB)
  • BLOB hashf(BLOB)
  • BLOB hmacf(BLOB, BLOB)
  • STRING version()

hmac

new OBJ = hmac(BLOB key)
Description
Creates an object that generates HMACs based on SHA256 and the given key.
Example
new key = blobcode.blob(BASE64, "a2V5"); new hmac = blobsha256.hmac(key.get());

hmac.hmac

BLOB hmac.hmac(BLOB msg)
Description
Returns the HMAC-SHA256 message authentication code for msg based on the key provided in the constructor.
Example
set req.http.hmac = hmac.hmac(blobcode.decode(BASE64, "Zm9v"));

blob

new OBJ = blob(BLOB blob)
Description
Creates an object that returns the SHA256 digest of the given blob.
Example
new key = blobcode.blob(BASE64, "Zm9v"); new foo = blobsha256.blob(key.get());

blob.hash

BLOB blob.hash()
Description
Returns the SHA256 digest for the blob given in the constructor.
Example
set req.http.X-Hash = blobcode.encode(BASE64, foo.hash());

hashf

BLOB hashf(BLOB msg)
Description
Returns the SHA256 digest for msg.

hmacf

BLOB hmacf(BLOB msg, BLOB key)
Description
Returns the SHA256 HMAC for msg based on key.

version

STRING version()
Description
Returns the version string for this VMOD.
Example
std.log("Using VMOD blobsha256 version " + blobsha256.version());

REQUIREMENTS

This version of the VMOD requires at least Varnish 5.1. See the project repository for versions that are compatible with other Varnish versions. COPYRIGHT =========

Copyright (c) 2016 UPLEX Nils Goroll Systemoptimierung
All rights reserved

Author: Geoffrey Simmons <geoffrey.simmons@uplex.de>

See LICENSE