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); }
static void PRETEST() { String m = "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f"; PRE_KEY key1 = ProxyReEncryption.GenRandomKey(); PRE_KEY key2 = ProxyReEncryption.GenRandomKey(); PRE_Cipher keyC = ProxyReEncryption.KeyEncrypt(key1, key2.PK, m); String mm = ProxyReEncryption.KeyDecrypt(key2, keyC); Console.WriteLine(mm + mm.Length); Console.Read(); }