Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Signatures

A signature scheme consists of three algorithms: key_gen, sign and vfy.

  • key_gen(): outputs a tuple (pk, sk) of public key and secret key,
  • sign(sk, m): takes in a secret key sk and a message m , and outputs a signature sig,
  • vfy(pk, m, sig): takes in a public key pk, a message m and a signature sig, and outputs true or false.

This general behavior is captured by the SignatureScheme trait. Similar to public-key encryption schemes, it is easy to setup a scheme to sign and verify messages once an implementation of the trait is given.

use qfall_schemes::signature::{SignatureScheme, fdh::FDHGPV};

fn signing_and_verifying() {
    // setup public parameters and generate key-pair
    let mut fdh = FDHGPV::setup(10, 512, 42);
    let (pk, sk) = fdh.key_gen();

    // sign and verify a message
    let sigma = fdh.sign("Hello World!".to_owned(), &sk, &pk);
    assert!(fdh.vfy("Hello World!".to_owned(), &sigma, &pk))
}

Among the implemented signature schemes are Full-Domain Hash (FDH) and Probabilistic FDH (PFDH) signature schemes that build upon a PSF. After several iterations, we decided to remove our initially completely generic implementation as it was not properly maintainable and too complicated to extend or build upon it. The current implementations fix the domains themselves rather than defining them via generics.

As the FDH signature scheme is stateful and requires storage, the signature scheme must also be serializable. A serialization looks as follows:

use qfall_math::{integer::MatZ, integer_mod_q::MatZq, rational::MatQ};
use qfall_schemes::signature::{SignatureScheme, fdh::FDHGPV};
use qfall_tools::primitive::psf::PSFGPV;

fn serialize_and_deserialize() {
    // setup public parameters and generate key-pair
    let mut fdh = FDHGPV::setup(10, 1024, 42);
    let (pk, sk) = fdh.key_gen();

    // sign one message
    let _ = fdh.sign("Hello World!".to_owned(), &sk, &pk);

    // serialize the signature scheme
    let fdh_string = serde_json::to_string(&fdh).unwrap();

    // deserialize the signature scheme together with the storage
    let fdh_deserialized: FDHGPV = serde_json::from_str(&fdh_string).unwrap();
}

The implemented lattice-based signature schemes can be found in the module qfall_schemes::signature.