gSOAP WS-Security 2.8 Stable
Classes | Defines | Enumerations | Functions
/Users/engelen/Projects/gsoap/plugin/mecevp.h File Reference
#include "stdsoap2.h"
Include dependency graph for mecevp.h:
This graph shows which files directly or indirectly include this file:

Classes

struct  soap_mec_data
 The mecevp engine context data. More...

Defines

#define SOAP_MEC_KEY_TYPE   EVP_PKEY
#define SOAP_MEC_NONE   (0)
#define SOAP_MEC_DES_CBC   (0x0010)
#define SOAP_MEC_AES128_CBC   (0x0020)
#define SOAP_MEC_AES192_CBC   (0x0040)
#define SOAP_MEC_AES256_CBC   (0x0080)
#define SOAP_MEC_AES512_CBC   (0x0100)
#define SOAP_MEC_ENC   (0x1000)
#define SOAP_MEC_ENV   (0x2000)
#define SOAP_MEC_MASK   (0xFFFF)
#define SOAP_MEC_STORE   (0x010000)
#define SOAP_MEC_OAEP   (0x020000)
#define SOAP_MEC_ENC_DES_CBC   (SOAP_MEC_DES_CBC | SOAP_MEC_ENC)
#define SOAP_MEC_ENC_AES128_CBC   (SOAP_MEC_AES128_CBC | SOAP_MEC_ENC)
#define SOAP_MEC_ENC_AES192_CBC   (SOAP_MEC_AES192_CBC | SOAP_MEC_ENC)
#define SOAP_MEC_ENC_AES256_CBC   (SOAP_MEC_AES256_CBC | SOAP_MEC_ENC)
#define SOAP_MEC_ENC_AES512_CBC   (SOAP_MEC_AES512_CBC | SOAP_MEC_ENC)
#define SOAP_MEC_DEC_DES_CBC   (SOAP_MEC_DES_CBC)
#define SOAP_MEC_DEC_AES128_CBC   (SOAP_MEC_AES128_CBC)
#define SOAP_MEC_DEC_AES192_CBC   (SOAP_MEC_AES192_CBC)
#define SOAP_MEC_DEC_AES256_CBC   (SOAP_MEC_AES256_CBC)
#define SOAP_MEC_DEC_AES512_CBC   (SOAP_MEC_AES512_CBC)
#define SOAP_MEC_ENV_ENC_DES_CBC   (SOAP_MEC_ENC_DES_CBC | SOAP_MEC_ENV)
#define SOAP_MEC_ENV_ENC_AES128_CBC   (SOAP_MEC_ENC_AES128_CBC | SOAP_MEC_ENV)
#define SOAP_MEC_ENV_ENC_AES192_CBC   (SOAP_MEC_ENC_AES192_CBC | SOAP_MEC_ENV)
#define SOAP_MEC_ENV_ENC_AES256_CBC   (SOAP_MEC_ENC_AES256_CBC | SOAP_MEC_ENV)
#define SOAP_MEC_ENV_ENC_AES512_CBC   (SOAP_MEC_ENC_AES512_CBC | SOAP_MEC_ENV)
#define SOAP_MEC_ENV_DEC_DES_CBC   (SOAP_MEC_DEC_DES_CBC | SOAP_MEC_ENV)
#define SOAP_MEC_ENV_DEC_AES128_CBC   (SOAP_MEC_DEC_AES128_CBC | SOAP_MEC_ENV)
#define SOAP_MEC_ENV_DEC_AES192_CBC   (SOAP_MEC_DEC_AES192_CBC | SOAP_MEC_ENV)
#define SOAP_MEC_ENV_DEC_AES256_CBC   (SOAP_MEC_DEC_AES256_CBC | SOAP_MEC_ENV)
#define SOAP_MEC_ENV_DEC_AES512_CBC   (SOAP_MEC_DEC_AES512_CBC | SOAP_MEC_ENV)

Enumerations

enum  SOAP_MEC_STATE {
  SOAP_MEC_STATE_NONE, SOAP_MEC_STATE_INIT, SOAP_MEC_STATE_IV, SOAP_MEC_STATE_DECRYPT,
  SOAP_MEC_STATE_FINAL, SOAP_MEC_STATE_FLUSH
}

Functions

int soap_mec_begin (struct soap *soap, struct soap_mec_data *data, int alg, SOAP_MEC_KEY_TYPE *pkey, unsigned char *key, int *keylen)
 Initialize the mecevp engine data and begin encryption or decryption message sequence using a private/public key or symmetric secret key.
int soap_mec_start_alg (struct soap *soap, int alg, const unsigned char *key)
 Start encryption or decryption of current message. If key is non-NULL, use the symmetric triple DES key. Use soap_mec_start only after soap_mec_begin. The soap_mec_start should be followed by a soap_mec_stop call.
int soap_mec_start (struct soap *soap, const unsigned char *key)
 Start encryption or decryption of current message. If key is non-NULL, use the symmetric triple DES key. Use soap_mec_start only after soap_mec_begin. The soap_mec_start should be followed by a soap_mec_stop call.
int soap_mec_stop (struct soap *soap)
 Stops encryption or decryption of current message. Use after soap_mec_start.
int soap_mec_end (struct soap *soap, struct soap_mec_data *data)
 Ends encryption or decryption of a sequence of message parts that began with soap_mec_begin.
size_t soap_mec_size (int alg, SOAP_MEC_KEY_TYPE *pkey)
 Returns the number of octets needed to store the public/private key or the symmetric key, depending on the algorithm.
int soap_mec_init (struct soap *soap, struct soap_mec_data *data, int alg, SOAP_MEC_KEY_TYPE *pkey, unsigned char *key, int *keylen)
 Initialize mecevp engine state and create context for encryption/decryption algorithm using a private/public key or symmetric secret key.
int soap_mec_update (struct soap *soap, struct soap_mec_data *data, const char **s, size_t *n)
 Update mecevp engine state: encrypts plain text (or raw data) or decrypts cipher data in base64 format.
int soap_mec_final (struct soap *soap, struct soap_mec_data *data, const char **s, size_t *n)
 Ends mecevp engine state: encrypt/decrypt remainder from buffers.
void soap_mec_cleanup (struct soap *soap, struct soap_mec_data *data)
 Clean up mecevp engine and deallocate cipher context and buffers.

Define Documentation

#define SOAP_MEC_AES128_CBC   (0x0020)

Cipher type (AES128 CBC)

#define SOAP_MEC_AES192_CBC   (0x0040)

Cipher type (AES192 CBC)

#define SOAP_MEC_AES256_CBC   (0x0080)

Cipher type (AES256 CBC)

#define SOAP_MEC_AES512_CBC   (0x0100)

Cipher type (AES512 CBC)

#define SOAP_MEC_DEC_AES128_CBC   (SOAP_MEC_AES128_CBC)
#define SOAP_MEC_DEC_AES192_CBC   (SOAP_MEC_AES192_CBC)
#define SOAP_MEC_DEC_AES256_CBC   (SOAP_MEC_AES256_CBC)
#define SOAP_MEC_DEC_AES512_CBC   (SOAP_MEC_AES512_CBC)
#define SOAP_MEC_DEC_DES_CBC   (SOAP_MEC_DES_CBC)

Symmetric secret key decryption

#define SOAP_MEC_DES_CBC   (0x0010)

Cipher type (triple DES CBC)

#define SOAP_MEC_ENC   (0x1000)

Encode mode

#define SOAP_MEC_ENC_AES128_CBC   (SOAP_MEC_AES128_CBC | SOAP_MEC_ENC)
#define SOAP_MEC_ENC_AES192_CBC   (SOAP_MEC_AES192_CBC | SOAP_MEC_ENC)
#define SOAP_MEC_ENC_AES256_CBC   (SOAP_MEC_AES256_CBC | SOAP_MEC_ENC)
#define SOAP_MEC_ENC_AES512_CBC   (SOAP_MEC_AES512_CBC | SOAP_MEC_ENC)
#define SOAP_MEC_ENC_DES_CBC   (SOAP_MEC_DES_CBC | SOAP_MEC_ENC)

Symmetric secret key encryption

#define SOAP_MEC_ENV   (0x2000)

Envelope mode

#define SOAP_MEC_ENV_DEC_AES128_CBC   (SOAP_MEC_DEC_AES128_CBC | SOAP_MEC_ENV)
#define SOAP_MEC_ENV_DEC_AES192_CBC   (SOAP_MEC_DEC_AES192_CBC | SOAP_MEC_ENV)
#define SOAP_MEC_ENV_DEC_AES256_CBC   (SOAP_MEC_DEC_AES256_CBC | SOAP_MEC_ENV)
#define SOAP_MEC_ENV_DEC_AES512_CBC   (SOAP_MEC_DEC_AES512_CBC | SOAP_MEC_ENV)
#define SOAP_MEC_ENV_DEC_DES_CBC   (SOAP_MEC_DEC_DES_CBC | SOAP_MEC_ENV)

Envelope (using RSA private key) decryption

#define SOAP_MEC_ENV_ENC_AES128_CBC   (SOAP_MEC_ENC_AES128_CBC | SOAP_MEC_ENV)
#define SOAP_MEC_ENV_ENC_AES192_CBC   (SOAP_MEC_ENC_AES192_CBC | SOAP_MEC_ENV)
#define SOAP_MEC_ENV_ENC_AES256_CBC   (SOAP_MEC_ENC_AES256_CBC | SOAP_MEC_ENV)
#define SOAP_MEC_ENV_ENC_AES512_CBC   (SOAP_MEC_ENC_AES512_CBC | SOAP_MEC_ENV)
#define SOAP_MEC_ENV_ENC_DES_CBC   (SOAP_MEC_ENC_DES_CBC | SOAP_MEC_ENV)

Envelope (using RSA public key) encryption

#define SOAP_MEC_KEY_TYPE   EVP_PKEY

Expose EVP_PKEY in a portable representation

#define SOAP_MEC_MASK   (0xFFFF)

Mask

#define SOAP_MEC_NONE   (0)

Engine off

#define SOAP_MEC_OAEP   (0x020000)

RSA-OAEP padding

#define SOAP_MEC_STORE   (0x010000)

Enable store (in buffer) instead of streaming mode


Enumeration Type Documentation

Decryption engine states

Enumerator:
SOAP_MEC_STATE_NONE 
SOAP_MEC_STATE_INIT 
SOAP_MEC_STATE_IV 
SOAP_MEC_STATE_DECRYPT 
SOAP_MEC_STATE_FINAL 
SOAP_MEC_STATE_FLUSH 

Function Documentation

int soap_mec_begin ( struct soap *  soap,
struct soap_mec_data data,
int  alg,
SOAP_MEC_KEY_TYPE *  pkey,
unsigned char *  key,
int *  keylen 
)

Initialize the mecevp engine data and begin encryption or decryption message sequence using a private/public key or symmetric secret key.

Parameters:
soapcontext
[in,out]datamecevp engine context
[in]algencryption/decryption algorithm
[in]pkeypublic/private key or NULL
[in,out]keysecret key or encrypted ephemeral secret key set with envelope encryption, or NULL
[in,out]keylensecret key length
Returns:
SOAP_OK or error code
void soap_mec_cleanup ( struct soap *  soap,
struct soap_mec_data data 
)

Clean up mecevp engine and deallocate cipher context and buffers.

Parameters:
soapcontext
[in,out]datamecevp engine context
Returns:
SOAP_OK or SOAP_SSL_ERROR
int soap_mec_end ( struct soap *  soap,
struct soap_mec_data data 
)

Ends encryption or decryption of a sequence of message parts that began with soap_mec_begin.

Parameters:
soapcontext
[in,out]datamecevp engine context
Returns:
SOAP_OK or error code
int soap_mec_final ( struct soap *  soap,
struct soap_mec_data data,
const char **  s,
size_t *  n 
)

Ends mecevp engine state: encrypt/decrypt remainder from buffers.

Parameters:
soapcontext
[in,out]datamecevp engine context
[out]safterwards points to converted remaining data in streaming mode, or entire converted data in buffer mode (SOAP_MEC_STORE option)
[out]nafterwards size of remaining data
Returns:
SOAP_OK or SOAP_SSL_ERROR
int soap_mec_init ( struct soap *  soap,
struct soap_mec_data data,
int  alg,
SOAP_MEC_KEY_TYPE *  pkey,
unsigned char *  key,
int *  keylen 
)

Initialize mecevp engine state and create context for encryption/decryption algorithm using a private/public key or symmetric secret key.

Parameters:
soapcontext
[in,out]datamecevp engine context
[in]algencryption/decryption algorithm
[in]pkeypublic/private key or NULL
[in,out]keysecret key or encrypted ephemeral secret key set with envelope encryption, or NULL
[in,out]keylensecret key length
Returns:
SOAP_OK or SOAP_SSL_ERROR
size_t soap_mec_size ( int  alg,
SOAP_MEC_KEY_TYPE *  pkey 
)

Returns the number of octets needed to store the public/private key or the symmetric key, depending on the algorithm.

Parameters:
[in]algis the algorithm to be used
[in]pkeyis a pointer to an EVP_PKEY object or NULL for symmetric keys
Returns:
size_t number of octets that is needed to hold the key.
int soap_mec_start ( struct soap *  soap,
const unsigned char *  key 
)

Start encryption or decryption of current message. If key is non-NULL, use the symmetric triple DES key. Use soap_mec_start only after soap_mec_begin. The soap_mec_start should be followed by a soap_mec_stop call.

Parameters:
soapcontext
[in]keysecret triple DES key or NULL
Returns:
SOAP_OK or error code
int soap_mec_start_alg ( struct soap *  soap,
int  alg,
const unsigned char *  key 
)

Start encryption or decryption of current message. If key is non-NULL, use the symmetric triple DES key. Use soap_mec_start only after soap_mec_begin. The soap_mec_start should be followed by a soap_mec_stop call.

Parameters:
soapcontext
[in]algalgorithm
[in]keysecret triple DES key or NULL
Returns:
SOAP_OK or error code
int soap_mec_stop ( struct soap *  soap)

Stops encryption or decryption of current message. Use after soap_mec_start.

Parameters:
soapcontext
Returns:
SOAP_OK or error code
int soap_mec_update ( struct soap *  soap,
struct soap_mec_data data,
const char **  s,
size_t *  n 
)

Update mecevp engine state: encrypts plain text (or raw data) or decrypts cipher data in base64 format.

Parameters:
soapcontext
[in,out]datamecevp engine context
[in,out]sinput data to convert, afterwards points to converted data (original content is unchanged)
[in,out]nsize of input, afterwards size of output
Returns:
SOAP_OK or SOAP_SSL_ERROR