/*
 * crypt.h ---- Key management and data encryption/decryption.
 */

#ifndef CRYPT__H
#define CRYPT__H

void  des(unsigned char *output, const unsigned char *input, const unsigned char *key, int direction);
void  atob (unsigned char *bcd_buf, const char *ascii_buf, int len);
void  btoa (char *ascii_buf, const unsigned char *bcd_buf, int len);
void  EncryptPIN (unsigned char cipher[], const char plain[], const char pan[], const unsigned char pin_key[]);
void  DecryptPIN (char plain[], const unsigned char cipher[], const char pan[], const unsigned char pin_key[]);
void  CalcMAC (char mac[], const char data[], const unsigned char mac_key[]);
void  CalcMAC1 (unsigned char mac[], const unsigned char data[], int len, const unsigned char mac_key[]);
void  EncryptKey (char cipher[], const unsigned char plain[]);
void  DecryptKey (unsigned char plain[], const char cipher[]);

typedef enum _des_crypt_mode{
  _DES_ENCRYPT_ = 0,
  _DES_DECRYPT_
}_DesMode;

void DesCrypt(
unsigned char *Output /*8 bytes*/,
unsigned char *Input /*8 bytes*/,
unsigned char *DesKey/*default=NULL.While using for user licenses control,can keep the default value*/,
unsigned char DesMode/*encrpt or decrypt,refer to enum _DesMode*/);
#endif
