I think I understand what you want, but I can only think of a workaround. And it isn't very elegant.
When you validate the user entered string, run a loop going through all the date permutations you want (every day, start of each month, whatever), encrypting each one with your key.
Then compare each string with the user entered one.
If you get a match, you know the expiry date. If there is no match at all, the user string is invalid.
I don't profess to be any form of expert on such things, but I'd hazard a guess that providing your end user with the encryption key and relying only on their ignorance of the true purpose of this file would be a major security flaw.
People can get very imaginative when they want to. If I understand the proposition correctly, you're giving them the ingredients but hoping they don't know how to bake a cake.
Welcome Mr.WHRoeder, if you are here! I would be curious what is your opinion about this topic.
Is it possible somehow getting back my_string? Or is there any other good solution?
I know this is an old thread, but I recently came across as the same question Gordon was asking here. Yes it is possible to reverse the output of ArrayToHex. Here's my (very inelegant) solution. It should print two identical copies of the string to the Experts log. I'm sure there's a better way to perform the actions my HexToDecimal function's doing, but hey it was written at 2am :)