Giter Site home page Giter Site logo

jofairden / dotnet40tlsthumbprintpinning Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 22 KB

TLS HttpWebRequest in .NET 4.0 using Thumbprint Pinning

License: MIT License

C# 100.00%
dotnet net40 dotnet-framework httpwebrequest tls tls12 tls-support ssl ssl-pinning ssl-support

dotnet40tlsthumbprintpinning's Introduction

DotNet40TLSThumbprintPinning

Keyword: .NET 4.0, HttpWebRequest, TLS (1.2), SSL, Certificate Pinning, HPKP, Expect-CT

About

Showcases how to perform forced TLS with a proper server validation callback that performs certificate pinning to ensure certificate validity and safeguards against MITM attacks. Note, the program does not perform any form of pure HPKP. (Which is deprecated anyways, see the notes about the new Expect-CT Header). In the example we showcase comparing the SHA-1 Thumbprint of the certificate to verify validity, which is possibly the easiest form of pinning but not necessarily the best. Other forms of pinning can be implemented such as certificate pinning or public key pinning, each with their pros and cons.

This repository is meant to serve as an example on how you can enable TLS support for HttpWebRequest when targeting .NET 4.0 as well as performing some type of server certificate validation callback. It is wise to implement a more thorough implementation of the pinning based on your needs.

Of course, the current implementation to enforce TLS support will not work for Unix-based systems (Mac/Linux) and only supports Windows at this time.

Note that we are only verifying the leaf here, you can modify the code to verify the entire certificate chain instead.

Pinning rules

These rules count for any type of pinning that you do:

  1. The client (this application) is pre-configured to know what server certificate it should expect.
  2. If the server certificate does not match the pre-configured server certificate then the client will prevent the session from taking place.

dotnet40tlsthumbprintpinning's People

Contributors

jofairden avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.