예제 #1
0
        public static void Run(string input, string output, string targetPath, EdataType type, string fileOfPublisherKey, string fileOfAppDevKey)
        {
            int    cb          = 0;
            IntPtr destination = new IntPtr();
            int    length      = 0;
            IntPtr ptr2        = new IntPtr();

            try
            {
                if (File.Exists(fileOfPublisherKey) && File.Exists(fileOfAppDevKey))
                {
                    byte[] source = File.ReadAllBytes(fileOfPublisherKey);
                    cb          = source.Length;
                    destination = Marshal.AllocHGlobal(cb);
                    Marshal.Copy(source, 0, destination, source.Length);
                    byte[] buffer2 = File.ReadAllBytes(fileOfAppDevKey);
                    length = buffer2.Length;
                    ptr2   = Marshal.AllocHGlobal(length);
                    Marshal.Copy(buffer2, 0, ptr2, buffer2.Length);
                    Encrypt(input, output, targetPath, (ScePsmEdataType)type, destination, cb, ptr2, length);
                }
            }
            finally
            {
                Marshal.FreeHGlobal(destination);
                Marshal.FreeHGlobal(ptr2);
            }
        }
예제 #2
0
 public static void Run(string input, string output, string targetPath, EdataType type, string fileOfPublisherKey, string fileOfAppDevKey)
 {
     int cb = 0;
     IntPtr destination = new IntPtr();
     int length = 0;
     IntPtr ptr2 = new IntPtr();
     try
     {
         if (File.Exists(fileOfPublisherKey) && File.Exists(fileOfAppDevKey))
         {
             byte[] source = File.ReadAllBytes(fileOfPublisherKey);
             cb = source.Length;
             destination = Marshal.AllocHGlobal(cb);
             Marshal.Copy(source, 0, destination, source.Length);
             byte[] buffer2 = File.ReadAllBytes(fileOfAppDevKey);
             length = buffer2.Length;
             ptr2 = Marshal.AllocHGlobal(length);
             Marshal.Copy(buffer2, 0, ptr2, buffer2.Length);
             Encrypt(input, output, targetPath, (ScePsmEdataType)type, destination, cb, ptr2, length);
         }
     }
     finally
     {
         Marshal.FreeHGlobal(destination);
         Marshal.FreeHGlobal(ptr2);
     }
 }