I want to send data from my C# Windows 8 App to a PHP Script on my webserver to save Highscores etc.
But to avoid Manual insertions of fictional highscore values, I think I have to en- and decrypt it.
In which way can I encrypt data in C# which I can decrypt in PHP and maybe in the other way?
Or are there other Solutions to realize it?
Standard way to encrypt/decrypt data web-transmitted data is using the HTTPS protocol. All encryption/decryption happens automatically once the client and server authenticate and trust each other after exchanging certificates.
To avoid fake data talk only to authenticated clients that are authorized to insert the scores.
So you'd have a list of trusted clients, talk to them over HTTPS and each session would start by authentication (client would prove its identity to your server).
In my opinion the key terms you should definitely take into consideration are HTTPS (SSL Certificate), REST, OAuth
You may want to start by reading the
Open Web Application Security Project (OWASP) - Authentication Cheat Sheet
After that you may find useful some followup technical questions like:
https://security.stackexchange.com/questions/3605/certificate-based-authentication-vs-username-and-password-authentication
How to build a secure and RESTful service in PHP?
Simple PHP REST server with secure user authentication and registered third party applications
...?
Related
I've created an API and deployed to Azure (be patient I'm new to all this). The API will be used by a single daemon app in another organisation. I'm planning to secure this by:
IP White List - this seems to work an to my mind makes the API pretty damn secure.
Client secret create by AAD - is this sufficient?
HTTPs - I've turned this on (Azure APP service TLS blade). However it just seems to work which always makes me suspicious, do I need to link a certificate? Is the encryption being handled behind the scenes?
If it's sufficient or not depends on your scenario. (e.g. is it hipaa / pci compliance?)
I would also add a Azure Key Vault for storing the secrets; WAF (Web Application Firewall) in front of the API + API Gateway (using API Management).
Your point #2 looks useless to me, you'd better request your client to authenticate against your azure Ad and pass the acquired token to your API. this way you'll know who / when called your service.
#3- Azure gives you a SSL certificate, but if you plain to use your custom domain (recommended), you could either generate a certificate using Let's Encrypt or buy from another trusted authority. The encryption happens at rest and in transit, but you could also use your encryption keys for the encryption at rest part.
We are using Web API 2.0 to serve clients in a context where SSL can't be used (no public internet access, clients can't be expected to trust a self-signed certificate). To secure content moving between the client and server, we'd like to be able to encrypt it. We're OK with un-encrypted HTTP headers (only need to encrypt payload). The question is: is there a way to insert a custom handler into both the request and response message pipelines so that we can apply a decryption as a request pre-processing step and an encryption as a response post-processing step?
We are using the built-in features of Web API to serialize/de-serialize between JSON and model classes, and don't want to have to refactor any of that existing code. So an encryption handler would have to be inserted at the very start/end of the request/response pipeline. Is this possible, and if so, what is the technique to insert custom request/response content pre/post processing?
The network is "public" in that users bring their own devices, but the network is isolated from the public internet. Clients will only use a custom application we are developing to consume our Web API service, so we can address implementation issues of a custom encryption scheme on both client and server side.
If you control the client application, you can hard-code the SSL certificate that the server is expected to return, which means that it doesn't have to validate through the normal PKI means (sometimes called certificate pinning). Most other approach will result in you attempting to re-invent SSL, but with some fatal flaw.
To be explicit, I think you are seeing a conflict between "a context where SSL can't be used (no public internet access, clients can't be expected to trust a self-signed certificate)" and "Clients will only use a custom application we are developing" where one doesn't necessarily exist. The user doesn't have to know that the certificate is self-signed, and self-signed does not always imply untrusted.
I am searching a good way to encrypt and decrypt user authentication data between my Android app and my ASP.NET Webservice built in C#.
I want to do a user registration on my Android app and send the authentication to the back-end server that is a ASP.NET Webservice built in C# and then every time the app calls the webservice it should send a hashed string with authentication information so webservice now what user it is.
What is the best practice for this and have i missed something, give me some ideas please!
If you just send a hashed or encrypted string, anyone that captures it, can re-send it, and authenticate without knowing the password, etc. (replay). Use HTTPS (HTTP over SSL) and you don't have to worry about encrypting the communication channel.
I'm working on a Project where I run a Server that is basically a .Net C# Application with a SQL Server Express DB and will now use WCF for Webservice implementation and then there are Silverlight Clients that different Companies will use to interact with this Server. How do I implement User Authentication in a good and reliable way? I've read a lot of Posts here that will user ASP on the Server side, but my Server isn't an ASP Server. Should I implement it anyway or are there any other options?
My naive thought was something like that:
Username, Password and Company is stored as a credential in the DB
The Silverlight Client asks on Startup those credentials and sends them to the Server to get a confirmation.
from now on those credentials are in every communication between Client and Server and the Server confirms them every time.
Is this to naive and insecure?
Since you're using basic web protocol, you could consider using an HTTPS channel and
1) embedding the credentials in the URL - as long as you're using HTTPS this is OK
2) getting a unique identifier back from the service on initial validation of credentials, and then requiring this identifier in all future calls - saves on the db lookup, but you should still stay in https - if you use http, then it's by definition insecure
This the situation: I have one webservice without SSL, which provides two pages for the other web application. When the user submits these pages, an XML file with private information is sent to the webservice.
How can I provide the necessary privacy protection on the XML file? Is the one certificate good enough to give the appropriate security?
I'm not sure about this one, and am in the preparation phase of a project... So need to know the involved work on this part...
As an alternative to SSL you could encrypt the file yourself using any of the algorithms available in using System.Security.Cryptography but then you have to work out a mechanism to exchange your key(s).
However by far the easiest way will be to have both web services using SSL endpoints. That will take care of all your confidentiality, integrity and identity considerations in one fell swoop.
Certificates are tied to the hostname of the server (or, with wildcard certificates, all the hosts in a domain). So if the two services are on the same host, then both can use the same certificate.
If they are not on the same host there will be no transport security on the non-SSL service unless this is added separately. WCF has support for message (or part of message) encryption.
The simplest solution is certainly to use TLS, ex-SSL (widely supported in every programming language).
There is no need to buy a certificate (and it brings no extra security, it is mostly there to make PHBs feel better): either create self-signed certificates or set up your own CA.