Secure PHP file that which will be called by c#

+1 Christos Chris · January 12, 2015
Hellloo everyone,

I have the following questions and I need some guidance.

I have a PHP file that I want to secure so that no one else than by application will be able to call and get resuts, else the caller will get an error.

I would like to call that PHP file using c#.

What steps should I take?

I was thinking to create a random token and sent it every time when I call the PHP file, but what if someone steals that token? I will be sending it over POST request so I guess anyone can easily steal it, am I right or I am making wrong assumptions?

If the above statement its true, I should encrypt the token that I will sent over the network, right?

How should I encrpypt it? I need to encrypt in c#, sent it to PHP, Decrypt if the token is correct return data else dont.

I hope I didnt confuse you :P

If anyone can give me some pointers I would really appreciate it!


Post a Reply


Oldest  Newest  Rating
0 Vincenzo Marcella · January 13, 2015
Just a suggestion, never really have tried this myself, but maybe have a program in the middle of the connection between the c# program and the PHP program that generates a random number every time its called, and sends it to your c# program. After it has sent the random number to your c# program through a secure network, both the midway program, and the c# program perform a mathematical operation on the number that will always end up having the same result if both programs contain the same mathematical function. Only problem with this would be if someone were to find a way to intercept the random number generated and had the mathematical function they'd be able to access the PHP file. Then again, nothing ever really is perfectly secure, but just a suggestion:D  
  • 1



C# is an object-oriented language designed for improving the development of web applications.