| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- using NPOI.OpenXmlFormats.Dml.Diagram;
- using NPOI.OpenXmlFormats.Shared;
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Runtime.InteropServices;
- using System.Text;
- using System.Threading.Tasks;
- namespace SiteCore.taobao
- {
- public class jiemiUtils
- {
- [DllImport("DrvInterface64.dll", CharSet = CharSet.Unicode)]
- public static extern uint DecFile(string filename);
- [DllImport("DrvInterface64.dll", CharSet = CharSet.Unicode)]
- public static extern int IsFileEncrypted(string filename);//返回1为加密,0为未被加密
- [DllImport("DrvInterface64.dll", CharSet = CharSet.Ansi)]
- public static extern void CreateUserKey(StringBuilder key, int len);
- [DllImport("DrvInterface64.dll", CharSet = CharSet.Ansi)]
- public static extern int InitAesKey(StringBuilder key, int len);
- [DllImport("DrvInterface64.dll")]
- public static extern int IsInitedAesKey();
- public static void ossFileDecrypt(string filePath)
- {
- int IsFileEncrypt = IsFileEncrypted(filePath);
- if (IsFileEncrypt == 1 && File.Exists(filePath))
- {
- string key = "gBQnlxiBb7MthH9644V0W0pFwqYZgyy7";
- var sb = new StringBuilder(key);
- //Linux系统的接口要调用一次,Windows系统要调用两次
- CreateUserKey(sb, key.Length);
- CreateUserKey(sb, key.Length); //破解用dse生成的文件,需要调2次。
- int result = InitAesKey(sb, sb.Length);
- result = IsInitedAesKey();
- if (result != 1)
- {
- }
- uint a = DecFile(filePath);
- if (a != 0)
- {
- }
- }
- }
- }
- }
|