What is Cryptography?
Cryptography can de defined as practice and study of Hiding information. Modern cryptography intersects the disciplines of mathematics, computer science and engineering. Applications of Cryptography include ATM cards, Computer Passwords and Electronic Commerce.
Cryptology prior to the modern age was almost synonymous with encryption, the conversion of information from a readable state to nonsense. The sender retained the ability to decrypt the information and therefore avoid unwanted persons being able to read it. Since WWI and the advent of the computer, the methods used to carry out cryptology have become increasingly complex and its application more widespread.
Uses of Cryptography:
For Authentication – Cryptography can be used for Authentication of Data or a Message.
Integrity – Using Cryptography, One can make out if the Data or Message has been Tampered or Altered.
Non-repudiation – Cryptography also ensures Responsibility and Accountability from the Sender.
Cryptography can also be used for:
- Secure Communication in a Public Network
- Authentication of Claims
Symmetric-Key Cryptography:
Symmetric-key cryptography refers to encryption methods in which both the sender and receiver share the same key (or, less commonly, in which their keys are different, but related in an easily computable way).
Symmetric-Key Ciphers are of 2 Types:
- Block Ciphers
- Steam Ciphers
Block Ciphers
A block cipher is, in a sense, a modern embodiment of Alberti's polyalphabetic cipher: block ciphers take as input a block of plaintext and a key, and output a block of ciphertext of the same size. Since messages are almost always longer than a single block, some method of knitting together successive blocks is required. Several have been developed, some with better security in one aspect or another than others. They are the modes of operation and must be carefully considered when using a block cipher in a cryptosystem.
Examples of Block Ciphers:
Many other block ciphers have been designed and released, with considerable variation in quality. Many have been thoroughly broken.
Steam Ciphers
Stream ciphers, in contrast to the 'block' type, create an arbitrarily long stream of key material, which is combined with the plaintext bit-by-bit or character-by-character, somewhat like the one-time pad. In a stream cipher, the output stream is created based on a hidden internal state which changes as the cipher operates. That internal state is initially set up using the secret key material.
Examples of Steam Ciphers:
Asymmetric-Key Cryptography:
Asymmetric algorithms use pairs of keys. One is used for encryption and the other one for decryption. The decryption key is typically kept secret, therefore called “private key”, while the encryption key is spread to all who might want to send encrypted messages, therefore called “public key”. Everybody having the public key is able to send encrypted messages to the owner of the secret key. The secret key can't be reconstructed from the public key. The idea of asymmetric algorithms was first published 1976 by Diffie and Hellmann.
Public-key Cryptography
In a groundbreaking 1976 paper, Whitfield Diffie and Martin Hellman proposed the notion of public-key (also, more generally, called asymmetric key) cryptography in which two different but mathematically related keys are used—a public key and a private key.
- A public key system is so constructed that calculation of one key (the 'private key') is computationally infeasible from the other (the 'public key'), even though they are necessarily related. Instead, both keys are generated secretly, as an interrelated pair.
- In public-key cryptosystems, the public key may be freely distributed, while its paired private key must remain secret. The public key is typically used for encryption, while the private or secret key is used for decryption. Diffie and Hellman showed that public-key cryptography was possible by presenting the Diffie–Hellman key exchange protocol.
In addition to encryption, public-key cryptography can be used to implement digital signature schemes. A digital signature is reminiscent of an ordinary signature; they both have the characteristic that they are easy for a user to produce, but difficult for anyone else to forge.
Diffie–Hellman Key Exchange
- Diffie–Hellman key exchange (D–H) is a specific method of exchanging keys. It is one of the earliest practical examples of Key exchange implemented within the field of cryptography. The Diffie–Hellman key exchange method allows two parties that have no prior knowledge of each other to jointly establish a shared secret key over an insecure communications channel. This key can then be used to encrypt subsequent communications using a symmetric key cipher. It is a type of key exchange.
- Although Diffie–Hellman key agreement itself is an anonymous (non-authenticated) key-agreement protocol, it provides the basis for a variety of authenticated protocols, and is used to provide perfect forward secrecy in Transport Layer Security's ephemeral modes (referred to as EDH or DHE depending on the cipher suite).
Hash Functions
- A cryptographic hash function is a deterministic procedure that takes an arbitrary block of data and returns a fixed-size bit string, the (cryptographic) hash value, such that an accidental or intentional change to the data will change the hash value. The data to be encoded is often called the "message", and the hash value is sometimes called the message digest or simply digest.
- The ideal cryptographic hash function has four main or significant properties:
- It is easy to compute the hash value for any given message,
- It is infeasible to find a message that has a given hash,
- It is infeasible to modify a message without changing its hash,
- It is infeasible to find two different messages with the same hash.
Digital Signatures
- A Digital signature or digital signature scheme is a mathematical scheme for demonstrating the authenticity of a digital message or document. A valid digital signature gives a recipient reason to believe that the message was created by a known sender, and that it was not altered in transit. Digital signatures are commonly used for software distribution, financial transactions, and in other cases where it is important to detect forgery and tampering.
- Digital signatures employ a type of asymmetric cryptography. For messages sent through an insecure channel, a properly implemented digital signature gives the receiver reason to believe the message was sent by the claimed sender. Digital signatures can also provide non-repudiation, meaning that the signer cannot successfully claim they did not sign a message, while also claiming their private key remains secret; further, some non-repudiation schemes offer a time stamp for the digital signature, so that even if the private key is exposed, the signature is valid nonetheless. Digitally signed messages may be anything representable as a bitstring: examples include electronic mail, contracts, etc.
Certificate Authority
- Certificate authority or certification authority (CA) is an entity that issues digital certificates. The digital certificate certifies the ownership of a public key by the named subject of the certificate. This allows others (relying parties) to rely upon signatures or assertions made by the private key that corresponds to the public key that is certified. In this model of trust relationships, a CA is a trusted third party that is trusted by both the subject (owner) of the certificate and the party relying upon the certificate. CAs are characteristic of many public key infrastructure (PKI) schemes.
- Commercial CAs charge to issue certificates that will automatically be trusted by most web browsers (Mozilla maintains a list of at least 36 trusted root CAs, though multiple commercial CAs or their resellers may share the same trusted root).
- Aside from commercial CAs, some providers issue digital certificates to the public at no cost. Large institutions or government entities may have their own CAs.
Cryptanalysis:
- The goal of cryptanalysis is to find some weakness or insecurity in a cryptographic scheme, thus permitting its subversion or evasion.
- It is a common misconception that every encryption method can be broken. In connection with his WWII work at Bell Labs, Claude Shannon proved that the one-time pad cipher is unbreakable, provided the key material is truly random, never reused, kept secret from all possible attackers, and of equal or greater length than the message.
- Most ciphers, apart from the one-time pad, can be broken with enough computational effort by brute force attack, but the amount of effort needed may be exponentially dependent on the key size, as compared to the effort needed to use the cipher. In such cases, effective security could be achieved if it is proven that the effort required (i.e., "work factor", in Shannon's terms) is beyond the ability of any adversary. This means it must be shown that no efficient method (as opposed to the time-consuming brute force method) can be found to break the cipher. Since no such showing can be made currently, as of today, the one-time-pad remains the only theoretically unbreakable cipher.
Cryptography Attacks
- Known plaintext attack: In a known plaintext attack, an attacker should have both the plaintext and ciphertext of one or more messages. These two items are used to extract the cryptographic key and recover the encrypted text.
- Ciphertext only attack: In this attack, an attacker obtains encrypted messages that have been encrypted using the same encryption algorithm. Such types of attacks do not require the attacker to have the plaintext because the statistical analysis of the sniffed log is enough.
- Man-in-the-middle attack: In this form of attack, an attacker places himself in the middle of the communications flow between two parties. Once an attacker enters the communications flow, he is able to perform a ciphertext only attack, etc.
- Replay attack: In this type of attack, an attacker tries to repeat or delay a cryptographic transmission. A replay attack can be prevented using session tokens.
- Chosen plaintext attack: In a chosen plaintext attack, an attacker somehow picks up the information to be encrypted and takes a copy of it with the encrypted data. This is used to find patterns in the cryptographic output that might uncover a vulnerability or reveal a cryptographic key.
- Brute Force
Disk encryption:
- Disk encryption works similarly to text message encryption.
- With the use of an encryption program for your disk, you can safeguard any, and all, information burned onto the disk and keep it from falling into the wrong hands.
- Encryption for disks is incredibly useful if and when you need to send sensitive information through the mail.
RSA(Rivest,Shamir,Adleman):
- RSA (which stands for Rivest, Shamir and Adleman who first publicly described it) is an algorithm for public-key cryptography.
- It is the first algorithm known to be suitable for signing as well as encryption, and was one of the first great advances in public key cryptography. RSA is widely used in electronic commerce protocols, and is believed to be secure given sufficiently long keys and the use of up-to-date implementations.
RSA Attacks:
- Brute forcing RSA Factoring
- Esoteric attack
- Chosen ciphertext attack
- Low encryption exponent attack
- Error analysis
MD5:
- MD5 (Message-Digest Algorithm 5) is a widely used cryptographic hash function with a 128-bit hash value.
- MD5 has been employed in a wide variety of security applications, and is also commonly used to check the integrity of files. However, it has been shown that MD5 is not collision resistant.
- MD5 is not suitable for applications like SSL certificates or digital signatures that rely on this property. An MD5 hash is typically expressed as a 32-digit hexadecimal number.
SSL(Secure Socket Layer):
- SSL stands for Secure Sockets Layer and is a protocol developed by Netscape for transmitting private documents via the Internet.
- SSL works by using a private key to encrypt data that is then transferred over the SSL connection.
- The SSL Protocol is application protocol independent.
PGP Pretty Good Privacy:
- Pretty Good Privacy (PGP) is a data encryption and decryption computer program that provides cryptographic privacy and authentication for data communication. PGP is often used for signing, encrypting and decrypting e-mails to increase the security of e-mail communications. It was created by Philip Zimmermann in 1991.
- PGP and similar products follow the OpenPGP standard (RFC 4880) for encrypting and decrypting data.
- PGP encryption uses a serial combination of hashing, data compression, symmetric-key cryptography, and, finally, public-key cryptography; each step uses one of several supported algorithms. Each public key is bound to a user name and/or an e-mail address. The first version of this system was generally known as a web of trust to contrast with the X.509 system which uses a hierarchical approach based on certificate authority and which was added to PGP implementations later. Current versions of PGP encryption include both options through an automated key management server.
SSH:
- The program, SSH (Secure Shell), is a secure replacement for telnet and the Berkeley r-utilities (rlogin, rsh, rcp and rdist).
- It provides an encrypted channel for logging into another computer over a network, executing commands on a remote computer, and moving files from one computer to another.
- SSH provides a strong host-to-host and user authentication as well as secure encrypted communications over an insecure internet.
- SSH2 is a more secure, efficient and portable version of SSH that includes SFTP, an SSH2 tunneled FTP.