finclip-app-manager/infrastructure/utils/sdkcore.h

145 lines
5.3 KiB
C
Raw Permalink Normal View History

2023-10-31 14:07:26 +08:00
#if defined(_MSC_VER) && (_MSC_VER >= 1000)
#pragma once
#endif
#ifndef _INC_FINCHAT_SDKCORE_INCLUDED
#define _INC_FINCHAT_SDKCORE_INCLUDED
#define _ENCODE_
#define _DECODE_
// #define _ENCODE_LICENSE_
#ifdef __cplusplus
extern "C"
{
#endif
#ifdef _ENCODE_
/**
* @brief license
*
* @param plainText license
* @param textLen license
* @param lpBuffer ()
* @param lpSize
*/
void encode(const unsigned char *plainText, unsigned int textLen, unsigned char *lpBuffer, unsigned int *lpSize);
/**
* @brief license
*
* @param plainText license
* @param textLen license
* @param lpBuffer ()
* @param lpSize
*/
void encodeBySM4(const unsigned char *plainText, unsigned int textLen, unsigned char *lpBuffer, unsigned int *lpSize);
#endif
#ifdef _DECODE_
/**
* @brief license
*
* @param base64Text license
* @param base64TextLen license
* @param lpBuffer ()
* @param lpSize
*/
void decode(const unsigned char *base64Text, unsigned int base64TextLen, unsigned char *lpBuffer, unsigned int *lpSize);
/**
* @brief license
*
* @param base64Text license
* @param base64TextLen license
* @param lpBuffer ()
* @param lpSize
*/
void decodeBySM4(const unsigned char *base64Text, unsigned int base64TextLen, unsigned char *lpBuffer, unsigned int *lpSize);
#endif
/**
* @brief key
*
* @param base64Text
* @param base64TextLen
* @param key key16
* @param keyLen key
* @param lpBuffer ()
* @param lpSize
*/
void decodeByKey(const unsigned char *base64Text, unsigned int base64TextLen, const unsigned char *key, unsigned int keyLen, unsigned char *lpBuffer, unsigned int *lpSize);
/**
* @brief key
*
* @param plainText
* @param plainTextLen
* @param key key16
* @param keyLen key
* @param lpBuffer ()
* @param lpSize
*/
void encodeByKey(const unsigned char *plainText, unsigned int plainTextLen, const unsigned char *key, unsigned int keyLen, unsigned char *lpBuffer, unsigned int *lpSize);
/**
* @brief key
*
* @param base64Text
* @param base64TextLen
* @param key key16
* @param keyLen key
* @param lpBuffer ()
* @param lpSize
*/
void decodeBySM4Key(const unsigned char *base64Text, unsigned int base64TextLen, const unsigned char *key, unsigned int keyLen, unsigned char *lpBuffer, unsigned int *lpSize);
/**
* @brief key
*
* @param plainText
* @param plainTextLen
* @param key key16
* @param keyLen key
* @param lpBuffer ()
* @param lpSize
*/
void encodeBySM4Key(const unsigned char *plainText, unsigned int textLen, const unsigned char *key, unsigned int keyLen, unsigned char *lpBuffer, unsigned int *lpSize);
#ifdef _ENCODE_LICENSE_
void encodeLicense(const unsigned char *plainText, unsigned int textLen, unsigned char *lpBuffer, unsigned int *lpSize);
void encodeLicenseBySM4(const unsigned char *plainText, unsigned int textLen, unsigned char *lpBuffer, unsigned int *lpSize);
#endif
void decodeLicense(const unsigned char *base64Text, unsigned int base64TextLen, unsigned char *lpBuffer, unsigned int *lpSize);
void decodeLicenseBySM4(const unsigned char *base64Text, unsigned int base64TextLen, unsigned char *lpBuffer, unsigned int *lpSize);
/**
* @brief sdkkey
*
* @param sdkkey sdkkey
* @param secret secret()
* @param secretLen
*/
void getSecretBySDKKey(const unsigned char *sdkkey,unsigned char *secret, unsigned int *secretLen);
/**
* @brief sdkkey
*
* @param sdkkey sdkkey
* @param secret secret()
* @param secretLen
*/
void getSecretBySM3SDKKey(const unsigned char *sdkkey,unsigned char *secret, unsigned int *secretLen);
/**
* @brief
*
* @param sdkkey sdkkey
* @param secret secret()
* @param secretLen
*/
void messageDigest(const unsigned char *message,unsigned int iLen, unsigned char *lpBuffer,unsigned int *lpSize);
void encodeAESContent(const unsigned char *plainText, unsigned int textLen, unsigned char *lpBuffer, unsigned int *lpSize);
void encodeSMContent(const unsigned char *plainText, unsigned int textLen, unsigned char *lpBuffer, unsigned int *lpSize);
void decodeAESContent(const unsigned char *base64Text, unsigned int base64TextLen, unsigned char *lpBuffer, unsigned int *lpSize);
void decodeSMContent(const unsigned char *base64Text, unsigned int base64TextLen, unsigned char *lpBuffer, unsigned int *lpSize);
#ifdef __cplusplus
}
#endif
#endif /* _INC_FINCHAT_SDKCORE_INCLUDED */