Commit a1e61657 authored by Nils Goroll's avatar Nils Goroll

test

parent a38d3232
vmod_crypto.vcc
\ No newline at end of file
#-
# Copyright 2018 UPLEX Nils Goroll Systemoptimierung
# All rights reserved
#
# Author: Nils Goroll <nils.goroll@uplex.de>
#
# See LICENSE
#
$Module crypto 3 Varnish crypto Module
DESCRIPTION
===========
This vmod provides VCL access to cryptographic functions from the
_crypt_ library.
Example
::
import crypto;
sub vcl_init {
new v = crypto.verifier(sha256, {"
-----BEGIN PUBLIC KEY-----
...
-----END PUBLIC KEY-----
"});
}
sub vcl_deliver {
if (! v.update("data")) {
return (synth(500, "vmod_crypto error"));
}
if (! v.valid(blob.encode(BASE64URLNOPAD, "base64"))) {
return (synth(400, "invalid signature"));
}
}
} -start
$Object verifier(ENUM {md_null, md4, md5, sha1, sha224,
sha256, sha384, sha512, ripemd160, rmd160, whirlpool} digest,
STRING key)
Create an object to verify signatures created using _digest_ and
_key_.
The _key_ argument is a PEM-encoded public key specification.
The cryptographic method to be used and the key length are
automatically determined from _key_. Typically supported methods
comprise RSA and DSA.
$Method BOOL .update(STRING_LIST)
Add strings to the data to be verfied with the verifier object.
$Method BOOL .update_blob(BLOB)
Add a blob to the data to be verified with the verifier object.
$Method BOOL .reset()
Reset the verfication state as if previous calls to the update methods
had not happened.
$Method BOOL .valid(BLOB signature)
Check if _signature_ is a valid signature for the _verifier_ object
given the previous updates.
Note that after calling .valid(), .update can be called again to add
additional data, which can then be validated against a (different)
signature using another call to .valid().
SEE ALSO
========vcl\(7),varnishd\(1)
#-
# Copyright 2018 UPLEX Nils Goroll Systemoptimierung
# All rights reserved
#
# Author: Nils Goroll <nils.goroll@uplex.de>
#
# See LICENSE
#
$Module crypto 3 Varnish crypto Module
DESCRIPTION
===========
This vmod provides VCL access to cryptographic functions from the
_crypt_ library.
Example
::
import crypto;
sub vcl_init {
new v = crypto.verifier(sha256, {"
-----BEGIN PUBLIC KEY-----
...
-----END PUBLIC KEY-----
"});
}
sub vcl_deliver {
if (! v.update("data")) {
return (synth(500, "vmod_crypto error"));
}
if (! v.valid(blob.encode(BASE64URLNOPAD, "base64"))) {
return (synth(400, "invalid signature"));
}
}
} -start
$Object verifier(ENUM {md_null, md4, md5, sha1, sha224,
sha256, sha384, sha512, ripemd160, rmd160, whirlpool} digest,
STRING key)
Create an object to verify signatures created using _digest_ and
_key_.
The _key_ argument is a PEM-encoded public key specification.
The cryptographic method to be used and the key length are
automatically determined from _key_. Typically supported methods
comprise RSA and DSA.
$Method BOOL .update(STRING_LIST)
Add strings to the data to be verfied with the verifier object.
$Method BOOL .update_blob(BLOB)
Add a blob to the data to be verified with the verifier object.
$Method BOOL .reset()
Reset the verfication state as if previous calls to the update methods
had not happened.
$Method BOOL .valid(BLOB signature)
Check if _signature_ is a valid signature for the _verifier_ object
given the previous updates.
Note that after calling .valid(), .update can be called again to add
additional data, which can then be validated against a (different)
signature using another call to .valid().
SEE ALSO
========vcl\(7),varnishd\(1)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment