Encryption and Hashing Overview Flashcards
What is PKI?
Public Key Infrastructure (PKI)
what is symmetric key encryption algorithm?
Symmetric encryption means that the data is encrypted on one side using a special key, and then encrypted data is sent to another side and that another side decrypts received data using same key. And again.
Main point here is that those keys here on this side and on this side are the same. That’s why this type of encryption is called symmetric encryption.
what is the drawback of symmetric encryption?
Any person or any machine that owns this key has ability to decrypt encrypted data and gain access to original data. And that is a drawback of symmetric encryption. And if you want to use it somewhere for encryption of your data, you should take care of key and key should be kept secret and it should not be transferred to any other machines or send to other people.
What are some examples of symmetric key encryption algorithms?
DES, 3DES and AES
Example of asymmetric key encryption algorithm?
RSA
which encryption algorithms are modern and which are obsolete?
DES and 3DES are obselete
RSA and AES are modern
why do we need hashing in encryption?
Encryption is usually used for making data unreadable for third party. And of course, this data that is encrypted during transfer over network could be easily changed, compromised or something like that.
And that will lead to situation when receiver will not be able to read original data or will read it with some errors. And that’s where hash comes in.
what is hash?
Hash is a fixed length string.
And its length may be 128 bits or 160 bits or 256 bits or something longer.
And this length depends on the algorithm that is used for creation of the hash.
Does hashing require a key?
hash functions don’t require any key.
So we take only data, take hash, function and create using this hash function special hash.
Explain this diagram about hashing
So what happens here in this diagram, hash function is applied to original data and hash is created.
And after that, data, along with hash are sent over the network to receiver and receiver, receives data and hash separately.
And now receiver takes data applies same hash function as was applied here on this side and creates hash.
And after that this hash and this hash are compared.
And if those hashes match it means for receiver that this data was not changed or was not mutated during transfer over the network.
And that is the purpose of hash.
It verifies integrity of data.
In which order does encryption and hashing happen?
Encryption happens before creation of hash
examples of hashing algorithms?
MD5, SHA, MAC
what is MD5?
MD5 is a hashing algorithm, that creates a fixed length hash of variable length input and output is always 128 bits.
what are sha-1, sha-256 and sha-512?
Those numbers are length of the hash.
sha-1 gives a hash of fixed length 160 bits
sha-256 gives hash of fixed length 256 bits
sha-512 gives has of fixed length 512 bits
How do you create hash using sha algorithm?
what is HMAC ?
HMAC: Data + key = Hash
Is HMAC algorithm used alone or in combination with other hash algorithms?
HMAC algorithm may be used standalone, but usually it is used in combination either with MD5 or SHA algorithms.
How is HMAC different from other hashing algorithms?
HMAC process adds special secret key into hashing process.
And it means that with Mac algorithm we take not just input data, we also take special secret key or password and utilize it during creation of the hash.
How does HMAC provide authentication of the sender of the data?
And with HMAC algorithm, we create hash that is based not just on data but also on secret password or key.
And that means that the other side may create same hash only if it has same secret key, and therefore this algorithm adds additional level of security and it also allows to perform authentication of the sender.
What are assymetric keys?
A pair of two keys called private and public
Both keys have same length, but are different keys
Private key is kept secret, only the owner knows the private key
Public key is communicated to the world, available for anyone
What can the assymetric keys be used for?
- Encryption of data - Public key is used for encryption of data, and when the data is received by a receiver, he can decrypt the data using his private key.
- Hashing using key - The sender who hashes the data signs it using his private key. And the receiver checks the same using the public key
Explain encryption using asymmetric keys?
So on this diagram, there is owner of key pair and only this owner knows private key.
Of course, it also knows it’s public key. Public key of this pair can be communicated to anyone in the world.
So let’s suppose that left side wants to send encrypted data to the owner of Private Key.
What does is just following. It takes data and encrypts this data using public key of the owner of this private key. assuming public key was exchanged earlier.
And here we get encrypted data and this encrypted data can be seen by anyone in the world.
But it can only be decrypted by private key. And this private key is owned only by owner of this key pair.
And that means that this encrypted data may be decrypted only by owner of this key pair.
Nobody else could decrypt data.
And if data is successfully sent to the owner of private and public key pair owner could decrypt data using private key.
show a diagram of sign and verify signature using asymmetric keys?
Exlplain this sign and verify the signature using asymmetric keys?
And owner of Private Key first takes data and creates hash of this data.
And here we could use any hash function that we have discussed before, either MD5 or Sha.
And here owner encrypts this hash using its private key recap that private key is only available for owner.
Nobody else knows this key and after that encrypted hash along with data are sent to another party.
And this another party must be sure that data was sent from the owner of Private Key.
And that’s why it verifies hash in the following way.
It takes data using the same hash function. It creates a hash and decrypts hash that was sent by the owner of Private Key using its public key.
And after that compares those two hashes and if there is a match, this side could be sure that this data was sent only by this party by owner of Private Key because nobody else could create an encrypted hash that could be decrypted by this public key.