I want to implement simple software protection mechanism. This is how it would look like:
My question is - is there any problem for me using the private key for encryption and public for decryption (since usually it is other way around)?
I want to implement simple software protection mechanism. This is how it would look like:
My question is - is there any problem for me using the private key for encryption and public for decryption (since usually it is other way around)?
You don't encrypt with a private key. You sign the message with one. One of the biggest misconceptions that I have seen here is that you can perform authentication of message by encrypting with a private key, and verified by decrypting with a public key. The problems are many, here are a few:
You don't decrypt with a public key. If some message can be recovered by using some publicly available information, it is not encryption.
BECAUSE, the goal of encryption is confidentiality. You encrypt the data so that only the one that owns a legitimate key can read it. It does not necessarily care about authentication or unforgeability. Digital signatures, on the other hand does not care about hiding any information and are designed to be unforgeable under chosen message attacks etc. (which means the attacker is assumed to be able to get signatures for messages of her choice from the legitimate owner) while encryption goes for semantic security (IND-CPA) or IND-CCA, (the attacker being unable to distinguish between ciphertexts of different plaintexts). One does not automatically imply the another.
Not all schemes allow both signatures and encryption schemes in similar ways but the question was about RSA so I will leave it here. But you should know that RSA encryption and RSA signatures are not the same algorithms even though they share the mathematical core
Beware. Private and public keys are theorically equivalent, so nothing prevents you for using the private key to encrypt (and have it to be publicly knows) and the public key to decrypt (and try to keep it secure).
But real life implementations do make a strong difference. It is common that the public key can be computed from the private one! That means that if you give someone else a private key, they will also know the public one, which somehow defeates the whole process of crypting.
That means that you must use your private key to prove that you are the author/sender of some data (you sign it) or the repipient public key to encrypt that piece of data (only the recipient will be able to decrypt).