Jerry Girgich wrote:Instead of the decrypt method, what if I do this instead?
I can get the private key and then use that to decrypt. Only problem is that it again is not doing anything and I don't know why?
Hmmm.... I appreciate how you did the coding for encryption. Basically,
and I am speculating, you probably did a lot of research; found about a few dozen different ways to do the encryption; and while each solution had slightly different inputs and outputs, the basic premise of all of them was that encryption happened, and hence, all the dozen solutions that you found were equally valid (even though the outputs were different). It is just a matter of picking the encryption code that you liked best.
... unfortunately, you don't get the luxury of doing this for decryption....
With decryption, you have to undo what you did for encryption. This means that you must use the same encoding, encryption algorithm, encryption keys (or in the case of asymmetric encryption, the other key in the pair), and also, the same serialization (since you used it). And in the exact opposite order. The decryption is the *exact* undoing of what you did for encryption.
No choosing of the best decryption code that you like best. The decryption code is determined from your encryption code. So, what do I recommend?
I recommend that you go back to the encryption code -- and try to understand everything about it. What serialization that you used? What encoding? What encryption algorithm? etc. etc.... and .... how to undo everything that is done. Once you understand all of that, then I recommend you take the encryption code, and use the exact opposite order, to code the tasks to undo the encryption.
Hope this helps,
Henry