Home | Documentation |
smdevp.h File Reference
updated Mon May 13 2024 by Robert van Engelen
|
#include "stdsoap2.h"
#include <openssl/evp.h>
#include <openssl/hmac.h>
#include <openssl/ssl.h>
#include <openssl/err.h>
Classes | |
struct | soap_smd_data |
The smdevp engine context data, which is hooked up to soap->data[0]. More... | |
Functions | |
SOAP_FMAC1 size_t SOAP_FMAC2 | soap_smd_size (int alg, const void *key) |
Returns the number of octets needed to store the digest or signature returned by soap_smd_end. More... | |
SOAP_FMAC1 int SOAP_FMAC2 | soap_smd_begin (struct soap *soap, int alg, const void *key, int keylen) |
Initiates a digest or signature computation. More... | |
SOAP_FMAC1 int SOAP_FMAC2 | soap_smd_end (struct soap *soap, char *buf, int *len) |
Completes a digest or signature computation. Also deallocates temporary storage allocated by soap_smd_begin(), so MUST be called after soap_smd_begin(). More... | |
SOAP_FMAC1 int SOAP_FMAC2 | soap_smd_init (struct soap *soap, struct soap_smd_data *data, int alg, const void *key, int keylen) |
Initiates a (signed) digest computation. More... | |
SOAP_FMAC1 int SOAP_FMAC2 | soap_smd_update (struct soap *soap, struct soap_smd_data *data, const char *buf, size_t len) |
Updates (signed) digest computation with message part. More... | |
SOAP_FMAC1 int SOAP_FMAC2 | soap_smd_final (struct soap *soap, struct soap_smd_data *data, char *buf, int *len) |
Finalizes (signed) digest computation, delete context and returns digest or signature. More... | |
SOAP_FMAC1 void SOAP_FMAC2 | soap_smd_cleanup (struct soap *soap, struct soap_smd_data *data) |
Clear (signed) digest computation and delete context. More... | |
#define SOAP_SMD_ALGO (0x0030) |
#define SOAP_SMD_DGST (0x10) |
Digest ALGO
#define SOAP_SMD_DGST_MD5 (SOAP_SMD_DGST | SOAP_SMD_MD5) |
DGST-MD5 digest algorithm
#define SOAP_SMD_DGST_SHA1 (SOAP_SMD_DGST | SOAP_SMD_SHA1) |
DGST-SHA1 digest algorithm
#define SOAP_SMD_DGST_SHA224 (SOAP_SMD_DGST | SOAP_SMD_SHA224) |
DGST-SHA224 digest algorithm
#define SOAP_SMD_DGST_SHA256 (SOAP_SMD_DGST | SOAP_SMD_SHA256) |
DGST-SHA256 digest algorithm
#define SOAP_SMD_DGST_SHA384 (SOAP_SMD_DGST | SOAP_SMD_SHA384) |
DGST-SHA384 digest algorithm
#define SOAP_SMD_DGST_SHA512 (SOAP_SMD_DGST | SOAP_SMD_SHA512) |
DGST-SHA512 digest algorithm
#define SOAP_SMD_DSA (0x40) |
DSA Sign/Verify ALGO
#define SOAP_SMD_ECDSA (0x80) |
ECDSA Sign/Verify ALGO
#define SOAP_SMD_HASH (0x000F) |
#define SOAP_SMD_HMAC (0x00) |
HMAC ALGO
#define SOAP_SMD_HMAC_MD5 (SOAP_SMD_HMAC | SOAP_SMD_MD5) |
HMAC-MD5 shared key signature algorithm
#define SOAP_SMD_HMAC_SHA1 (SOAP_SMD_HMAC | SOAP_SMD_SHA1) |
HMAC-SHA1 shared key signature algorithm
#define SOAP_SMD_HMAC_SHA224 (SOAP_SMD_HMAC | SOAP_SMD_SHA224) |
HMAC-SHA224 shared key signature algorithm
#define SOAP_SMD_HMAC_SHA256 (SOAP_SMD_HMAC | SOAP_SMD_SHA256) |
HMAC-SHA256 shared key signature algorithm
#define SOAP_SMD_HMAC_SHA384 (SOAP_SMD_HMAC | SOAP_SMD_SHA384) |
HMAC-SHA384 shared key signature algorithm
#define SOAP_SMD_HMAC_SHA512 (SOAP_SMD_HMAC | SOAP_SMD_SHA512) |
HMAC-SHA512 shared key signature algorithm
#define SOAP_SMD_KEY_TYPE EVP_PKEY |
Expose EVP_PKEY in a portable representation
#define SOAP_SMD_MASK (0x01FF) |
#define SOAP_SMD_MAX_SIZE EVP_MAX_MD_SIZE |
Expose EVP_MAX_MD_SIZE in a portable representation
#define SOAP_SMD_MD5 (0x00) |
MD5 HASH
#define SOAP_SMD_MD5_SIZE (16) |
MD5 digest size in octets
#define SOAP_SMD_NONE (0x0000) |
#define SOAP_SMD_PASSTHRU (0x100) |
Additional flag: msg sends will pass through digest/signature algorithm
#define SOAP_SMD_SHA1 (0x01) |
SHA1 HASH
#define SOAP_SMD_SHA1_SIZE (20) |
SHA1 digest size in octets
#define SOAP_SMD_SHA224 (0x02) |
SHA224 HASH
#define SOAP_SMD_SHA224_SIZE (28) |
SHA224 digest size in octets
#define SOAP_SMD_SHA256 (0x03) |
SHA256 HASH
#define SOAP_SMD_SHA256_SIZE (32) |
SHA256 digest size in octets
#define SOAP_SMD_SHA384 (0x04) |
SHA384 HASH
#define SOAP_SMD_SHA384_SIZE (48) |
SHA384 digest size in octets
#define SOAP_SMD_SHA512 (0x05) |
SHA512 HASH
#define SOAP_SMD_SHA512_SIZE (64) |
SHA512 digest size in octets
#define SOAP_SMD_SIGN (0x20) |
Sign ALGO
#define SOAP_SMD_SIGN_DSA_MD5 (SOAP_SMD_SIGN | SOAP_SMD_DSA | SOAP_SMD_MD5) |
DSA-MD5 secret key signature algorithm
#define SOAP_SMD_SIGN_DSA_SHA1 (SOAP_SMD_SIGN | SOAP_SMD_DSA | SOAP_SMD_SHA1) |
DSA-SHA1 secret key signature algorithm
#define SOAP_SMD_SIGN_DSA_SHA224 (SOAP_SMD_SIGN | SOAP_SMD_DSA | SOAP_SMD_SHA224) |
DSA-SHA224 secret key signature algorithm
#define SOAP_SMD_SIGN_DSA_SHA256 (SOAP_SMD_SIGN | SOAP_SMD_DSA | SOAP_SMD_SHA256) |
DSA-SHA256 secret key signature algorithm
#define SOAP_SMD_SIGN_DSA_SHA384 (SOAP_SMD_SIGN | SOAP_SMD_DSA | SOAP_SMD_SHA384) |
DSA-SHA384 secret key signature algorithm
#define SOAP_SMD_SIGN_DSA_SHA512 (SOAP_SMD_SIGN | SOAP_SMD_DSA | SOAP_SMD_SHA512) |
DSA-SHA512 secret key signature algorithm
#define SOAP_SMD_SIGN_ECDSA_MD5 (SOAP_SMD_SIGN | SOAP_SMD_ECDSA | SOAP_SMD_MD5) |
ECDSA-MD5 secret key signature algorithm
#define SOAP_SMD_SIGN_ECDSA_SHA1 (SOAP_SMD_SIGN | SOAP_SMD_ECDSA | SOAP_SMD_SHA1) |
ECDSA-SHA1 secret key signature algorithm
#define SOAP_SMD_SIGN_ECDSA_SHA224 (SOAP_SMD_SIGN | SOAP_SMD_ECDSA | SOAP_SMD_SHA224) |
ECDSA-SHA224 secret key signature algorithm
#define SOAP_SMD_SIGN_ECDSA_SHA256 (SOAP_SMD_SIGN | SOAP_SMD_ECDSA | SOAP_SMD_SHA256) |
ECDSA-SHA256 secret key signature algorithm
#define SOAP_SMD_SIGN_ECDSA_SHA384 (SOAP_SMD_SIGN | SOAP_SMD_ECDSA | SOAP_SMD_SHA384) |
ECDSA-SHA384 secret key signature algorithm
#define SOAP_SMD_SIGN_ECDSA_SHA512 (SOAP_SMD_SIGN | SOAP_SMD_ECDSA | SOAP_SMD_SHA512) |
ECDSA-SHA512 secret key signature algorithm
#define SOAP_SMD_SIGN_RSA_MD5 (SOAP_SMD_SIGN | SOAP_SMD_MD5) |
RSA-MD5 secret key signature algorithm
#define SOAP_SMD_SIGN_RSA_SHA1 (SOAP_SMD_SIGN | SOAP_SMD_SHA1) |
RSA-SHA1 secret key signature algorithm
#define SOAP_SMD_SIGN_RSA_SHA224 (SOAP_SMD_SIGN | SOAP_SMD_SHA224) |
RSA-SHA224 secret key signature algorithm
#define SOAP_SMD_SIGN_RSA_SHA256 (SOAP_SMD_SIGN | SOAP_SMD_SHA256) |
RSA-SHA256 secret key signature algorithm
#define SOAP_SMD_SIGN_RSA_SHA384 (SOAP_SMD_SIGN | SOAP_SMD_SHA384) |
RSA-SHA384 secret key signature algorithm
#define SOAP_SMD_SIGN_RSA_SHA512 (SOAP_SMD_SIGN | SOAP_SMD_SHA512) |
RSA-SHA512 secret key signature algorithm
#define SOAP_SMD_VRFY (0x30) |
Verify ALGO
#define SOAP_SMD_VRFY_DSA_MD5 (SOAP_SMD_VRFY | SOAP_SMD_DSA | SOAP_SMD_MD5) |
DSA-MD5 secret key signature verification algorithm
#define SOAP_SMD_VRFY_DSA_SHA1 (SOAP_SMD_VRFY | SOAP_SMD_DSA | SOAP_SMD_SHA1) |
DSA-SHA1 secret key signature verification algorithm
#define SOAP_SMD_VRFY_DSA_SHA224 (SOAP_SMD_VRFY | SOAP_SMD_DSA | SOAP_SMD_SHA224) |
DSA-SHA224 secret key signature verification algorithm
#define SOAP_SMD_VRFY_DSA_SHA256 (SOAP_SMD_VRFY | SOAP_SMD_DSA | SOAP_SMD_SHA256) |
DSA-SHA256 secret key signature verification algorithm
#define SOAP_SMD_VRFY_DSA_SHA384 (SOAP_SMD_VRFY | SOAP_SMD_DSA | SOAP_SMD_SHA384) |
DSA-SHA384 secret key signature verification algorithm
#define SOAP_SMD_VRFY_DSA_SHA512 (SOAP_SMD_VRFY | SOAP_SMD_DSA | SOAP_SMD_SHA512) |
DSA-SHA512 secret key signature verification algorithm
#define SOAP_SMD_VRFY_ECDSA_MD5 (SOAP_SMD_VRFY | SOAP_SMD_ECDSA | SOAP_SMD_MD5) |
ECDSA-MD5 secret key signature verification algorithm
#define SOAP_SMD_VRFY_ECDSA_SHA1 (SOAP_SMD_VRFY | SOAP_SMD_ECDSA | SOAP_SMD_SHA1) |
ECDSA-SHA1 secret key signature verification algorithm
#define SOAP_SMD_VRFY_ECDSA_SHA224 (SOAP_SMD_VRFY | SOAP_SMD_ECDSA | SOAP_SMD_SHA224) |
ECDSA-SHA224 secret key signature verification algorithm
#define SOAP_SMD_VRFY_ECDSA_SHA256 (SOAP_SMD_VRFY | SOAP_SMD_ECDSA | SOAP_SMD_SHA256) |
ECDSA-SHA256 secret key signature verification algorithm
#define SOAP_SMD_VRFY_ECDSA_SHA384 (SOAP_SMD_VRFY | SOAP_SMD_ECDSA | SOAP_SMD_SHA384) |
ECDSA-SHA384 secret key signature verification algorithm
#define SOAP_SMD_VRFY_ECDSA_SHA512 (SOAP_SMD_VRFY | SOAP_SMD_ECDSA | SOAP_SMD_SHA512) |
ECDSA-SHA512 secret key signature verification algorithm
#define SOAP_SMD_VRFY_RSA_MD5 (SOAP_SMD_VRFY | SOAP_SMD_MD5) |
RSA-MD5 secret key signature verification algorithm
#define SOAP_SMD_VRFY_RSA_SHA1 (SOAP_SMD_VRFY | SOAP_SMD_SHA1) |
RSA-SHA1 secret key signature verification algorithm
#define SOAP_SMD_VRFY_RSA_SHA224 (SOAP_SMD_VRFY | SOAP_SMD_SHA224) |
RSA-SHA224 secret key signature verification algorithm
#define SOAP_SMD_VRFY_RSA_SHA256 (SOAP_SMD_VRFY | SOAP_SMD_SHA256) |
RSA-SHA256 secret key signature verification algorithm
#define SOAP_SMD_VRFY_RSA_SHA384 (SOAP_SMD_VRFY | SOAP_SMD_SHA384) |
RSA-SHA384 secret key signature verification algorithm
#define SOAP_SMD_VRFY_RSA_SHA512 (SOAP_SMD_VRFY | SOAP_SMD_SHA512) |
RSA-SHA512 secret key signature verification algorithm
int soap_smd_begin | ( | struct soap * | soap, |
int | alg, | ||
const void * | key, | ||
int | keylen | ||
) |
Initiates a digest or signature computation.
soap | context | |
[in] | alg | is the digest or signature (sign/verification) algorithm used |
[in] | key | is a HMAC key or pointer to EVP_PKEY object or NULL for digests |
[in] | keylen | is the length of the HMAC key or 0 |
void soap_smd_cleanup | ( | struct soap * | soap, |
struct soap_smd_data * | data | ||
) |
Clear (signed) digest computation and delete context.
soap | context | |
[in,out] | data | smdevp engine context |
int soap_smd_end | ( | struct soap * | soap, |
char * | buf, | ||
int * | len | ||
) |
Completes a digest or signature computation. Also deallocates temporary storage allocated by soap_smd_begin(), so MUST be called after soap_smd_begin().
soap | context | |
[in] | buf | contains signature for verification (when using a SOAP_SMD_VRFY algorithm) or NULL for cleanup |
[out] | buf | is populated with the digest or signature with maximum length soap_smd_size(alg, key) |
[in] | len | points to length of signature to verify (when using a SOAP_SMD_VRFY algorithm) or NULL for cleanup |
[out] | len | points to length of stored digest or signature (when not NULL) |
int soap_smd_final | ( | struct soap * | soap, |
struct soap_smd_data * | data, | ||
char * | buf, | ||
int * | len | ||
) |
Finalizes (signed) digest computation, delete context and returns digest or signature.
soap | context | |
[in,out] | data | smdevp engine context |
[in] | buf | contains signature for verification (SOAP_SMD_VRFY algorithms) maximum length soap_smd_size(alg, key) |
[out] | buf | is populated with the digest or signature of |
[in] | len | points to length of signature to verify (SOAP_SMD_VRFY algorithms) |
[out] | len | points to length of stored digest or signature (pass NULL if you are not interested in this value) |
int soap_smd_init | ( | struct soap * | soap, |
struct soap_smd_data * | data, | ||
int | alg, | ||
const void * | key, | ||
int | keylen | ||
) |
Initiates a (signed) digest computation.
soap | context | |
[in,out] | data | smdevp engine context |
[in] | alg | is algorithm to use |
[in] | key | is key to use or NULL for digests |
[in] | keylen | is length of HMAC key (when provided) |
size_t soap_smd_size | ( | int | alg, |
const void * | key | ||
) |
Returns the number of octets needed to store the digest or signature returned by soap_smd_end.
[in] | alg | is the digest or signature algorithm to be used |
[in] | key | is a pointer to an EVP_PKEY object for RSA/DSA signatures or NULL for digests and HMAC |
The values returned for digests are SOAP_SMD_MD5_SIZE, SOAP_SMD_SHA1_SIZE, SOAP_SMD_SHA256_SIZE, SOAP_SMD_SHA512_SIZE.
int soap_smd_update | ( | struct soap * | soap, |
struct soap_smd_data * | data, | ||
const char * | buf, | ||
size_t | len | ||
) |
Updates (signed) digest computation with message part.
soap | context | |
[in,out] | data | smdevp engine context |
[in] | buf | contains message part |
[in] | len | of message part |