Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Initialization vector
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Short description|Input to a cryptographic primitive}} In [[cryptography]], an '''initialization vector''' ('''IV''') or '''starting variable'''<ref>ISO/IEC 10116:2006 ''Information technology — Security techniques — Modes of operation for an ''n''-bit block cipher''</ref> is an input to a [[cryptographic primitive]] being used to provide the initial state. The IV is typically required to be [[random]] or [[pseudorandom]], but sometimes an IV only needs to be unpredictable or unique. [[Randomization]] is crucial for some [[encryption]] schemes to achieve [[semantic security]], a property whereby repeated usage of the scheme under the same [[cryptographic key|key]] does not allow an attacker to infer relationships between (potentially similar) segments of the encrypted message. For [[block cipher]]s, the use of an IV is described by the [[Block cipher mode of operation|modes of operation]]. Some cryptographic primitives require the IV only to be non-repeating, and the required randomness is derived internally. In this case, the IV is commonly called a [[cryptographic nonce|nonce]] (a number used only once), and the primitives (e.g. [[Block_cipher_mode_of_operation#CBC|CBC]]) are considered ''stateful'' rather than ''randomized''. This is because an IV need not be explicitly forwarded to a recipient but may be derived from a common state updated at both sender and receiver side. (In practice, a short nonce is still transmitted along with the message to consider message loss.) An example of stateful encryption schemes is the [[counter mode]] of operation, which has a [[sequence number]] for a nonce. The IV size depends on the cryptographic primitive used; for block ciphers it is generally the cipher's block-size. In encryption schemes, the unpredictable part of the IV has at best the same size as the key to compensate for time/memory/data tradeoff attacks.<ref>{{cite journal |author = Alex Biryukov |title = Some Thoughts on Time-Memory-Data Tradeoffs |journal = IACR ePrint Archive |year = 2005 |url = http://eprint.iacr.org/2005/207 }}</ref><ref>{{cite journal |author1 = Jin Hong |author2 = Palash Sarkar |title = Rediscovery of Time Memory Tradeoffs |journal = IACR ePrint Archive |year = 2005 |url = http://eprint.iacr.org/2005/090 }}</ref><ref>{{cite conference | last1 = Biryukov | first1 = Alex | last2 = Mukhopadhyay | first2 = Sourav | last3 = Sarkar | first3 = Palash | editor1-last = Preneel | editor1-first = Bart | editor2-last = Tavares | editor2-first = Stafford E. | contribution = Improved Time-Memory Trade-Offs with Multiple Data | doi = 10.1007/11693383_8 | pages = 110–127 | publisher = Springer | series = Lecture Notes in Computer Science | title = Selected Areas in Cryptography, 12th International Workshop, SAC 2005, Kingston, ON, Canada, August 11-12, 2005, Revised Selected Papers | volume = 3897 | year = 2005| doi-access = free | isbn = 978-3-540-33108-7 }}</ref><ref name="ECRYPT">{{cite tech report |author1 = Christophe De Cannière |author2 = Joseph Lano |author3 = Bart Preneel |title = Comments on the Rediscovery of Time/Memory/Data Trade-off Algorithm |institution = ECRYPT Stream Cipher Project |number = 40 |year = 2005 |url = http://www.ecrypt.eu.org/stream/papersdir/040.pdf }}</ref> When the IV is chosen at random, the probability of collisions due to the [[birthday problem]] must be taken into account. Traditional stream ciphers such as [[RC4]] do not support an explicit IV as input, and a custom solution for incorporating an IV into the cipher's key or internal state is needed. Some designs realized in practice are known to be insecure; the [[Wired Equivalent Privacy|WEP]] protocol is a notable example, and is prone to related-IV attacks. ==Motivation== [[File:Tux ECB.png|thumb|Insecure encryption of an image as a result of [[electronic codebook]] mode encoding.]] A [[block cipher]] is one of the most basic [[cryptographic primitive|primitive]]s in cryptography, and frequently used for data [[encryption]]. However, by itself, it can only be used to encode a data block of a predefined size, called the [[block size (cryptography)|block size]]. For example, a single invocation of the [[Advanced Encryption Standard|AES]] algorithm transforms a 128-bit [[plaintext]] block into a [[ciphertext]] block of 128 bits in size. The [[cryptographic key|key]], which is given as one input to the cipher, defines the mapping between plaintext and ciphertext. If data of arbitrary length is to be encrypted, a simple strategy is to split the data into blocks each matching the cipher's block size, and encrypt each block separately using the same key. This method is not secure as equal plaintext blocks get transformed into equal ciphertexts, and a third party observing the encrypted data may easily determine its content even when not knowing the encryption key. To hide patterns in encrypted data while avoiding the re-issuing of a new key after each block cipher invocation, a method is needed to [[randomization|randomize]] the input data. In 1980, the [[National Institute of Standards and Technology|NIST]] published a national standard document designated [[Federal Information Processing Standard]] (FIPS) PUB 81, which specified four so-called [[Block cipher mode of operation|block cipher modes of operation]], each describing a different solution for encrypting a set of input blocks. The first mode implements the simple strategy described above, and was specified as the [[electronic codebook]] (ECB) mode. In contrast, each of the other modes describe a process where ciphertext from one block encryption step gets intermixed with the data from the next encryption step. To initiate this process, an additional input value is required to be mixed with the first block, and which is referred to as an ''initialization vector''. For example, the [[cipher-block chaining]] (CBC) mode requires an unpredictable value, of size equal to the cipher's block size, as additional input. This unpredictable value is added to the first plaintext block before subsequent encryption. In turn, the ciphertext produced in the first encryption step is added to the second plaintext block, and so on. The ultimate goal for encryption schemes is to provide [[semantic security]]: by this property, it is practically impossible for an attacker to draw any knowledge from observed ciphertext. It can be shown that each of the three additional modes specified by the NIST are semantically secure under so-called [[chosen-plaintext attack]]s. ==Properties== Properties of an IV depend on the cryptographic scheme used. A basic requirement is ''uniqueness'', which means that no IV may be reused under the same key. For block ciphers, repeated IV values devolve the encryption scheme into electronic codebook mode: equal IV and equal plaintext result in equal ciphertext. In [[stream cipher]] encryption uniqueness is crucially important as plaintext may be trivially recovered otherwise. :'''''Example:''''' Stream ciphers encrypt plaintext ''P'' to ciphertext ''C'' by deriving a key stream ''K'' from a given key and IV and computing ''C'' as ''C'' = ''P'' xor ''K''. Assume that an attacker has observed two messages ''C''<sub>1</sub> and ''C''<sub>2</sub> both encrypted with the same key and IV. Then knowledge of either ''P''<sub>1</sub> or ''P''<sub>2</sub> reveals the other plaintext since ::''C''<sub>1</sub> xor ''C''<sub>2</sub> = (''P''<sub>1</sub> xor K) xor (''P''<sub>2</sub> xor K) = ''P''<sub>1</sub> xor ''P''<sub>2</sub>. Many schemes require the IV to be ''unpredictable'' by an [[adversary (cryptography)|adversary]]. This is effected by selecting the IV at [[random]] or [[pseudo-random]]ly. In such schemes, the chance of a duplicate IV is [[negligible function|negligible]], but the effect of the [[birthday problem]] must be considered. As for the uniqueness requirement, a predictable IV may allow recovery of (partial) plaintext. :'''''Example:''''' Consider a scenario where a legitimate party called Alice encrypts messages using the cipher-block chaining mode. Consider further that there is an adversary called Eve that can observe these encryptions and is able to forward plaintext messages to Alice for encryption (in other words, Eve is capable of a [[chosen-plaintext attack]]). Now assume that Alice has sent a message consisting of an initialization vector ''IV''<sub>1</sub> and starting with a ciphertext block ''C<sub>Alice</sub>''. Let further ''P<sub>Alice</sub>'' denote the first plaintext block of Alice's message, let ''E'' denote encryption, and let ''P<sub>Eve</sub>'' be Eve's guess for the first plaintext block. Now, if Eve can determine the initialization vector ''IV''<sub>2</sub> of the next message she will be able to test her guess by forwarding a plaintext message to Alice starting with (''IV''<sub>2</sub> xor ''IV''<sub>1</sub> xor ''P<sub>Eve</sub>''); if her guess was correct this plaintext block will get encrypted to ''C<sub>Alice</sub>'' by Alice. This is because of the following simple observation: ::''C<sub>Alice</sub>'' = ''E''(''IV''<sub>1</sub> xor ''P<sub>Alice</sub>'') = ''E''(''IV''<sub>2</sub> xor (''IV''<sub>2</sub> xor ''IV''<sub>1</sub> xor ''P<sub>Alice</sub>'')).<ref>[http://cwe.mitre.org/data/definitions/329.html CWE-329: Not Using a Random IV with CBC Mode]</ref> Depending on whether the IV for a cryptographic scheme must be random or only unique the scheme is either called ''randomized'' or ''stateful''. While randomized schemes always require the IV chosen by a sender to be forwarded to receivers, stateful schemes allow sender and receiver to share a common IV state, which is updated in a predefined way at both sides. ==Block ciphers== Block cipher processing of data is usually described as a mode of operation. Modes are primarily defined for encryption as well as [[authentication]], though newer designs exist that combine both security solutions in so-called [[authenticated encryption]] modes. While encryption and authenticated encryption modes usually take an IV matching the cipher's block size, authentication modes are commonly realized as [[deterministic algorithm]]s, and the IV is set to zero or some other fixed value. ==Stream ciphers== In stream ciphers, IVs are loaded into the keyed internal secret state of the cipher, after which a number of cipher rounds are executed prior to releasing the first bit of output. For performance reasons, designers of stream ciphers try to keep that number of rounds as small as possible, but because determining the minimal secure number of rounds for stream ciphers is not a trivial task, and considering other issues such as [[Information entropy|entropy]] loss, unique to each cipher construction, related-IVs and other IV-related attacks are a known security issue for stream ciphers, which makes IV loading in stream ciphers a serious concern and a subject of ongoing research. == WEP IV == The [[802.11]] [[encryption]] [[algorithm]] called WEP (short for [[Wired Equivalent Privacy]]) used a short, 24-bit IV, leading to reused IVs with the same key, which led to it being easily cracked.<ref name="Intercepting_Mobile_Comm_Nik_Ian_Dav">{{cite web |first1=Nikita |last1=Borisov |author-link1=Nikita Borisov |first2=Ian |last2=Goldberg |author-link2=Ian Goldberg |first3=David |last3=Wagner |author-link3=David A. Wagner |title = Intercepting Mobile Communications: The Insecurity of 802.11 |url = http://www.isaac.cs.berkeley.edu/isaac/mobicom.pdf |access-date = 2006-09-12 }}</ref> [[Packet injection]] allowed for WEP to be cracked in times as short as several seconds. This ultimately led to the deprecation of WEP. == SSL 2.0 IV == In [[Block cipher mode of operation#Cipher_block_chaining_(CBC)|cipher-block chaining mode]] (CBC mode), the IV need not be secret, but must be unpredictable (In particular, for any given plaintext, it must not be possible to predict the IV that will be associated to the plaintext in advance of the generation of the IV.) at encryption time. Additionally for the [[Block cipher mode of operation#OFB|output feedback mode]] (OFB mode), the IV must be unique.<ref>{{citation |author = Morris Dworkin |title = NIST Recommendation for Block Cipher Modes of Operation; Chapters 6.2 and 6.4 |date = 2001 |url = https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38a.pdf }}</ref> In particular, the (previously) common practice of re-using the last ciphertext block of a message as the IV for the next message is insecure (for example, this method was used by SSL 2.0). If an attacker knows the IV (or the previous block of ciphertext) before he specifies the next plaintext, he can check his guess about plaintext of some block that was encrypted with the same key before. This is known as the TLS CBC IV attack, also called the [[Transport Layer Security#BEAST attack|BEAST attack]].<ref>{{citation |author = B. Moeller |title = Security of CBC Ciphersuites in SSL/TLS: Problems and Countermeasures |date = May 20, 2004 |url = http://www.openssl.org/~bodo/tls-cbc.txt |access-date = September 1, 2014 |archive-date = June 30, 2012 |archive-url = https://web.archive.org/web/20120630143111/http://www.openssl.org/~bodo/tls-cbc.txt |url-status = dead }}</ref> == See also == * [[Cryptographic nonce]] * [[Padding (cryptography)]] * [[Random seed]] * [[Salt (cryptography)]] * [[Block cipher mode of operation|Block cipher modes of operation]] * [[CipherSaber]] (RC4 with IV) == References == {{Reflist}} == Further reading == * {{cite book |first = B. |last = Schneier |author-link = Bruce Schneier |title = Applied Cryptography |url = https://archive.org/details/Applied_Cryptography_2nd_ed._B._Schneier |location = New York |publisher = Wiley |year = 1996 |edition = 2nd |isbn = 978-0-471-12845-8 }} * {{cite book |first1 = N. |last1 = Ferguson |first2 = B. |last2 = Schneier |title = Practical Cryptography |location = New York |publisher = Wiley |year = 2003 |isbn = 978-0-471-22894-3 }} {{Cryptography navbox | block | stream}} [[Category:Block cipher modes of operation]] [[Category:Cryptography]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:Citation
(
edit
)
Template:Cite book
(
edit
)
Template:Cite conference
(
edit
)
Template:Cite journal
(
edit
)
Template:Cite tech report
(
edit
)
Template:Cite web
(
edit
)
Template:Cryptography navbox
(
edit
)
Template:Reflist
(
edit
)
Template:Short description
(
edit
)