C# to Java DES encryption

十年热恋 提交于 2019-12-01 02:01:45
  • Calling doFinal() twice doesn't make sense.
  • Printing the value of byte[].toString() doesn't make sense. It doesn't contain the ciphertext.
  • Converting that to base-64 doesn't make sense. It still doesn't contain the ciphertext.

You need to convert the byte[] array returned by the first doFinal() call directly to base-64, without the round-trip to and from String() caused by calling toString() and then `getBytes().

NB For some reason you have a variable called encrypt in your decrypt method, and for some even stranger reason you are returning it instead of decrypt, which is the only variable that actually contains plaintext.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!