ITC81DB_2H/ITC81DB_0H/Part11_Encryption/Encryption.cs

43 lines
1.3 KiB
C#

using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace ITC81DB_0H.Part11_Encryption
{
public partial class Encryption
{
public delegate void ObjectEventHandler(object data);
public static event ObjectEventHandler DllAesEncryption_Event;
public static void InitializeEncryption()
{
// register callback
fnAesEncryptionCallBack = cbAesEncryption;
DLL_AES_Register_EncryptionCB(fnAesEncryptionCallBack);
// call the function
DLL_AES_Activation();
}
#region Aes_Fuction
public static void fAesEncryption(string inFileName, string outFileName, bool encrypt, bool compress)
{
IntPtr pInFileName = Marshal.StringToBSTR(inFileName);
IntPtr pOutFileName = Marshal.StringToBSTR(outFileName);
DLL_AES_Encryption(pInFileName, pOutFileName, encrypt, compress);
}
#endregion
#region Aes_Callback
public static void cbAesEncryption(ref auth_encryption_status_t encryption_status)
{
if (DllAesEncryption_Event != null)
DllAesEncryption_Event(encryption_status);
}
#endregion
}
}