Security in General
The key concepts related to security in computing: hashing, symmetric encryption, asymmetric encryption, digital signatures, SSL/TLS protocol flow, and OAuth 2.0 flow.
1. Hashing
- Purpose: Hashing is a one-way function used to convert data into a fixed-size hash value, which is typically used for data integrity verification.
- Characteristics:
- Deterministic: The same input always produces the same output.
- Irreversible: It should be computationally infeasible to reverse the hash to retrieve the original data.
- Collision-resistant: Two different inputs should not produce the same hash output (though some algorithms like MD5 and SHA-1 are now considered weak).
- Common Algorithms: MD5, SHA-1, SHA-256, SHA-3.
2. Symmetric Encryption
- Purpose: Symmetric encryption uses the same key for both encryption and decryption, making it efficient but requiring secure key distribution.
- Use Cases: Encrypting data at rest, encrypting data in transit (e.g., SSL/TLS), and securing communication channels.
- Common Algorithms: AES (Advanced Encryption Standard), DES (Data Encryption Standard), 3DES (Triple DES).
- Example:
- Encryption:
Ciphertext = Encrypt(Plaintext, Key)
- Decryption:
Plaintext = Decrypt(Ciphertext, Key)
- Encryption:
3. Asymmetric Encryption
- Purpose: Asymmetric encryption uses a pair of keys (public and private). The public key encrypts the data, and only the corresponding private key can decrypt it.
- Use Cases: Secure key exchange, digital signatures, SSL/TLS handshakes, email encryption (e.g., PGP).
- Common Algorithms: RSA, ECC (Elliptic Curve Cryptography), DSA (Digital Signature Algorithm).
- Example:
- Encryption:
Ciphertext = Encrypt(Plaintext, PublicKey)
- Decryption:
Plaintext = Decrypt(Ciphertext, PrivateKey)
- Encryption:
4. Digital Signature
- Purpose: A digital signature is a cryptographic mechanism used to verify the authenticity and integrity of a message or document. It confirms that the message was sent by the claimed sender (non-repudiation) and has not been altered.
- Process:
- The sender hashes the original data and then encrypts the hash using their private key to create a digital signature.
- The recipient uses the sender's public key to decrypt the signature and compares it with a hash of the received data. If they match, the data is verified.
- Common Algorithms: RSA, ECDSA (Elliptic Curve Digital Signature Algorithm).
5. SSL/TLS Protocol Flow
- Purpose: SSL/TLS (Secure Sockets Layer / Transport Layer Security) provides secure communication over a computer network by encrypting the data transmitted between a client (e.g., a web browser) and a server.
- Flow:
- Client Hello: The client sends a message to the server, including supported cipher suites and the highest TLS version it supports.
- Server Hello: The server responds with its chosen cipher suite and TLS version, and sends its digital certificate containing its public key.
- Client Key Exchange: The client generates a symmetric session key, encrypts it with the server's public key, and sends it to the server.
- Server Key Exchange: The server decrypts the session key using its private key.
- Session: Both the client and server use the symmetric session key to encrypt and decrypt the data for the rest of the session.
6. OAuth 2.0 Flow
- Purpose: OAuth 2.0 is an authorization framework that allows third-party applications to obtain limited access to user accounts on an HTTP service, without exposing the user's credentials.
- Flow:
- Authorization Request: The client (e.g., a web application) requests authorization from the user to access resources on their behalf.
- Authorization Grant: The user approves the request and the client receives an authorization grant (e.g., a code).
- Token Exchange: The client exchanges the authorization grant for an access token by sending the code to the authorization server.
- Access Resource: The client uses the access token to access protected resources on the resource server.
- Refresh Token: If the access token expires, the client can use a refresh token to obtain a new access token without user intervention.
These concepts form the foundation of modern security practices in software development and communication. They are often used together to ensure secure data transmission, authentication, and authorization.
Comments
Post a Comment