Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is an s2k algorithm?

What is the definition of an s2k algorithm? For example, "PBKDF2(SHA-1)" is an s2k algorithm.

Here is some Botan code that refers to s2k:

  AutoSeeded_RNG rng;

  std::auto_ptr<S2K> s2k(get_s2k("PBKDF2(SHA-1)"));
  s2k->set_iterations(8192);
  s2k->new_random_salt(rng, 8);

  SymmetricKey bc_key = s2k->derive_key(key_len, "BLK" + passphrase);
  InitializationVector iv = s2k->derive_key(iv_len, "IVL" + passphrase);
  SymmetricKey mac_key = s2k->derive_key(16, "MAC" + passphrase);
like image 330
WilliamKF Avatar asked May 16 '10 21:05

WilliamKF


1 Answers

String-to-key (S2K) specifiers are used to convert passphrase strings into symmetric-key encryption/decryption keys. They are used in two places, currently: to encrypt the secret part of private keys in the private keyring, and to convert passphrases to encryption keys for symmetrically encrypted messages.

Source (with more details): http://sunsite.icm.edu.pl/gnupg/rfc2440-3.html

like image 137
mikerobi Avatar answered Sep 17 '22 13:09

mikerobi