Tuesday, May 17, 2005

Crypto Refresh.

I 'm refreshing my knowledge on applied cryptography.

Symetric cryptography:
  • Symmetric/public key crypto: parties share a secret, for instance an encryption key. Shared secrets must be communicated securely (with appropriate public/private key crypto, agreed upon generated key after secret signing, via a third party, etc... methods abound.)
  • Two set of primitives: symetric encryption algorithms (ensure data secrecy) and message authentication codes (MACs) to ensure data transmission integrity.
Example of an symetric encryption scheme:
  • A block cipher mode and encryption method must be selected
  • A key is picked, for instance, a password can be used to generate a key (involves salt, iteration numbers.)
  • The block cipher mode determines how the the encryption method will be used. For instance, it can be choosen to prevent the same unencrypted input from yielding the same crypted output (better resitance to dictionary attacks.) For instance one could XOR the first chunk with a randomly generated string (an IV: initialization vector, which has to be transmitted) and then have this block encrypted. For the next block use the previously encrypted block for the XOR operation (this is how CBC works -- just encrypting blocks as they come is ECB, a bad block cypher mode.)
  • At the heart of the modern computerized encryption schemes are Feistel rounds which use permutation boxes, substitution box (S-boxes) on subkeys and the data to encrypt to achieve Shannon's confusion and diffusion.
  • Recommendation would be to use CBC/AES.
  • Outside of block cipher mode consideration, decryption is achieved by either running the same encryption scheme on the encrypted data, or by running a dedicated decryption function.
Hashes and messages authentification codes (MACs):
  • Cryptographic hash function: process input and produce a fixed sized output (hash value or message digest.) Properties: one wayness, noncorrelation (bit flip resistant) weak/strong/partial collision resistance.
  • Universal hash function: keyed hashes.
  • MAC: hash function processing a message with a secret key (+ possible nonce) to give output that can't be obtained without the key.
Public key cryptography, digital signature:
  • Involves large prime numbers and factorisation properties.
  • Allows for key agreement, digital signature and identity establishement.
  • Note that its 1000 times slower than symetric key cryptography when comparison is applicable.
  • RSA (does all) Diffie-Hellman and DSA (digital signatures only.)
  • Public/private key crypto: your public key is available to parties use to encrypt data that only you and your private key can decrypt.
  • PKI is used to establish trust between entities. Before using a public key, you must be sure it belongs to who you want to send a message to. Signature: a document is hashed, and the result encoded with your private key. Parties can use your public key to retrieve the hash and compare it to what it's expected to be. If the hash can be decrypted with your public key, you must be the one that signed it with your private key.
Signing and encrypting with public/private keys:
  • Concatenate the recipient's public key with the message and sign/encrypt the result
  • Simply signing and encrypting the signature and the message doesn't work as an intermediary can re-sign with somebody else's public key.
Key and certificates encoding:
  • Keys and certificates can be encoded to a binary object (DER: Distinguished Encoding Rules encoding)
  • Keys and certificates can be encoded to plaintext (PEM: Privacy Enhanced Mail encoding)
Authentication and Key Exchange:
Further read here. A nice concise presentation on some crypto basics here.

Labels:

0 Comments:

Post a Comment

<< Home