We are working on a redirecting page for our mobile apps.
Users would go to a page like: https://mobileredirect.our-app.com?target=https://clientdomain.com/some_resource
Mobile apps on iOS and Adroid can intercept the "mobileredirect.our-app.com" domain, when installed. If not installed, the browser will open, and redirect the browser to the client domain.
This is contains an obvious problem. Anyone can put any domain in the scheme and this becomes an attack vector. I would like to be able to verify if the URL is actually coming from a trusted source. We need to do it this way, as we don't control which domains could use our mobile app.
Ideally I'd like to do this in the as well browser, without the need for a server.
I was thinking of using a library like simple-crypt, using the Asymmetric operation. Trusted servers would have the private key, they would encrypt the URL end it would end up like this: https://mobileredirect.our-app.com?target=ENCRYPTED_URL. The clients (mobile apps, and the website) would contain the public key to decrypt the URL. This does mean that the public key will be visible to everyone.
Now my question:
Is this a good idea? How can this be broken? Is it overkill? Are there easier ways (e.g.: use some type of checksum algorithm)?
This has been answered in a cross post on the security stackexchange