Skip to main content

HTTPS

Why do we need HTTPS?
* To prevent man in the middle attack
    * When talking to router someone can intercept
    * When routing to ISP someone can intercept
    * When request is going to the destination internationally someone can intercept
* Governments, ISPs, private companies can intercept the communication if its unencrypted
* Airport wifi's hijack every request and show login page if not logged in to their network


What does HTTPS help with?
* Confidentiality - Keep the communication contents secret
* Integrity - Making sure message is not comrpomized
* Authenticity - Making sure that client is communicating with the correct server

Digital certificates
Certificates from certificate authorities, verify our ownership of the website so that clients can communicate safely.

Digital certificate certifies the ownership of the public key by the owner of the certificate

When you browse through a website through your machine, the CA signed certificate is sent to the browser. Your machine checks that the certificate is legitimate by referring to the local list of trusted authorities (check certmgr.msc). Firefox maintains its own list of trusted authorities.

CA's maybe added or removed by browser providers of their certificates can be compromised

What is SSL?
Secure sockets layer.

What is TLS?
Transport Layer Security

Difference?
SSO is less secure and removed now, TLS is implemented and used by all browsers buy we still call it SSO. For example


What is PKI scheme of issuing digital certificates?
In public key infrastructure scheme, a digital certificate is issued by a CA and it contains
* A distinguished name/
* Owners name/
* Subject
* a unique serial number for the certificate
* Owner's public key
* Issuing and expiry date
* Distinguished name of the CA
* Digital signature of the CA
* Signature algorithm

How does TLS handshake happen?
1) Client send message to server with things like what is the highest level of TLS it supports, supported cipher suite algorithms with priority etc
2) Server sends back agreed TLS protocol, cipher suite and public key
3) Client sends message encrypted with server public key
4) Server returns finished response and starts secure communication

#1 and #2 are unencrypted communication and man in the middle can intercept at that time


How to create certificate locally?
One of the way is :
* In windows powershell (admin mode) by running  "New-SelfSignedCertificate -certstorelocation cert:\localmachine\my -dnsname devlover.blogger.com" command giving certstorelocaton and dnsname parameter
this will give thumbprint that can be copied to export the certificate from local store
* To add password to our certificate in windows we can generate password by calling $password = ConvertTo-SecureString -String "mypassword1234" -Force -AsPlainText
* And then export the secure password to certificate using Export-PfxCertificate -cert cert:\localMachine\my\ -FilePath c:\mycert\testcert.pfx -Password $password

Alternatively we can also use keytool command to generate certificates. Keytool is a key and certificate management utility provided by Java
* Generate key: keytool -genkey -alias server-alias -keyalg RSA -keypass changeit -storepass changeit -keystore keystore.jks
* export the generated certificate to server.cer:  keytool -export -alias server-alias -storepass changeit -file server.cer -keystore keystore.jks 
* Add the certificate to truststore file: keytool -import -v -trustcacerts -alias server-alias -file server.cer -keystore cacerts.jks -keypass changeit -storepass changeit
 we can verify that the certificate was added by running keytool -list command
(later update web.xml and add tag called user-data-constraint that contains a tag called transport-guarantee that contains CONFIDENTIAL)

Comments

Popular posts from this blog

Hive

Hive What is Transactional Processing? * Small data * recent data * updates data * real time * narrow scope - single data source What is Analytical Processing? * Mostly batch * Mostly old data * Mostly long running * wide scope multiple data source to give a big picture ----------- RDBMS (mostly for transactional) * Single m/c with backup, structured data, usually one source Its hard to do analytics on RDBMS Big Data (mostly for analytical using data warehouse) * distributed data, semi/unstructured, auto replication with fault tolerance, usually different source and different format Not always... * hbase is special db that can be configured for transactional processing even if its on big data * qlikview can be used for analyitial processing even if its running on a single m/c --------- Whats a Data Warehouse? Technology that aggregates data  from one or more sources for analytical processing used by long running jobs, lagged data, large data, multi s...

Simple tutorial to create RESTful web services using SPRING, GRADLE & ECLIPSE

How to create RESTful web services using SPRING, GRADLE & ECLIPSE * First install Eclipse  i n your machine by referring to the official wiki  (I have installed an eclipse version called Kepler in my machine) * After installing Eclipse, open it and go to "eclipse market place" to add Gradle as seen in below screenshots: * Now create a new blank Gradle project in Eclipse *Now lets build the blank project using Gradle to ensure that everything is fine so far * Now change the build.gradle file to below as seen in http://spring.io/guides/gs/rest-service/ buildscript { repositories { maven { url "http://repo.spring.io/libs-release" } mavenLocal () mavenCentral () } dependencies { classpath ( "org.springframework.boot:spring-boot-gradle-plugin:1.1.4.RELEASE" ) } } apply plugin : 'java' apply plugin : 'eclipse' apply plugin : 'idea...

Simple FitNesse tutorial

(Time spent for writing - 1:30 min) In simple words, FitNesse is a testing framework that can be used to develop automated test cases. I had searched many posts but could not find a single tutorial that could help me get started with FitNesse. So writing it now... BTW I am a java developer, so this tutorial is in pure java! I use windows XP and Java version is 1.5.0 To get started first download FitNesse from http://fitnesse.org/ I didnt like its 2 minute example, because that just showed what it does, doesnt really help me to start with development. They should have a real getting started tutorial there, I think. I had downloaded fitnesse20070619.zip from downloads section After downloading, install it by unzipping the all the files to a some location like c:\fitnesse c:\fitnesse will then act as the root folder for you and all the classpaths will be relative to root folder By default FitNesse will run on port 80. If you want another port you can edit the run.bat file in the root fol...