scclib
Stable Cloud Computing C++ Library
Public Types | Static Public Member Functions | List of all members
scc::crypto::PssSignature Class Reference

RSASSA-PSS https://tools.ietf.org/html/rfc8017#section-8.1 Notes on use in x.509: https://tools.ietf.org/html/rfc4055#section-3. More...

#include <rsa.h>

Public Types

enum class  HashType {
  md5 , sha1 , sha224 , sha256 ,
  sha384 , sha512
}
 

Static Public Member Functions

static int size (const RsaPublicKey &k)
 Size of signature in bytes.
 
static void sign (const void *, int, void *, int, const RsaPrivateKey &, PssSignature::HashType, int=0)
 Sign the signature using a private key. More...
 
static void sign (const void *loc, int len, std::vector< char > &sig, const RsaPrivateKey &key, PssSignature::HashType hash, int salt_len=0)
 
static bool verify (const void *, int, const void *, int, const RsaPublicKey &, PssSignature::HashType)
 Verify the signature using a public key. More...
 
static bool verify (const void *loc, int len, const std::vector< char > &sig, const RsaPublicKey &key, PssSignature::HashType hash)
 

Detailed Description

RSASSA-PSS https://tools.ietf.org/html/rfc8017#section-8.1 Notes on use in x.509: https://tools.ietf.org/html/rfc4055#section-3.

rsa_pss_rsae_sha256 is a required signature type for tls1_3.

Definition at line 415 of file rsa.h.

Member Function Documentation

◆ sign()

static void scc::crypto::PssSignature::sign ( const void *  ,
int  ,
void *  ,
int  ,
const RsaPrivateKey ,
PssSignature::HashType  ,
int  = 0 
)
static

Sign the signature using a private key.

Parameters
locMessage buffer
lenMessage buffer size
sig_locSignature buffer
sig_lenSignature buffer size, must be the size returned by size().
keyPrivate RSA key
hashHash type
salt_lenLength of randomly generated salt

Throws exception on parameter error.

According to https://tools.ietf.org/html/rfc3447, "Typical salt lengths in octets are hLen (the length of the output of the hash function Hash) and 0".

◆ verify()

static bool scc::crypto::PssSignature::verify ( const void *  ,
int  ,
const void *  ,
int  ,
const RsaPublicKey ,
PssSignature::HashType   
)
static

Verify the signature using a public key.

Parameters
locMessage buffer
lenMessage buffer size
sig_locSignature buffer
sig_lenSignature buffer size, must be the size returned by size().
keyPublic RSA key
hashHash type
Returns
True if signature matches, false if signature size or value do not match.

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