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

PKCS #1 version 1.5 digital signature. 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 &, PkcsSignature::HashType)
 Sign the signature using a private key. More...
 
static void sign (const void *loc, int len, std::vector< char > &sig, const RsaPrivateKey &key, PkcsSignature::HashType hash)
 
static void sign (const void *loc, int len, std::vector< uint8_t > &sig, const RsaPrivateKey &key, PkcsSignature::HashType hash)
 
static bool verify (const void *, int, const void *, int, const RsaPublicKey &, PkcsSignature::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, PkcsSignature::HashType hash)
 

Detailed Description

PKCS #1 version 1.5 digital signature.

RSASSA-PKCS1-v1_5 https://tools.ietf.org/html/rfc8017#section-8.2 Notes on use in x.509: https://tools.ietf.org/html/rfc4055#page-13

rsa_pks1_sha256 is a required signature type for tls1_3, see https://tools.ietf.org/html/rfc5116

Definition at line 482 of file rsa.h.

Member Function Documentation

◆ sign()

static void scc::crypto::PkcsSignature::sign ( const void *  ,
int  ,
void *  ,
int  ,
const RsaPrivateKey ,
PkcsSignature::HashType   
)
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

Throws exception on parameter error.

◆ verify()

static bool scc::crypto::PkcsSignature::verify ( const void *  ,
int  ,
const void *  ,
int  ,
const RsaPublicKey ,
PkcsSignature::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: