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_k开发者_如何学Cey(16, "MAC" + passphrase);
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
精彩评论