ID Chip Reader
des.h File Reference

Triple DES (3DES) encryption and decryption library header file. More...

#include "typedef.h"

Go to the source code of this file.

Data Structures

struct  des_context
 

Macros

#define CRYPTOGRAPHY_DES3_H_
 
#define MBEDTLS_DES_ENCRYPT   1
 
#define MBEDTLS_DES_DECRYPT   0
 
#define MBEDTLS_ERR_DES_INVALID_INPUT_LENGTH   0
 
#define USE_DES_EN   1
 
#define USE_DES_ECB_EN   1
 
#define USE_DES_CBC_EN   0
 
#define USE_3DES_EN   1
 
#define USE_3DES_ECB_EN   0
 
#define USE_3DES_CBC_EN   1
 
#define DES_INPUT_LENGTH   -0x0002
 
#define MBEDTLS_DES_KEY_SIZE   8
 
#define DES_KEY_SIZE   (8)
 
#define DES3_KEY2_SIZE   (16)
 
#define DES3_KEY3_SIZE   (24)
 

Functions

unsigned int des_ecb_encrypt (unsigned char *pout, unsigned char *pdata, unsigned int nlen, unsigned char *pkey)
 
unsigned int des_ecb_decrypt (unsigned char *pout, unsigned char *pdata, unsigned int nlen, unsigned char *pkey)
 
unsigned int des3_cbc_encrypt (unsigned char *pout, unsigned char *pdata, unsigned int nlen, unsigned char *pkey, unsigned int klen, unsigned char *piv)
 
unsigned int des3_cbc_decrypt (unsigned char *pout, unsigned char *pdata, unsigned int nlen, unsigned char *pkey, unsigned int klen, unsigned char *piv)
 

Detailed Description

Triple DES (3DES) encryption and decryption library header file.

Author
Khoa Nguyen

This header file provides APIs for Triple DES (3DES) encryption and decryption operations. The library supports both DES and 3DES algorithms, as well as Electronic Codebook (ECB) and Cipher Block Chaining (CBC) modes.

Supported algorithms and modes:

  • DES-ECB
  • DES-CBC
  • 3DES-ECB
  • 3DES-CBC

Macro Definition Documentation

◆ CRYPTOGRAPHY_DES3_H_

#define CRYPTOGRAPHY_DES3_H_

◆ DES3_KEY2_SIZE

#define DES3_KEY2_SIZE   (16)

◆ DES3_KEY3_SIZE

#define DES3_KEY3_SIZE   (24)

◆ DES_INPUT_LENGTH

#define DES_INPUT_LENGTH   -0x0002

◆ DES_KEY_SIZE

#define DES_KEY_SIZE   (8)

◆ MBEDTLS_DES_DECRYPT

#define MBEDTLS_DES_DECRYPT   0

◆ MBEDTLS_DES_ENCRYPT

#define MBEDTLS_DES_ENCRYPT   1

◆ MBEDTLS_DES_KEY_SIZE

#define MBEDTLS_DES_KEY_SIZE   8

◆ MBEDTLS_ERR_DES_INVALID_INPUT_LENGTH

#define MBEDTLS_ERR_DES_INVALID_INPUT_LENGTH   0

◆ USE_3DES_CBC_EN

#define USE_3DES_CBC_EN   1

◆ USE_3DES_ECB_EN

#define USE_3DES_ECB_EN   0

◆ USE_3DES_EN

#define USE_3DES_EN   1

◆ USE_DES_CBC_EN

#define USE_DES_CBC_EN   0

◆ USE_DES_ECB_EN

#define USE_DES_ECB_EN   1

◆ USE_DES_EN

#define USE_DES_EN   1

Function Documentation

◆ des3_cbc_decrypt()

unsigned int des3_cbc_decrypt ( unsigned char *  pout,
unsigned char *  pdata,
unsigned int  nlen,
unsigned char *  pkey,
unsigned int  klen,
unsigned char *  piv 
)

◆ des3_cbc_encrypt()

unsigned int des3_cbc_encrypt ( unsigned char *  pout,
unsigned char *  pdata,
unsigned int  nlen,
unsigned char *  pkey,
unsigned int  klen,
unsigned char *  piv 
)

◆ des_ecb_decrypt()

unsigned int des_ecb_decrypt ( unsigned char *  pout,
unsigned char *  pdata,
unsigned int  nlen,
unsigned char *  pkey 
)

◆ des_ecb_encrypt()

unsigned int des_ecb_encrypt ( unsigned char *  pout,
unsigned char *  pdata,
unsigned int  nlen,
unsigned char *  pkey 
)