利用者:T4NeGMp7P4en/キーストレッチング
ここはT4NeGMp7P4enさんの利用者サンドボックスです。編集を試したり下書きを置いておいたりするための場所であり、百科事典の記事ではありません。ただし、公開の場ですので、許諾されていない文章の転載はご遠慮ください。
登録利用者は自分用の利用者サンドボックスを作成できます(サンドボックスを作成する、解説)。 この利用者の下書き:1、2、事前共有鍵、S/KEY、キーストレッチング、チャレンジレスポンス認証 その他のサンドボックス: 共用サンドボックス | モジュールサンドボックス 記事がある程度できあがったら、編集方針を確認して、新規ページを作成しましょう。 |
en:Key stretchingより翻訳のため転記
Template:More citations needed
In cryptography, key stretching techniques are used to make a possibly weak key, typically a password or passphrase, more secure against a brute-force attack by increasing the resources (time and possibly space) it takes to test each possible key. Passwords or passphrases created by humans are often short or predictable enough to allow password cracking, and key stretching is intended to make such attacks more difficult by complicating a basic step of trying a single password candidate. Key stretching also improves security in some real-world applications where the key length has been constrained, by mimicking a longer key length from the perspective of a brute-force attacker.[1]
There are several ways to perform key stretching. One way is to apply a cryptographic hash function or a block cipher repeatedly in a loop. For example, in applications where the key is used for a cipher, the key schedule in the cipher may be modified so that it takes a specific length of time to perform. Another way is to use cryptographic hash functions that have large memory requirements – these can be effective in frustrating attacks by memory-bound adversaries.[2]
Process
[編集]Key stretching algorithms depend on an algorithm which receives an input key and then expends considerable effort to generate a stretched cipher (called an enhanced key[要出典]) mimicking randomness and longer key length. The algorithm must have no known shortcut, so the most efficient way to relate the input and cipher is to repeat the key stretching algorithm itself. This compels brute-force attackers to expend the same effort for each attempt. If this added effort compares to a brute-force key search of all keys with a certain key length, then the input key may be described as stretched by that same length.[1]
Key stretching leaves an attacker with two options:
- Attempt possible combinations of the enhanced key, but this is infeasible if the enhanced key is sufficiently long and unpredictable ( i.e., the algorithm mimics randomness well enough that the attacker must trial the entire stretched key space)[3]
- Attempt possible combinations of the weaker initial key, potentially commencing with a dictionary attack if the initial key is a password or passphrase, but the attacker's added effort for each trial could render the attack uneconomic should the costlier computation and memory consumption outweigh the expected profit
If the attacker uses the same class of hardware as the user, each guess will take the similar amount of time to process as it took the user (for example, one second). Even if the attacker has much greater computing resources than the user, the key stretching will still slow the attacker down while not seriously affecting the usability of the system for any legitimate user. This is because the user's computer only has to compute the stretching function once upon the user entering their password, whereas the attacker must compute it for every guess in the attack.
This process does not alter the original key-space entropy. The key stretching algorithm is deterministic, allowing a weak input to always generate the same enhanced key, but therefore limiting the enhanced key to no more possible combinations than the input key space. Consequently, this attack remains vulnerable if unprotected against certain time-memory tradeoffs such as developing rainbow tables to target multiple instances of the enhanced key space in parallel (effectively a shortcut to repeating the algorithm). For this reason, key stretching is often combined with salting.[1]
Hash-based
[編集]Many libraries provide functions which perform key stretching as part of their function; see crypt(3) for an example.[4] PBKDF2 is for generating an encryption key from a password, and not necessarily for password authentication. PBKDF2 can be used for both if the number of output bits is less than or equal to the internal hashing algorithm used in PBKDF2, which is usually SHA-2 (up to 512 bits), or used as an encryption key to encrypt static data.[5]
Strength and time
[編集]These examples assume that a consumer CPU can do about 65,000 SHA-1 hashes in one second. Thus, a program that uses key stretching can use 65,000 rounds of hashes and delay the user for at most one second.
Testing a trial password or passphrase typically requires one hash operation. But if key stretching was used, the attacker must compute a strengthened key for each key they test, meaning there are 65,000 hashes to compute per test. This increases the attacker's workload by a factor of 65,000, approximately 216, which means the enhanced key is worth about 16 additional bits in key strength.
Moore's law asserts that computer speed doubles roughly every 2 years. Under this assumption, every 2 years one more bit of key strength is plausibly brute-forcible. This implies that 16 extra bits of strength is worth about 16×2 = 32 years later cracking, but it also means that the number of key stretching rounds a system uses should be doubled about every 2 years to maintain the same level of security (since most keys are more secure than necessary, systems that require consistent deterministic key generation will likely not update the number of iterations used in key stretching. In such a case, the designer should take into consideration how long they wish for the key derivation system to go unaltered and should choose an appropriate number of hashes for the lifespan of the system).
CPU-bound hash functions are still vulnerable to hardware implementations. Such implementations of SHA-1 exist using as few as 5,000 gates, and 400 clock cycles.[6] With multi-million gate FPGAs costing less than $100,[7] an attacker can build a fully unrolled hardware cracker for about $5,000.[要出典] Such a design, clocked at 100 MHz can test about 300,000 keys/second. The attacker is free to choose a good price/speed compromise, for example a 150,000 keys/second design for $2,500.[要出典] The key stretching still slows down the attacker in such a situation; a $5,000 design attacking a straight SHA-1 hash would be able to try 300,000÷216 ≈ 4.578 keys/second.[要出典]
Similarly, modern consumer GPUs can speed up hashing considerably. For example, in a benchmark, a Nvidia RTX 2080 SUPER FE computes over 10 billion SHA1 hashes per second.[8]
To defend against the hardware approach, memory-bound cryptographic functions have been developed. These functions access a lot of memory in a way that makes caching ineffective. Since large amounts of low latency memory are expensive, potential attackers are discouraged from pursuing such attacks.
History
[編集]The first deliberately slow password-based key derivation function "CRYPT" was described in 1978 by Robert Morris for encrypting Unix passwords.[9] It used an iteration count of 25, a 12-bit salt and a variant of DES as the sub-function. (DES proper was avoided in an attempt to frustrate attacks using standard DES hardware.) Passwords were limited to a maximum of eight ASCII characters. While it was a great advancement for its time, CRYPT(3) is now considered inadequate. The iteration count, designed for the PDP-11 era, is too low, 12 bits of salt is an inconvenience but does not stop precomputed dictionary attacks, and the eight-character limit prevents the use of stronger passphrases.
Modern password-based key derivation functions, such as PBKDF2, use a cryptographic hash, such as SHA-2, a longer salt (e.g. 64 bits) and a high iteration count. The U.S. National Institute of Standards and Technology (NIST) recommends a minimum iteration count of 10,000.[10]:5.1.1.2 "For especially critical keys, or for very powerful systems or systems where user-perceived performance is not critical, an iteration count of 10,000,000 may be appropriate.” [11]:5.2
In 2009, a memory-intensive key strengthening algorithm, scrypt, was introduced with the intention of limiting the use of custom, highly parallel hardware to speed up key testing.[12]
In 2013, a Password Hashing Competition was held to select an improved key stretching standard that would resist attacks from graphics processors and special purpose hardware. The winner, Argon2, was selected on July 1, 2015.[13]
Some systems that use key stretching
[編集]- Some but not all disk encryption software (see comparison of disk encryption software)
- 7-Zip[14]
- Apache .htpasswd "APR1" and OpenSSL "passwd" use 1000 rounds of MD5 key stretching.
- KeePass and KeePassXC, open-source password manager utilities. As of 2020, the latest version uses Argon2d with default 1 second key stretching delay.[15][16]
- Linux and some other Unix-like systems offer SHAcrypt modes that perform 5000 SHA256 or SHA512 hash iterations by default, with a minimum of 1000, and a maximum of 999,999,999.[17]
- Password Safe open-source password manager.
- PGP, GPG encryption software. GPG by default iterates a hash 65536 times.[18]
- Wi-Fi Protected Access (WPA and WPA2) wireless encryption protocol in personal mode used PBKDF2 with 4096 iterations. (WPA3 uses Simultaneous Authentication of Equals which claims to not expose password hashes.)
See also
[編集]- Key derivation function – often uses key stretching
- Hash chain
References
[編集]- ^ a b c Kelsey, John; Schneier, Bruce; Hall, Chris; Wagner, David (1998). Okamoto, Eiji; Davida, George; Mambo, Masahiro. eds. “Secure applications of low-entropy keys” (英語). Information Security (Berlin, Heidelberg: Springer): 121–134. doi:10.1007/BFb0030415. ISBN 978-3-540-69767-1 .
- ^ Reinhold, Arnold (1999年7月15日). “HEKS: A Family of Key Stretching Algorithms”. 2024年7月17日閲覧。
- ^ McMillan, Troy (2022-07-07) (英語). CompTIA Advanced Security Practitioner (CASP+) CAS-004 Cert Guide. Pearson IT Certification. ISBN 978-0-13-734870-1
- ^
crypt(3)
– FreeBSD Library Functions Manual Pages (en) - ^ Kaliski, B.; Rusch, A. (2017-01). Moriarty, K.. ed (英語). PKCS #5: Password-Based Cryptography Specification Version 2.1. doi:10.17487/rfc8018 .
- ^ O'Neill, Máire. “Low-cost SHA-1 Hash Function Architecture for RFID Tags”. 2012年3月19日時点のオリジナルよりアーカイブ。2010年8月8日閲覧。
- ^ “New 90nm Xilinx Spartan-3 FPGAs Reshape Semiconductor Landscape (0333) : Xilinx Press Releases”. 2011年7月16日時点のオリジナルよりアーカイブ。2010年8月8日閲覧。
- ^ Jeremi M Gosney (2019年7月27日). “PBKDF2-HMAC-SHA1 with 1,000 iterations costs 2,002 SHA-1 hashes at a speed of 5,164.9 kH/s which comes to 10,340,129,800 SHA-1 hashes per second.” (英語). Gist. 2020年1月2日閲覧。
- ^ “Password Security: A Case History.”. Bell Laboratories (1978年4月3日). 2003年3月22日時点のオリジナルよりアーカイブ。2011年5月9日閲覧。
- ^ Grassi, Paul A; Fenton, James L; Newton, Elaine M; Perlner, Ray A; Regenscheid, Andrew R; Burr, William E; Richer, Justin P; Lefkovitz, Naomi B et al. (2017-06-22). Digital identity guidelines: authentication and lifecycle management. Gaithersburg, MD. doi:10.6028/nist.sp.800-63b .
- ^ Turan, M S; Barker, E B; Burr, W E; Chen, L (2010) (英語). Recommendation for password-based key derivation :: part 1: storage applications. Gaithersburg, MD. doi:10.6028/nist.sp.800-132 .
- ^ Percival, Colin (2009). scrypt: A new key derivation function. BSDCan 2009. 2024年6月29日時点のオリジナルよりアーカイブ。
- ^ “Password Hashing Competition”. www.password-hashing.net. 2015年12月31日閲覧。
- ^ “7z Format”. 2021年2月15日閲覧。
- ^ Reichl, Dominik. “KDBX 4 - KeePass” (英語). keepass.info. 2020年11月30日閲覧。
- ^ “KeePassXC: User Guide”. keepassxc.org. 2020年11月30日閲覧。
- ^ Drepper, Ulrich. “Unix crypt using SHA-256 and SHA-512”. 2020年11月26日閲覧。
- ^ Finney, Hal; Donnerhacke, Lutz; Callas, Jon; Thayer, Rodney L.; Shaw, Daphne (2007-11). OpenPGP Message Format. doi:10.17487/rfc4880 .