public static string Decrypt(string S) { Structures.TSECItem tSECItem = default(Structures.TSECItem); NSS_Init(FireFoxPath.GetRegistryFireFox()); long num = PK11_GetInternalKeySlot(); if (num == 0) { return(string.Empty); } PK11_Authenticate(num, true, 0L); int value = NSSBase64_DecodeBuffer(IntPtr.Zero, IntPtr.Zero, S, S.Length); Structures.TSECItem tSECItem2 = (Structures.TSECItem)Marshal.PtrToStructure(new IntPtr(value), typeof(Structures.TSECItem)); if (PK11SDR_Decrypt(ref tSECItem2, ref tSECItem, 0) != 0) { return(string.Empty); } if (tSECItem.SECItemLen != 0) { byte[] array = new byte[tSECItem.SECItemLen]; Marshal.Copy(new IntPtr(tSECItem.SECItemData), array, 0, tSECItem.SECItemLen); return(Encoding.UTF8.GetString(array)); } return(string.Empty); }
public static long NSS_Init(string path) { NativeMethods.LoadLibrary(Path.Combine(FireFoxPath.GetRegistryFireFox(), "mozglue.dll")); NativeMethods.LoadLibrary(Path.Combine(FireFoxPath.GetRegistryFireFox(), "nssutil3.dll")); NativeMethods.LoadLibrary(Path.Combine(FireFoxPath.GetRegistryFireFox(), "plc4.dll")); NativeMethods.LoadLibrary(Path.Combine(FireFoxPath.GetRegistryFireFox(), "nspr4.dll")); NativeMethods.LoadLibrary(Path.Combine(FireFoxPath.GetRegistryFireFox(), "MOZCRT19.dll")); // NativeMethods.LoadLibrary(Path.Combine(FireFoxPath.GetRegistryFireFox(), "")); NSS3 = NativeMethods.LoadLibrary(Path.Combine(FireFoxPath.GetRegistryFireFox(), "nss3.dll")); IntPtr procAddress = NativeMethods.GetProcAddress(NSS3, "NSS_Init"); DLLFunctionDelegate dLLFunctionDelegate = (DLLFunctionDelegate)Marshal.GetDelegateForFunctionPointer(procAddress, typeof(DLLFunctionDelegate)); return(dLLFunctionDelegate(path)); }
public static void InitDelegates() { try { foreach (var CheckDLL in Massive) { if (File.Exists(Path.Combine(FireFoxPath.GetRegistryFireFox(), CheckDLL))) { Console.WriteLine(Path.Combine(FireFoxPath.GetRegistryFireFox(), CheckDLL)); } } if (File.Exists(Path.Combine(FireFoxPath.GetRegistryFireFox(), "nss3.dll"))) { Console.WriteLine(Path.Combine(FireFoxPath.GetRegistryFireFox(), "nss3.dll")); } } catch { } }