Issue # 17: Diffie-Hellman, Github SSH Accounts, UR(L/I/N)
Hey Hey 👋
What a week, huh? Too many things happening both personally and around the world, while at the same time trying to figure out German healthcare system and how it will fit into my upcoming freelancing journey.
Turns out, German healthcare system is tooooo expensive and costs a lot of money. There are many horror stories especially from migrants about how inadequate the service can be. But this story is for another day.
In This Issue
News & Articles: Tech Compensation, 23andMe Bankruptcy, Lieferando Layoffs, Zalando’s scandal, EU Open Source Catalogue
Poll: Interested into Self-employment?
Weekly Summary:
Diffie-Hellman Key Exchange
Multiple Github SSH Accounts
URL vs URI vs URN
Weekly Videos
How to Start a SOLO Agency Step-By-Step
World's shortest UI/UX design course
News & Articles
Poll
This week’s Summaries
Diffie-Hellman Key Exchange
Diffie-Hellman Key Exchange is a method to securely exchange cryptographic keys over a public channel. It uses a mix of asymmetric and symmetric encryption to create a secure channel.
We have three parties: Client, Server, and Attacker.
The steps are:
The client and server agree on two numbers: a prime number, and a base number.
The client and server generate a private key and a public key.
The client and server exchange their public keys which has the following formula:
public_key = (base_number ^ private_key) % prime_number
.They then exchange the public keys and generate a shared secret key using the following formula:
shared_secret_key = (public key of the other party ^ private key) % prime_number
.Doing this, mathematically, the shared secret key will be the same for both the client and server.
The client and server can now communicate securely using the shared secret key.
Diffie-Hellman protects against Forward Secrecy, which means that if the attacker gets the private key, they can't decrypt the previous messages.
Protecting against Forward Secrecy is important because if the attacker gets the private key, they can decrypt all the previous messages. With Diffie-Hellman, the attacker can't decrypt the previous messages because the shared secret key is only used for the current session and every session has a different shared secret key.
Read more:
Multiple Github SSH Accounts
This is useful when you have multiple accounts for github or any other git repo provider on the same machine (ex: Work and Personal accounts).
The concept is that we need to:
Generate different SSH keys for each account
Add ssh keys to
~/.ssh/config
with separate hostsAdd condition to
.gitconfig
to use certain user for a certain directory for exampleWe pull the repo using a specific host name (not the domain)
Steps:
Generate SSH keys:
ssh-keygen -t ed25519 -C "<email_address>"
Add the keys to
~/.ssh/config
:
Host github.com
HostName github.com
User git
IdentityFile ~/.ssh/id_ed25519
Host github.com-personal
HostName github.com
User git
IdentityFile ~/.ssh/id_ed25519_personal
Add the condition to
.gitconfig
:
[includeIf "gitdir:~/work/"]
path = .gitconfig-work
Then create a .gitconfig-work
file with the following content:
[user]
email = <email_address>
name = <name>
[core]
sshCommand = "ssh -i /path/to/work/ssh/file -o IdentitiesOnly=yes"
Clone the repo using the specific host:
git clone git@github.com:repo_org/repo_name.git
For the personal account:
git clone git@github.com-personal:repo_org/repo_name.git
and afterwards, you can use git commands normally and it will know which credentials to use.
URL vs URI vs URN
This topic might be very technical but it explains the different names and what are the different parts used to find a resource on the internet.
Let's take the following:
https://john.doe@www.example.com:123/form/questions/?tag=networking&order=news#top
It consists of:
https
: Scheme. This can be HTTP, HTTPS, FTP, MAILTO, IRC, FILE, etcjohn.doe
: Userinfowww.example.com
: host123
: Portjohn.doe@www.example.com:123
: Authority/form/questions
: Path?tag=networking&order=news
: Query#top
: fragment
This full thing is called a Universal Resource Locator (URL). It's used to locate exactly where is the resource.
Meanwhile, Universal Resource Identifier (URI) is used to uniquely identify a resource but not necessarily how to locate it. So, URL is just a URN + Scheme (how to locate a resource)
Uniform Resource Name (URN) are names like URI but they should be unique across space and time. They are more regulated and they usually start with the prefix urn:
.
Read more: