Answer the question
In order to leave comments, you need to log in
How to generate a key that will be valid for a certain period of time?
There is an application (mobile without a server part), there is a desire to create a system of promotional codes, i.e. the user receives a promotional code and activates paid functions for free, but it is necessary that the promotional code is valid only for a certain period of time, and the period of this time must be encrypted in the promotional code itself, and there must be a decryption procedure accordingly.
A head-on solution would be to start a server for the application and, when entering, check whether the promo code is valid at the moment, but it would be interesting to do it all locally.
What are some ideas? Cryptography has somehow been forgotten since university times.
Answer the question
In order to leave comments, you need to log in
You can use some kind of symmetric encryption system. That is, to encrypt the validity time of the promo code with a private key. Add along with it some kind of "garbage" to confuse everything. However, a problem looms, there is a possibility that someone can peep this key and decryption algorithm in the source code of the program and create their own promotional codes.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question