|
|
|
|
using System;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Security.Cryptography;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Data.SqlClient;
|
|
|
|
|
using System.Threading;
|
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
|
|
|
|
|
namespace NetLibrary.Safety
|
|
|
|
|
{
|
|
|
|
|
/**//// <summary>
|
|
|
|
|
/// ˽Կ<CBBD><D4BF><EFBFBD><EFBFBD>(<28>ԳƼ<D4B3><C6BC><EFBFBD>)
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class CryptoPrivate
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private SymmetricAlgorithm mobjCryptoService;
|
|
|
|
|
private string Key;
|
|
|
|
|
/**//// <summary>
|
|
|
|
|
/// <20>ԳƼ<D4B3><C6BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĺ<EFBFBD><C4B9>캯<EFBFBD><ECBAAF>
|
|
|
|
|
/// <20><>Կ<EFBFBD><D4BF><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0>˾<EFBFBD><CBBE><EFBFBD>б<EFBFBD><D0B1>룬<EFBFBD><EBA3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ΪKey<65><79>
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="key"><3E><>Կ</param>
|
|
|
|
|
public CryptoPrivate(string key)
|
|
|
|
|
{
|
|
|
|
|
mobjCryptoService = new RijndaelManaged();
|
|
|
|
|
//mobjCryptoService.
|
|
|
|
|
Key=key;
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Կ
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns><3E><>Կ</returns>
|
|
|
|
|
private byte[] GetLegalKey()
|
|
|
|
|
{
|
|
|
|
|
string sTemp = Key;
|
|
|
|
|
mobjCryptoService.GenerateKey();
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Կ
|
|
|
|
|
byte[] bytTemp = mobjCryptoService.Key; //ȡ<><C8A1><EFBFBD><EFBFBD>Կ
|
|
|
|
|
int KeyLength = bytTemp.Length; //<2F><>Կ<EFBFBD><D4BF><EFBFBD><EFBFBD>
|
|
|
|
|
if (sTemp.Length > KeyLength) //<2F><><EFBFBD><EFBFBD><<<3C><>˾<EFBFBD><CBBE>־>><3E><><EFBFBD>ȴ<EFBFBD><C8B4><EFBFBD><EFBFBD><EFBFBD>Կ<EFBFBD><D4BF><EFBFBD>ȣ<EFBFBD><C8A3><EFBFBD><EFBFBD>س<EFBFBD><D8B3>ȵ<EFBFBD><C8B5><EFBFBD><EFBFBD><EFBFBD>Կ<EFBFBD><D4BF><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>
|
|
|
|
|
sTemp = sTemp.Substring(0, KeyLength);
|
|
|
|
|
else if (sTemp.Length < KeyLength) //<2F><><EFBFBD><EFBFBD><<<3C><>˾<EFBFBD><CBBE>־>><3E><><EFBFBD><EFBFBD>С<EFBFBD><D0A1><EFBFBD><EFBFBD>Կ<EFBFBD><D4BF><EFBFBD><EFBFBD><EFBFBD>ÿո<C3BF><D5B8><EFBFBD><EFBFBD>䵽<EFBFBD><E4B5BD>Կ<EFBFBD><D4BF><EFBFBD>賤<EFBFBD><E8B3A4>
|
|
|
|
|
sTemp = sTemp.PadRight(KeyLength, ' ');
|
|
|
|
|
return ASCIIEncoding.ASCII.GetBytes(sTemp); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Կ<EFBFBD><D4BF><EFBFBD><EFBFBD>
|
|
|
|
|
}
|
|
|
|
|
/**//// <summary>
|
|
|
|
|
/// <20><><EFBFBD>ó<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>IV
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IV</returns>
|
|
|
|
|
private byte[] GetLegalIV()
|
|
|
|
|
{
|
|
|
|
|
string sTemp = "E3ghj*Ghg7!rNIfb&95GUY86GfghUb#er57HBh(u%g6HJ($jhWk7&!hg4ui%$hjk";
|
|
|
|
|
mobjCryptoService.GenerateIV();
|
|
|
|
|
byte[] bytTemp = mobjCryptoService.IV;
|
|
|
|
|
int IVLength = bytTemp.Length;
|
|
|
|
|
if (sTemp.Length > IVLength)
|
|
|
|
|
sTemp = sTemp.Substring(0, IVLength);
|
|
|
|
|
else if (sTemp.Length < IVLength)
|
|
|
|
|
sTemp = sTemp.PadRight(IVLength, ' ');
|
|
|
|
|
return ASCIIEncoding.ASCII.GetBytes(sTemp);
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <20><><EFBFBD>ܷ<EFBFBD><DCB7><EFBFBD>
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="Source"><3E><><EFBFBD><EFBFBD><EFBFBD>ܵĴ<DCB5></param>
|
|
|
|
|
/// <returns><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܵĴ<DCB5></returns>
|
|
|
|
|
public string Encrypto(string Source)
|
|
|
|
|
{
|
|
|
|
|
byte[] bytIn = UTF8Encoding.UTF8.GetBytes(Source);
|
|
|
|
|
MemoryStream ms = new MemoryStream();
|
|
|
|
|
mobjCryptoService.Key = GetLegalKey();
|
|
|
|
|
mobjCryptoService.IV = GetLegalIV();
|
|
|
|
|
ICryptoTransform encrypto = mobjCryptoService.CreateEncryptor();
|
|
|
|
|
CryptoStream cs = new CryptoStream(ms, encrypto, CryptoStreamMode.Write);
|
|
|
|
|
cs.Write(bytIn, 0, bytIn.Length);
|
|
|
|
|
cs.FlushFinalBlock();
|
|
|
|
|
ms.Close();
|
|
|
|
|
byte[] bytOut = ms.ToArray();
|
|
|
|
|
return Convert.ToBase64String(bytOut);
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <20><><EFBFBD>ܷ<EFBFBD><DCB7><EFBFBD>
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="Source"><3E><><EFBFBD><EFBFBD><EFBFBD>ܵĴ<DCB5></param>
|
|
|
|
|
/// <returns><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܵĴ<DCB5></returns>
|
|
|
|
|
public string Decrypto(string Source)
|
|
|
|
|
{
|
|
|
|
|
StreamReader sr;
|
|
|
|
|
byte[] bytIn = Convert.FromBase64String(Source);
|
|
|
|
|
MemoryStream ms = new MemoryStream(bytIn, 0, bytIn.Length);
|
|
|
|
|
mobjCryptoService.Key = GetLegalKey();
|
|
|
|
|
mobjCryptoService.IV = GetLegalIV();
|
|
|
|
|
ICryptoTransform encrypto = mobjCryptoService.CreateDecryptor();
|
|
|
|
|
CryptoStream cs = new CryptoStream(ms, encrypto, CryptoStreamMode.Read);
|
|
|
|
|
sr = new StreamReader(cs);
|
|
|
|
|
return sr.ReadToEnd();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static string Encryp(string Source)
|
|
|
|
|
{
|
|
|
|
|
CryptoPrivate cp = new CryptoPrivate("formmatwizard54073");
|
|
|
|
|
return cp.Encrypto(Source);
|
|
|
|
|
}
|
|
|
|
|
public static string Decryp(string Source)
|
|
|
|
|
{
|
|
|
|
|
CryptoPrivate cp = new CryptoPrivate("formmatwizard54073");
|
|
|
|
|
return cp.Decrypto(Source);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <20><>Կ<EFBFBD><D4BF><EFBFBD><EFBFBD>(<28><><EFBFBD>ԳƼ<D4B3><C6BC><EFBFBD>)
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class CryptoPublic
|
|
|
|
|
{
|
|
|
|
|
RSACryptoServiceProvider rsa = new RSACryptoServiceProvider();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <20><><EFBFBD><EFBFBD>˽Կ
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string GetPrikey()
|
|
|
|
|
{
|
|
|
|
|
string pubkey = rsa.ToXmlString(false); //<2F><>Կ
|
|
|
|
|
return rsa.ToXmlString(true); //<2F><><EFBFBD><EFBFBD>˽Կ
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <20><><EFBFBD>ع<EFBFBD>Կ
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string GetPubkey()
|
|
|
|
|
{
|
|
|
|
|
string pubkey = rsa.ToXmlString(false); //<2F><>Կ
|
|
|
|
|
return rsa.ToXmlString(false); //<2F><><EFBFBD>ع<EFBFBD>Կ
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <20><><EFBFBD>ܷ<EFBFBD><DCB7><EFBFBD>(Ҫ<><D2AA><EFBFBD>ܵ<EFBFBD><DCB5>ַ<EFBFBD><D6B7><EFBFBD>byte<74><65><EFBFBD>ܳ<EFBFBD><DCB3><EFBFBD>117<31><37><EFBFBD>ֽ<EFBFBD>)
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="Source"><3E><><EFBFBD><EFBFBD><EFBFBD>ܵĴ<DCB5></param>
|
|
|
|
|
/// <param name="pubkey"><3E><>Կ</param>
|
|
|
|
|
public string Encrypto(string Source,string pubkey)
|
|
|
|
|
{
|
|
|
|
|
byte[] bytIn = UTF8Encoding.UTF8.GetBytes(Source);
|
|
|
|
|
rsa.FromXmlString(pubkey);
|
|
|
|
|
byte[] bytOut=rsa.Encrypt(bytIn,false); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
return Convert.ToBase64String(bytOut);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <20><><EFBFBD>ܷ<EFBFBD><DCB7><EFBFBD>
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="Source"><3E><><EFBFBD><EFBFBD><EFBFBD>ܵĴ<DCB5></param>
|
|
|
|
|
/// <pubkey>˽Կ</pubkey>
|
|
|
|
|
public string Decrypto(string Source,string prikey)
|
|
|
|
|
{
|
|
|
|
|
byte[] bytIn = Convert.FromBase64String(Source);
|
|
|
|
|
rsa.FromXmlString(prikey);
|
|
|
|
|
byte[] d=rsa.Decrypt(bytIn,false); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
return UTF8Encoding.UTF8.GetString(d);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <20><><EFBFBD><EFBFBD>ǩ<EFBFBD><C7A9>
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="Source">Ҫǩ<D2AA><C7A9><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD></param>
|
|
|
|
|
/// <param name="prikey">˽Կ</param>
|
|
|
|
|
public string RsaCreateSignature(string Source,string prikey)
|
|
|
|
|
{
|
|
|
|
|
rsa.FromXmlString(prikey);
|
|
|
|
|
RSAPKCS1SignatureFormatter f = new RSAPKCS1SignatureFormatter(rsa);
|
|
|
|
|
f.SetHashAlgorithm("MD5");
|
|
|
|
|
byte[] bytIn = UTF8Encoding.UTF8.GetBytes(Source);
|
|
|
|
|
MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();
|
|
|
|
|
byte[] result = md5.ComputeHash(bytIn);
|
|
|
|
|
byte[] b = f.CreateSignature(result); //<2F><><EFBFBD><EFBFBD>ϣ<EFBFBD><CFA3>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>ǩ<EFBFBD><C7A9>
|
|
|
|
|
return Convert.ToBase64String(b); //ȡ<><C8A1>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD>ϣ<EFBFBD><CFA3>ֵ
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <20><>֤ǩ<D6A4><C7A9>
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="Source">Ҫ<><D2AA>֤<EFBFBD><D6A4><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD></param>
|
|
|
|
|
/// <param name="pubkey"><3E><>Կ</param>
|
|
|
|
|
/// <param name="Hash">ǩ<><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD></param>
|
|
|
|
|
public bool RsaVerifySignature(string Source,string Hash,string pubkey)
|
|
|
|
|
{
|
|
|
|
|
rsa.FromXmlString(pubkey);
|
|
|
|
|
RSAPKCS1SignatureDeformatter f = new RSAPKCS1SignatureDeformatter(rsa);
|
|
|
|
|
f.SetHashAlgorithm("MD5");
|
|
|
|
|
byte[] key = Convert.FromBase64String(Hash);
|
|
|
|
|
MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();
|
|
|
|
|
byte[] name = md5.ComputeHash(ASCIIEncoding.ASCII.GetBytes(Source));
|
|
|
|
|
if (f.VerifySignature(name,key)==true){return true;}
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static string GetHashPassword(string password)
|
|
|
|
|
{
|
|
|
|
|
MD5 md5 = MD5.Create();
|
|
|
|
|
byte[] hash = md5.ComputeHash(Encoding.UTF8.GetBytes(password));
|
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
|
for (int i = 0; i < hash.Length; i++)
|
|
|
|
|
{
|
|
|
|
|
sb.Append(hash[i].ToString("X2"));
|
|
|
|
|
}
|
|
|
|
|
return sb.ToString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static string GetHashPassword(string password,int StartIndex,int Length)
|
|
|
|
|
{
|
|
|
|
|
MD5 md5 = MD5.Create();
|
|
|
|
|
byte[] hash = md5.ComputeHash(Encoding.UTF8.GetBytes(password));
|
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
|
for (int i = 0; i < hash.Length; i++)
|
|
|
|
|
{
|
|
|
|
|
sb.Append(hash[i].ToString("X2"));
|
|
|
|
|
}
|
|
|
|
|
return sb.ToString().Substring(StartIndex,Length);
|
|
|
|
|
}
|
|
|
|
|
/**//// <summary>
|
|
|
|
|
/// MD5<44><35>32λ<32><CEBB><EFBFBD><EFBFBD>
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="str"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public static string Md5For32(string str)
|
|
|
|
|
{
|
|
|
|
|
string cl = str;
|
|
|
|
|
string pwd = "";
|
|
|
|
|
MD5 md5 = MD5.Create();//ʵ<><CAB5><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>md5<64><35><EFBFBD><EFBFBD>
|
|
|
|
|
// <20><><EFBFBD>ܺ<EFBFBD><DCBA><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD>͵<EFBFBD><CDB5><EFBFBD><EFBFBD>飬<EFBFBD><E9A3AC><EFBFBD><EFBFBD>Ҫע<D2AA><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>UTF8/Unicode<64>ȵ<EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>
|
|
|
|
|
byte[] s = md5.ComputeHash(Encoding.UTF8.GetBytes(cl));
|
|
|
|
|
// ͨ<><CDA8>ʹ<EFBFBD><CAB9>ѭ<EFBFBD><D1AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD>͵<EFBFBD><CDB5><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><D7AA>Ϊ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>dz<EFBFBD><C7B3><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
for (int i = 0; i < s.Length; i++)
|
|
|
|
|
{
|
|
|
|
|
// <20><><EFBFBD>õ<EFBFBD><C3B5><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>ʹ<EFBFBD><CAB9>ʮ<EFBFBD><CAAE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>Сд<D0A1><D0B4><EFBFBD><EFBFBD>ĸ<EFBFBD><C4B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD>ô<EFBFBD>д<EFBFBD><D0B4>X<EFBFBD><58><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7>Ǵ<EFBFBD>д<EFBFBD>ַ<EFBFBD>
|
|
|
|
|
|
|
|
|
|
pwd = pwd + s[i].ToString("x2");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return pwd;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// U<>̼<EFBFBD><CCBC><EFBFBD>
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class UCryptoPublic
|
|
|
|
|
{
|
|
|
|
|
[DllImport("HD_Security.dll")]
|
|
|
|
|
private static extern int HD_VerifyPassword(StringBuilder password, int passwordlen);
|
|
|
|
|
[DllImport("HD_Security.dll")]
|
|
|
|
|
private static extern int HD_Initialize(StringBuilder password, int passwordlen);
|
|
|
|
|
[DllImport("HD_Security.dll")]
|
|
|
|
|
public static extern int HD_GetDeviceSn(StringBuilder szSn, ref int nSnLen);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <20><>֤<EFBFBD><D6A4><EFBFBD><EFBFBD>'<27>ɹ<EFBFBD>(9000)<29><><EFBFBD><EFBFBD><EFBFBD>豸ʧ<E8B1B8><CAA7>(0)<29><>֤<EFBFBD><D6A4><EFBFBD>벻<EFBFBD><EBB2BB>ȷ(2)<29><><EFBFBD>볤<EFBFBD>Ȳ<EFBFBD><C8B2><EFBFBD>ȷ(3)'
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="password"><3E><><EFBFBD><EFBFBD></param>
|
|
|
|
|
/// <param name="passwordlen"><3E><><EFBFBD>볤<EFBFBD><EBB3A4></param>
|
|
|
|
|
public static int VerifyPassword(StringBuilder password, int passwordlen)
|
|
|
|
|
{
|
|
|
|
|
return HD_VerifyPassword(password, passwordlen);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'<27>ɹ<EFBFBD>(9000)<29><><EFBFBD><EFBFBD><EFBFBD>豸ʧ<E8B1B8><CAA7>(0)<29><>ʼ<EFBFBD><CABC><EFBFBD>豸ʧ<E8B1B8><CAA7>(1)<29><><EFBFBD>볤<EFBFBD>Ȳ<EFBFBD><C8B2><EFBFBD>ȷ(3)'
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="password"><3E><><EFBFBD><EFBFBD></param>
|
|
|
|
|
/// <param name="passwordlen"><3E><><EFBFBD>볤<EFBFBD><EBB3A4></param>
|
|
|
|
|
public static int Initialize(StringBuilder password, int passwordlen)
|
|
|
|
|
{
|
|
|
|
|
return HD_Initialize(password, passwordlen);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <20><><EFBFBD><EFBFBD>U<EFBFBD><55><EFBFBD><EFBFBD><EFBFBD>к<EFBFBD>'<27>ɹ<EFBFBD>(9000)<29><><EFBFBD><EFBFBD><EFBFBD>豸ʧ<E8B1B8><CAA7>(0)<29><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>к<EFBFBD>ʧ<EFBFBD><CAA7>(4)'
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="szSn"><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>к<EFBFBD></param>
|
|
|
|
|
/// <param name="nSnlen"><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>кų<D0BA><C5B3><EFBFBD></param>
|
|
|
|
|
public static int GetDeviceSn(out string szSn, out int nSnLen)
|
|
|
|
|
{
|
|
|
|
|
StringBuilder sb = new StringBuilder(60);
|
|
|
|
|
int snlen = 0;
|
|
|
|
|
int a = HD_GetDeviceSn(sb, ref snlen);
|
|
|
|
|
szSn = sb.ToString();
|
|
|
|
|
nSnLen = snlen;
|
|
|
|
|
return a;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|