OpenQuizz
Une application de gestion des contenus pédagogiques
Signer Class Reference
Inheritance diagram for Signer:
Collaboration diagram for Signer:

Public Member Functions

def __init__ (self, secret_key, salt=None, sep=".", key_derivation=None, digest_method=None, algorithm=None)
 
def derive_key (self)
 
def get_signature (self, value)
 
def sign (self, value)
 
def verify_signature (self, value, sig)
 
def unsign (self, signed_value)
 
def validate (self, signed_value)
 

Data Fields

 secret_key
 
 sep
 
 salt
 
 key_derivation
 
 digest_method
 
 algorithm
 

Static Public Attributes

 default_digest_method
 
 default_key_derivation
 

Detailed Description

This class can sign and unsign bytes, validating the signature
provided.

Salt can be used to namespace the hash, so that a signed string is
only valid for a given namespace. Leaving this at the default value
or re-using a salt value across different parts of your application
where the same signed value in one part can mean something different
in another part is a security risk.

See :ref:`the-salt` for an example of what the salt is doing and how
you can utilize it.

.. versionadded:: 0.14
    ``key_derivation`` and ``digest_method`` were added as arguments
    to the class constructor.

.. versionadded:: 0.18
    ``algorithm`` was added as an argument to the class constructor.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  secret_key,
  salt = None,
  sep = ".",
  key_derivation = None,
  digest_method = None,
  algorithm = None 
)

Member Function Documentation

◆ derive_key()

def derive_key (   self)
This method is called to derive the key. The default key
derivation choices can be overridden here. Key derivation is not
intended to be used as a security method to make a complex key
out of a short password. Instead you should use large random
secret keys.

◆ get_signature()

def get_signature (   self,
  value 
)
Returns the signature for the given value.

◆ sign()

def sign (   self,
  value 
)
Signs the given string.

Reimplemented in TimestampSigner.

◆ unsign()

def unsign (   self,
  signed_value 
)
Unsigns the given string.

◆ validate()

def validate (   self,
  signed_value 
)
Only validates the given signed value. Returns ``True`` if
the signature exists and is valid.

◆ verify_signature()

def verify_signature (   self,
  value,
  sig 
)
Verifies the signature for the given value.

Field Documentation

◆ algorithm

algorithm

◆ default_digest_method

default_digest_method
static

◆ default_key_derivation

default_key_derivation
static

◆ digest_method

digest_method

◆ key_derivation

key_derivation

◆ salt

salt

◆ secret_key

secret_key

◆ sep

sep

The documentation for this class was generated from the following file: