首页 > 代码库 > 加密狗的管理层API(C#代码)
加密狗的管理层API(C#代码)
using System; using System.Collections.Generic; using System.Text; using System.Runtime.InteropServices; //class NT88API //{ ////查找加密锁 // [DllImport("NT88.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] // public static extern int NTFindFirst(string NTCode); ////查询硬件ID // [DllImport("NT88.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] // public static extern int NTGetHardwareID(StringBuilder hardwareID); ////登录加密锁 // [DllImport("NT88.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] // public static extern int NTLogin(string NTpassword); ////存储区数据读取 // [DllImport("NT88.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] // public static extern int NTRead(int address, int Length, byte[] pData); ////存储区数据写入 // [DllImport("NT88.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] // public static extern int NTWrite(int address, int Length, byte[] pData); ////3DES解密 // [DllImport("NT88.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] // public static extern int NT3DESCBCDecrypt(byte[] vi, byte[] pDataBuffer, int Length); ////3DES加密 // [DllImport("NT88.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] // public static extern int NT3DESCBCEncrypt(byte[] vi, byte[] pDataBuffer, int Length); ////验证许可证 // [DllImport("NT88.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] // public static extern int NTCheckLicense(int licenseCode); ////登出加密锁 // [DllImport("NT88.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] // public static extern int NTLogout(); // #region 管理员API ////验证管理员密码 // [DllImport("NT88.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] // public static extern int NTCheckSuperPin(string superPin); // #endregion //} class NT88API { #region 管理员用法 //查找所有加密锁,只有找到加密锁才能其他操作,NTFindAll必须第一个执行 [DllImport("NT88Mgr.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] public static extern int NTFindAll(int[] NTHandle, int[] nKeyNum); /// <summary> /// 获取加密锁硬件属性 /// </summary> /// <param name="NTHandle">加密锁handle</param> /// <param name="keyMode">加密锁型号</param> /// <param name="keyVersion">硬件版本</param> /// <param name="e2size">存储区大小</param> /// <param name="ramSize">内存区大小</param> /// <param name="prouctionTime">生产日期</param> /// <returns></returns> [DllImport("NT88Mgr.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] public static extern int NTGetDevCaps(int NTHandle, int[] keyMode, int[] keyVersion, int[] e2size, int[] ramSize, byte[] prouctionTime); //获取硬件序列号 [DllImport("NT88Mgr.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] public static extern int NTGetHarddwareID(int NTHandle, string hardwareID); //检测管理密码 [DllImport("NT88Mgr.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] public static extern int NTCheckSuperPin(int NTHandle, string superin); //修改加密锁管理密码 [DllImport("NT88Mgr.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] public static extern int NTSetSuperPin(int NTHandle, string newSPin); //修改加密锁登录密码 [DllImport("NT88Mgr.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] public static extern int NTSetUserPin(int NTHandle, string superin, string seed, StringBuilder userPin); //修改加密锁识别码 [DllImport("NT88Mgr.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] public static extern int NTSetAppName(int NTHandle, StringBuilder NTCode); //获得加密锁识别码 [DllImport("NT88Mgr.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] public static extern int NTGetAppName(int NTHandle, StringBuilder NTCode); //读取存储区数据 [DllImport("NT88Mgr.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] public static extern int NTRead(int NTHandle, int address, int length, byte[] pData); //读写存储区数据 [DllImport("NT88Mgr.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] public static extern int NTWrite(int NTHandle, int address, int length, byte[] pData); //获取许可证标识及验证码 [DllImport("NT88Mgr.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] public static extern int NTGetLicenseSettings(int NTHandle, byte[] licenseOption, int[] licenseCode, int licOptionNumber); //设置许可证标识,同时计算出验证码 [DllImport("NT88Mgr.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] public static extern int NTGenLicenseCodes(int NTHandle, byte[] licenseOption, int[] licenseCode, int licOptionNumber); //验证许可证,输入相应额验证码进行验证 [DllImport("NT88Mgr.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] public static extern int NTCheckLicense(int NTHandle, int licenseCode); //3DES加密 [DllImport("NT88Mgr.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] public static extern int NT3DESCBCEncrypt(int NTHandle, byte[] iv, byte[] pDataBuffer, int length); //3DES设置 [DllImport("NT88Mgr.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] public static extern int NTSet3DESKey(int NTHandle, byte[] key); //3DES解密 [DllImport("NT88Mgr.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] public static extern int NT3DESCBCDecrypt(int NTHandle, byte[] iv, byte[] pDataBuffer, int length); //查询硬件ID [DllImport("NT88Mgr.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] public static extern int NTGetHardwareID(int NTHandle, StringBuilder hardwareID); #endregion /*****************************************/ #region 应用层 //查找加密锁 [DllImport("NT88.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] public static extern int NTFindFirst(string NTCode); //查询硬件ID [DllImport("NT88.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] public static extern int NTGetHardwareID(StringBuilder hardwareID); //登录加密锁 [DllImport("NT88.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] public static extern int NTLogin(string NTpassword); //存储区数据读取 [DllImport("NT88.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] public static extern int NTRead(int address, int Length, byte[] pData); //存储区数据写入 [DllImport("NT88.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] public static extern int NTWrite(int address, int Length, byte[] pData); //3DES解密 [DllImport("NT88.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] public static extern int NT3DESCBCDecrypt(byte[] vi, byte[] pDataBuffer, int Length); //3DES加密 [DllImport("NT88.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] public static extern int NT3DESCBCEncrypt(byte[] vi, byte[] pDataBuffer, int Length); //验证许可证 [DllImport("NT88.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] public static extern int NTCheckLicense(int licenseCode); //登出加密锁 [DllImport("NT88.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] public static extern int NTLogout(); #endregion }
加密狗的管理层API(C#代码)
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。