参考文献https://blog.csdn.net/MHSMIE/article/details/52353111?spm=1001.2014.3001.5502
1 Type t = Type.GetType("System.Security.Cryptography.CryptoAPITransformMode"); 2 object obj = t.GetField("Encrypt", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.DeclaredOnly).GetValue(t); 3 MethodInfo mi = des3.GetType().GetMethod("_NewEncryptor", BindingFlags.Instance | BindingFlags.NonPublic); 4 ICryptoTransform desCrypt = (ICryptoTransform)mi.Invoke(des3, new object[] { byteKey, CipherMode.ECB, null, 0, obj });具体代码