public static PRE_PK GenPK(String pk1,String pk2)
 {
     PRE_PK pk = new PRE_PK();
     pk.PK1 = pk1;
     pk.PK2 = pk2;
     return pk;
 }
 private static IntPtr PKStr2PKPtr( PRE_PK pk )
 {
     PRE_ptrPK ptrPK = new PRE_ptrPK
     {
         pk1 = Marshal.StringToHGlobalAnsi( pk.PK1 ) ,
         pk2 = Marshal.StringToHGlobalAnsi( pk.PK2 )
     };
     IntPtr pPk = Marshal.AllocHGlobal( Marshal.SizeOf( ptrPK ) );
     Marshal.StructureToPtr( ptrPK , pPk , true );
     return pPk;
 }
        public static PRE_Cipher KeyEncrypt( PRE_KEY key1 , PRE_PK key2_pk , String m )
        {
            IntPtr pKey1 = ProxyReEncryption.KeyStr2KeyPtr( key1 );
            IntPtr pPk2 = ProxyReEncryption.PKStr2PKPtr( key2_pk );

            IntPtr C = KeyEncrypt( pKey1 , pPk2 , m );
            PRE_Cipher CC = CipherPtr2CipherStr( C );

            return CC;
        }