NIST Special Publication 800-38C NIST Special 800-38C публикации
Recommendation for Block Рекомендация для блока
Cipher Modes of Operation: Cipher Режимы работы:
The CCM Mode for Режим CCM для
Authentication and Аутентификация и
Confidentiality Конфиденциальность
Morris Dworkin Моррис Дворкин
COMPUTERSECURITY COMPUTERSECURITY
Computer Security Division Отдел компьютерной безопасности
Information Technology Laboratory Лаборатория информационных технологий
National Institute of Standards and Technology Национальный институт стандартов и технологий
Gaithersburg, MD 20899-8930 Gaithersburg, MD 20899-8930
May 2004 Май 2004
US Department of Commerce Министерство торговли США
Donald L. Evans, Secretary Дональд Л. Эванс, секретарь
Technology Administration Технология Администрация
Phillip J. Bond, Under Secretary of Commerce for Technology Филипп J. Bond, заместитель министра торговли по технологии
National Institute of Standards and Technology Национальный институт стандартов и технологий
Arden L. Bement, Jr., Director Арден Л. Бемент, младший, директор
NIST Special Publication 800-38C NIST Special 800-38C публикации
Recommendation for Block Рекомендация для блока
Cipher Modes of Operation: The Cipher Режимы работы:
CCM Mode for Authentication Режим CCM для аутентификации
and Confidentiality и конфиденциальность
Morris Dworkin Моррис Дворкин
COMPUTERSECURITY COMPUTERSECURITY
Reports on Information Security Technology Отчеты о безопасности информационных технологий
The Information Technology Laboratory (ITL) at the National Institute of Standards and Техническая лаборатория Информация (ITL) в Национальном институте стандартов и
Technology (NIST) promotes the US economy and public welfare by providing technical Технологии США (NIST) способствует американскую экономику и общественное благосостояние, путем предоставления технической
leadership for the Nation's measurement and standards infrastructure. руководство для инфраструктуры измерения и стандартов нации. ITL develops tests, test ITL разрабатывает тесты, тест
methods, reference data, proof of concept implementations, and technical analyses to advance the методы, справочные данные, доказательство концепции реализации, и технический анализ для продвижения
development and productive use of information technology. разработка и продуктивное использование информационных технологий. ITL's responsibilities include the Обязанности ITL включают
development of technical, physical, administrative, and management standards and guidelines for разработка технических, физических, административных и стандартов и принципов управления
the cost-effective security and privacy of sensitive unclassified information in Federal computer рентабельную защиту и конфиденциальность чувствительной несекретных сведений в Федеральной компьютере
systems. системы. This Special Publication 800-series reports on ITL's research, guidance, and outreach Это специальная публикация отчетов 800-серии на ITL в исследовательской, методологии и охвата
efforts in computer security, and its collaborative activities with industry, government, and усилия в области компьютерной безопасности, и ее осуществление совместной деятельности с промышленностью, правительством, и
academic organizations. академические организации.
Certain commercial entities, equipment, or materials may be identified in this document in order to describe Некоторые коммерческие организации, оборудование или материалы могут быть идентифицированы в этом документе для описания
an experimental procedure or concept adequately. Экспериментальная процедура или концепция адекватно. Such identification is not intended to imply Такая идентификация не подразумевает
recommendation or endorsement by the National Institute of Standards and Technology, nor is it intended рекомендация или одобрение Национального института стандартов и технологий, а также не предназначено
to imply that the entities, materials, or equipment are necessarily the best available for the purpose. подразумевает, что лица, материалы или оборудование обязательно лучший средства для этой цели.
National Institute of Standards and Technology Special Publication 800-38C Национальный институт стандартов и технологии Специальный 800-38C публикации
Natl. Natl. Inst. Ин-т. Stand. Стенд. Technol. Technol. Spec. Spec. Publ. Изд. 800-38C 25 pages (May 2004) 800-38C 25 страниц (май 2004 г.)
CODEN: NSPUE2 CODEN: NSPUE2
Abstract Аннотация
This Recommendation defines a mode of operation, called CCM, for a symmetric key block В настоящей Рекомендации определяется режим работы под названием СКК, для симметричным ключом блока
cipher algorithm. алгоритм шифрования. CCM may be used to provide assurance of the confidentiality and the СКК могут быть использованы для обеспечения уверенности в конфиденциальности и
authenticity of computer data by combining the techniques of the Counter (CTR) mode and the Подлинность компьютерных данных путем объединения методов в борьбе (CTR) режим и
Cipher Block Chaining-Message Authentication Code (CBC-MAC) algorithm. Cipher Block Chaining-код проверки подлинности сообщения (CBC-MAC) алгоритм.
KEY WORDS: authenticated encryption; КЛЮЧЕВЫЕ СЛОВА: аутентификацию шифрования; authentication; аутентификации; block cipher; блочный шифр; confidentiality; конфиденциальность;
cryptography; криптография; encryption; шифрование; information security; информационная безопасность; message authentication code; код аутентификации сообщения; mode of operation. режим работы.
iii III
Table of Contents Содержание
EFINITIONS AND ПРЕДЕЛЕНИЯ И BBREVIATIONS BBREVIATIONS RYPTOGRAPHIC RYPTOGRAPHIC UTHENTICATION UTHENTICATION Table of Figures Список иллюстраций
iv IV
1 Purpose 1 Цель
This publication is the third Part in a series of Recommendations regarding modes of operation Эта публикация является третьей частью в серии Рекомендаций о режимах работы
of symmetric key block cipher algorithms. симметричных ключевых алгоритмов блочного шифра.
2 Authority 2 Орган
This document has been developed by the National Institute of Standards and Technology Этот документ был разработан Национальным институтом стандартов и технологии
(NIST) in furtherance of its statutory responsibilities under the Federal Information Security (NIST) в реализации его уставных обязанностей в соответствии с Федеральным информационной безопасности
Management Act (FISMA) of 2002, Public Law 107-347. Закон об управлении (FISMA) 2002, Public Law 107-347.
NIST is responsible for developing standards and guidelines, including minimum requirements, NIST отвечает за разработку стандартов и руководящих принципов, включая минимальные требования,
for providing adequate information security for all agency operations and assets, but such для обеспечения надлежащей информационной безопасности для всех операций агентств и средств, но такие
standards and guidelines shall not apply to national security systems. стандарты и руководящие принципы не применяются к системам национальной безопасности. This guideline is consistent Это руководство согласуется
with the requirements of the Office of Management and Budget (OMB) Circular A-130, Section с требованиями Управления и бюджета (OMB) циркуляр-130, раздел
8b(3), Securing Agency Information Systems, as analyzed in A-130, Appendix IV: Analysis of 8b (3), Обеспечение Агентство информационных систем, как было проанализировано в A-130, Приложение IV: Анализ
Key Sections. Основные разделы. Supplemental information is provided in A-130, Appendix III. Справочная информация предоставляется в A-130, Приложение III.
This guideline has been prepared for use by federal agencies. Это руководство было подготовлено для использования федеральными органами. It may be used by Это может быть использовано
nongovernmental organizations on a voluntary basis and is not subject to copyright. неправительственные организации на добровольной основе и не охраняется авторским правом. (Attribution (Attribution
would be appreciated by NIST.) будет понятно NIST.)
Nothing in this document should be taken to contradict standards and guidelines made Ничто в этом документе не должны быть приняты, чтобы противоречить стандартов и руководящих принципов, сделанные
mandatory and binding on federal agencies by the Secretary of Commerce under statutory обязательный для исполнения на федеральных агентств секретарем Торгово под законом
authority. орган. Nor should these guidelines be interpreted as altering or superseding the existing Не следует эти руководящие принципы можно интерпретировать как изменение или заменяющий существующий
authorities of the Secretary of Commerce, Director of the OMB, or any other federal official. Власти министра торговли, директор Административно-бюджетное управление, или любой другой федеральный чиновник.
Conformance testing for implementations of the mode of operation that is specified in this Part Аттестационного тестирования для реализаций режима работы, указанного в настоящей части
of the Recommendation will be conducted within the framework of the Cryptographic Module Рекомендации будут проводиться в рамках криптографического модуля
Validation Program (CMVP), a joint effort of NIST and the Communications Security Проверка программы (CMVP), совместными усилиями NIST и безопасности коммуникаций
Establishment of the Government of Canada. Создание правительства Канады. An implementation of a mode of operation must Реализация режима работы должны
adhere to the requirements in this Recommendation in order to be validated under the CMVP. придерживаться требований в данной Рекомендации для того, чтобы быть подтверждено под CMVP.
The requirements of this Recommendation are indicated by the word “shall.” Требования данной Рекомендации обозначается словом «должны».
3 Introduction 3 Введение
This Recommendation specifies an algorithm, Counter with Cipher Block Chaining-Message В настоящей Рекомендации определяется алгоритм, счетчик с Cipher Block Chaining-Message
Authentication Code [1], abbreviated CCM, that can provide assurance of the confidentiality and Код аутентификации [1], сокращенно СКК, который может обеспечить уверенность в конфиденциальности и
authenticity of data. Подлинность данных. CCM is based on an approved symmetric key block cipher algorithm whose СКК на основе утвержденного симметричным ключом алгоритма блочного шифрования, чьи
block size is 128 bits, such as the Advanced Encryption Standard (AES) algorithm currently размер блока 128 бит, такие как Advanced Encryption Standard (AES) алгоритм настоящее время
specified in Federal Information Processing Standard (FIPS) Pub. указано в Federal Information Processing Standard (FIPS) Pub. 197 [2]; 197 [2]; thus, CCM cannot be Таким образом, СКК не может быть
used with the Triple Data Encryption Algorithm [3], whose block size is 64 bits. использоваться с тройным Data Encryption Algorithm [3], чей размер блока составляет 64 бита. CCM can be СКК может быть
considered a mode of operation of the block cipher algorithm. считается режим работы алгоритма блочного шифрования. As with other modes of operation, Как и в других режимах работы,
1 1
a single key to the block cipher must be established beforehand among the parties to the data; один ключ к блочного шифра должна быть установлена заранее между сторонами данных;
thus, CCM should be implemented within a well-designed key management structure. Таким образом, СКК должен быть реализован в хорошо спроектированной ключевой структуры управления. The
security properties of CCM depend, at a minimum, on the secrecy of the key. свойств безопасности СКК зависит, как минимум, на секретность ключа.
CCM is intended for use in a packet environment, ie, when all of the data is available in storage СКК предназначен для использования в среде пакетов, то есть, когда все данные доступны в хранилище
before CCM is applied; перед СКК применяется; CCM is not designed to support partial processing or stream processing. СКК не предназначен для поддержки частичной обработки или потоковой обработки.
The input to CCM includes three elements: 1) data that will be both authenticated and encrypted, На вход СКК включает в себя три элемента: 1) данные, которые будут успешно прошла проверку подлинности и шифруется,
called the payload; называется полезной нагрузки; 2) associated data, eg, a header, that will be authenticated but not encrypted; 2) связанные с ним данные, например, заголовок, который будет проходить проверку подлинности, но не шифруются;
and 3) a unique value, called a nonce, that is assigned to the payload and the associated data. и 3) уникальное значение, называется одноразовый номер, который присваивается полезной нагрузки и связанных с ними данных.
CCM consists of two related processes: generation-encryption and decryption-verification, which CCM состоит из двух связанных процессов: генерации-шифрования и дешифрования верификации, который
combine two cryptographic primitives: counter mode encryption and cipher block chaining- объединить два криптографических примитивов: шифрование режим счетчик и блок шифрования chaining-
based authentication. Аутентификация на основе. Only the forward cipher function of the block cipher algorithm is used Используется только вперед шифра зависит от алгоритма блочного шифрования
within these primitives. в этих примитивов.
In generation-encryption, cipher block chaining is applied to the payload, the associated data, В поколения-шифрования, цепочкой цифровых блоков применяется к полезной нагрузке, связанные с ним данные,
and the nonce to generate a message authentication code (MAC); и одноразовый номер, чтобы сгенерировать код аутентификации сообщения (MAC); then, counter mode encryption Затем, шифрование режим счетчика
is applied to the MAC and the payload to transform them into an unreadable form, called the применяется к MAC и полезной нагрузки, чтобы превратить их в непроницаемым форме, называется
ciphertext. зашифрованный текст. Thus, CCM generation-encryption expands the size of the payload by the size of the Таким образом, СКК поколение-шифрования расширяется размер полезной нагрузки по размеру
MAC. MAC. In decryption-verification, counter mode decryption is applied to the purported ciphertext В дешифрования-проверки, расшифровка режим счетчика применяется к предполагаемой зашифрованный текст
to recover the MAC and the corresponding payload; восстановить MAC и соответствующий полезной нагрузки; then, cipher block chaining is applied to the Затем, цепочкой цифровых блоков применяется к
payload, the received associated data, and the received nonce to verify the correctness of the полезная нагрузка, получили соответствующие данные, и получила одноразовый проверить правильность
MAC. MAC. Successful verification provides assurance that the payload and the associated data Успешная проверка дает гарантию, что полезная нагрузка и связанные с ними данные
originated from a source with access to the key. возникла из источника, имеющего доступ к ключу.
A MAC provides stronger assurance of authenticity than a checksum or an error detecting code. MAC обеспечивает надежные гарантии подлинности, чем контрольная сумма или ошибки обнаружения кода.
The verification of a (non-cryptographic) checksum or an error detecting code is designed to Верификация (не криптографической контрольной суммой) или обнаружения ошибок кода предназначен для
detect only accidental modifications of the data, while the verification of a MAC, as occurs in обнаруживать только случайные модификации данных, в то время как проверка на MAC, как это происходит в
CCM, is designed to detect intentional, unauthorized modifications of the data, as well as СКК, предназначен для обнаружения преднамеренных, несанкционированных модификаций данных, а также
accidental modifications. случайные изменения.
This specification of CCM is intended to be compatible with the use of CCM within the draft Эта спецификация МНЛЗ предназначен, чтобы быть совместимым с использованием СКК в рамках проекта
amendment [4] to the IEEE Standard 802.11 for wireless local area networks [5]. Поправка [4] в стандарте IEEE 802.11 для беспроводных локальных сетей [5].
4 Definitions, Abbreviations, and Symbols 4 Определения, аббревиатуры и символы
4.1 Definitions and Abbreviations 4.1 Определения и сокращения
Approved Утверждено
FIPS approved or NIST recommended: an algorithm or technique that FIPS утверждены или NIST рекомендуется: алгоритм или метод, который
is either 1) specified in a FIPS or NIST Recommendation, or 2) либо 1), указанных в ФИПС или NIST Рекомендации, или 2)
adopted in a FIPS or NIST Recommendation. принят в ФИПС или NIST Рекомендации.
Associated Data Associated данных
Input data to the CCM generation-encryption process that is Входные данные для СКК процесса поколение-шифрования, который
authenticated but not encrypted. аутентификацию, но не шифруются.
2 2
Authenticity Подлинность
The property that data originated from its purported source. Имущество, что данные собраны с его предполагаемой источника.
Bit Бит
A binary digit: 0 or 1. Двоичная цифра: 0 или 1.
Bit Length Бит Длина
The number of bits in a bit string. Битов в битовой строке число.
Bit String Бит Строка
An ordered sequence of bits. Упорядоченная последовательность битов.
Block Блок
A bit string whose length is the block size of the block cipher Битовая строка, длина которой является размер блока блочного шифра
algorithm. Алгоритм.
Block Cipher Блочный шифр
Algorithm Алгоритм
A family of functions and their inverses that is parameterized by Семейство функций и обратных что параметризована
cryptographic keys; криптографические ключи; the functions map bit strings of a fixed length to функции карте битовые строки фиксированной длины в
bit strings of the same length. битовые строки одинаковой длины.
Block Size Размер блока
The bit length of an input (or output) block of the block cipher. Битовая длина входного (или выход) блока блочного шифра.
CBC-MAC CBC-MAC
Cipher Block Chaining-Message Authentication Code Cipher Block Chaining-код проверки подлинности сообщения
CCM СКК
Counter with Cipher Block Chaining-Message Authentication Code. Счетчик с Cipher Block Chaining-код проверки подлинности сообщения.
Ciphertext Зашифрованный текст
The output of the CCM encryption-generation process. Результатом процесса шифрования поколения СКК.
Cryptographic Key Криптографический ключ
A parameter used in the block cipher algorithm that determines the Параметр, используемый в алгоритме блочного шифрования, который определяет
forward cipher function. направить шифрования функцию.
CTR CTR
Counter. Счетчик.
Decryption-Verification The process of CCM in which a purported ciphertext is decrypted and Расшифровка-Проверка Процесс СКК, в котором предполагаемый зашифрованный текст расшифрован и
the authenticity of the resulting payload and the associated data is подлинность полученной полезной нагрузки и связанные данные
verified. проверено.
Exclusive-OR Исключающее ИЛИ
The bitwise addition, modulo 2, of two bit strings of equal length. Побитовое сложение по модулю 2, из двух битовых строк равной длины.
FIPS FIPS
Federal Information Processing Standard. Федеральный стандарт обработки информации.
Formatting Function Форматирование Функция
The function that transforms the payload, associated data, and nonce Функция, которая превращает полезной нагрузки, связанные данных и одноразового номера
into a sequence of complete blocks. в последовательность полных блоков.
Forward Cipher Форвард Cipher
Function Функция
One of the two functions of the block cipher algorithm that is Один из двух функций блока алгоритма шифрования, который
determined by the choice of a cryptographic key. определяется путем выбора криптографического ключа.
Generation-Encryption The process of CCM in which a MAC is generated on the payload Поколение-шифрование Процесс СКК, в котором MAC-генерируется на полезной нагрузке
and the associated data, and encryption is applied to the payload and и связанные с ними данные, и шифрование применяется к полезной нагрузке и
the MAC. MAC.
3 3
IEEE IEEE
Institute of Electrical and Electronics Engineers Институт инженеров по электротехнике и радиоэлектронике
Inverse Cipher Function The inverse function of the forward cipher function for a given Обратная Cipher Функция обратную функцию переднего шифра функции для данного
cryptographic key. криптографический ключ.
Least Significant Bit(s) Младший значащий бит (ы)
The right-most bit(s) of a bit string. Самый правый бит (ы) битовой строки.
Message Сообщение
Authentication Code Код аутентификации
(MAC) (MAC)
A cryptographic checksum on data that is designed to reveal both Криптографическая контрольная сумма данных, которая предназначена для выявления и
accidental errors and intentional modifications of the data. случайные ошибки и преднамеренные модификации данных.
Mode of Operation Режим работы
(Mode) (Режим)
An algorithm for the cryptographic transformation of data that Алгоритм криптографического преобразования данных, что
features a symmetric key block cipher algorithm. имеет симметричный ключ и алгоритм блочного шифрования.
Most Significant Bit(s) Наиболее значащий бит (ы)
The left-most bit(s) of a bit string. Левый бит (ы) битовой строки.
Nonce Nonce
A value that is used only once within a specified context. Значение, которое используется только один раз в течение определенного контекста.
Octet Октет
A string of eight bits. Строка из восьми битов.
Octet Length Октет Длина
The number of octets in an octet string. Октетов в строки октетов число.
Octet String Octet String
An ordered sequence of octets. Упорядоченная последовательность октетов.
Payload Грузоподъемность
The input data to the CCM generation-encryption process that is both Входные данные в СКК процесса поколение-шифрования, который является одновременно
authenticated and encrypted. проверку подлинности и шифруется.
Valid Data Element Действительно Элемент данных
A payload, an associated data string, or a nonce that satisfies the Полезная нагрузка, связанные строка данных, или одноразовый, что удовлетворяет
restrictions of the formatting function. ограничения функции форматирования.
4.2 Symbols 4.2 Символы
4.2.1 4.2.1
Variables Переменные
a
The octet length of the associated data. Длина октет связанных данных.
A
The associated data string. Соответствующая строка данных.
Alen Ален
The bit length of the associated data. Немного длина соответствующих данных.
B B
B B
i я
The i th block of the formatted input. Я й блок форматированного ввода.
C C
The ciphertext. Зашифрованный текст.
4 4
Clen Clen
The bit length of the ciphertext. Немного длина зашифрованного текста.
Ctr Ctr
i я
The i th counter block. Я-я счетчика блока.
K K
The block cipher key. Ключ блочный шифр.
Klen Клен
The bit length of the block cipher key. Бит длина ключа блочного шифрования.
m м
The number of blocks in the formatted payload. Число блоков в отформатированный полезной нагрузки.
MaxErrs MaxErrs
The maximum number of times that the output of any implementation of the Максимальное количество раз, что выход любой реализации
decryption-verification process can be INVALID before the key is retired. расшифровка-процесс проверки может быть верным до ключ на пенсию.
n н
The octet length of the nonce. Длина октет одноразового номера.
N N
The nonce. Случайное.
Nlen NLEN
The bit length of the nonce. Немного длина одноразового номера.
P P
The payload. Полезная нагрузка.
Plen Плен
The bit length of the payload. Немного длина полезной нагрузки.
q д
The octet length of the binary representation of the octet length of the payload. Длина октет двоичного представления длины октета полезной нагрузки.
Q Q
A bit string representation of the octet length of P . Немного Строковое представление длины октетным P.
r г
The number of blocks in the formatted input data ( N , A , P ). Число блоков в отформатированных входных данных (N, A, P).
Risk Риск
The highest acceptable probability for an inauthentic message to pass the Самая высокая Приемлемая вероятность для недостоверного сообщения пройти
decryption-verification process. расшифровка-процесс проверки.
t т
The octet length of the MAC. Длина октет MAC.
T Т
The MAC that is generated as an internal variable in the CCM MAC, который генерируется в качестве внутренней переменной в СКК
processes. процессы.
Tlen Tlen
The bit length of the MAC. Немного длина MAC.
5 5
4.2.2 4.2.2
Operations and Functions Операции и функции
0x 0x
The prefix to a bit string that is represented in hexadecimal characters. Приставка к битовой строки, которая представлена в шестнадцатеричных символов.
[ x ] [X]
s с
The binary representation of the non-negative integer x , in s bits, where x <2 Двоичным представлением целого неотрицательного х, в ы бит, где х <2
s с
. .
⎡ ⎤ ⎡ ⎤
x х
The least integer that is not less than the real number x. Наименьшее целое, что является не менее реальной числа х.
X || Y X || Y
The concatenation of two bit strings X and Y . Объединение двух битовых строк X и Y.
X ⊕ Y X ⊕ Y
The bitwise exclusive-OR of two bit strings X and Y of the same length. Побитовое исключающее ИЛИ двух битовых строк х и у той же длины.
CIPH CIPH
K K
( X ) (Х)
The output of the forward cipher function of the block cipher algorithm under the Выход вперед шифра зависимости от алгоритма блочного шифрования под
key K applied to the data block X . ключ К применяется к блоку данных X.
LSB LSB
s с
( X ) (Х)
The bit string consisting of the s right-most bits of the bit string X . Битовая строка, состоящая из с самых правых битов битовой строки X.
MSB MSB
s с
( X ) (Х)
The bit string consisting of the s left-most bits of the bit string X . Битовая строка, состоящая из с левой большинство биты битовой строки X.
lg( x ) LG (х)
The base 2 logarithm of the positive real number x . Основание 2 логарифм положительного действительного числа х.
5 Preliminaries 5 Предварительные
The selection of a block cipher algorithm and secret key are discussed in Section 5.1. Выбор алгоритма блочного шифрования и секретный ключ, обсуждаются в разделе 5.1. The two Два
cryptographic primitives that CCM requires for its operation are discussed in Section 5.2. криптографических примитивов, что СКК требуется для его работы обсуждаются в разделе 5.2. The
data elements of CCM are discussed in Section 5.3. элементы данных СКК обсуждаются в разделе 5.3. The formatting of valid data elements is Форматирование действительных элементов данных
discussed in Section 5.4. обсуждаются в разделе 5.4. Examples of operations and functions are given in Section 5.5. Примеры операций и функций, приведены в разделе 5.5.
5.1 Underlying Block Cipher Algorithm 5.1 Базовая блочный шифр Алгоритм
The CCM algorithm depends on the choice of an underlying symmetric key block cipher Алгоритм СКК зависит от выбора базового симметричного ключа блочного шифра
algorithm. Алгоритм. The CCM algorithm is thus a mode of operation (mode, for short) of the symmetric Алгоритм СКК, таким образом, режим работы (режим, для краткости) из симметричных
key block cipher. Ключ блочный шифр. The underlying block cipher algorithm shall be approved, and a secret key for Лежащая в основе алгоритма блочного шифра утверждается, и секретный ключ для
the block cipher algorithm shall be generated uniformly at random, or close to uniformly at Алгоритм блочный шифр должен генерироваться равномерно случайным образом, или близко к равномерно
random, ie, so that each possible key is (nearly) equally likely to be generated. случайным образом, то есть, так что каждый ключ можно (почти) в равной степени может быть сгенерирован. Moreover, the Кроме того,
key should be established for the parties to the information by an approved key establishment Ключ должен быть установлен для сторон в информации по утвержденным ключевым учреждения
method. Способ. The key shall be kept secret and shall only be used for the CCM mode. Ключ должен храниться в тайне и должны использоваться только для режима СКК. The total Общая
number of invocations of the block cipher algorithm during the lifetime of the key shall be количество вызовов алгоритма блочного шифрования во время жизни ключа должны быть
limited to 2 ограничивается 2
61 61
. . Key establishment and key management are outside the scope of this Ключ создание и управление ключами выходят за рамки этого
Recommendation. Рекомендация.
For any given key, the underlying block cipher algorithm of the mode consists of two functions Для любого данного ключа, изменен алгоритм блочного шифра режима состоит из двух функций
that are inverses of each other. которые являются обратными друг другу. As part of the choice of the block cipher algorithm, one of the two В рамках выбора алгоритма блочного шифрования, один из двух
6 6
functions of the block cipher algorithm is designated as the forward cipher function. функции алгоритма блочного шифрования обозначен как вперед шифра функции.
The
inverse of this process is called the inverse cipher function; обратная этого процесса, называется обратной шифрования функцию; however, the CCM mode does not Тем не менее, в режиме СКК не
require the inverse cipher function. требуют обратную шифрования функцию.
The forward cipher function is a function on bit strings of a fixed bit length; Вперед шифр функция является функцией от битных строк фиксированной длины разрядной; the strings are called струны называются
blocks, and their length is called the block size. блоки, и их длина называется размер блока. For CCM, the block size of the block cipher Для СКК, размер блока блочного шифра
algorithm shall be 128 bits; Алгоритм должен быть 128 бит; currently, the AES algorithm is the only approved block cipher В настоящее время, алгоритм AES является единственной одобренной блочный шифр
algorithm with this block size. Алгоритм с этим размером блока.
The CCM key, denoted K , is the block cipher key; Ключ СКК, обозначается K, является ключ шифрования блока; the forward cipher function of the block вперед шифр функция блока
cipher with this key is denoted CIPH шифр с этим ключом обозначается CIPH
K K
. . The bit length of K is denoted Klen . Битовая длина К обозначим Клен.
5.2 Cryptographic Primitives 5.2 криптографических примитивов
The CCM specification essentially combines two cryptographic mechanisms that are based on Спецификация СКК существу объединяет два криптографических механизмов, которые основаны на
the forward cipher function. вперед шифр функции. One mechanism is the Counter (CTR) mode for confidentiality, Одним из механизмов является режим Счетчик (CTR) для конфиденциальности,
which is specified for general use in the first Part of this Recommendation [6]. который указан для общего использования в части первой настоящей Рекомендации [6]. The CTR mode Режим CTR
requires the generation of a sufficiently long sequence of blocks called the counter blocks. требует поколение достаточно длинной последовательности блоки, называемые встречные блоки. The
counter blocks must be distinct within a single invocation and across all other invocations of the Счетчик блоки должны быть различными в пределах одного вызова и во всех других вызовами
CTR mode under any given key, but they need not be secret. Режим CTR при любом данном ключе, но они не должны быть тайной. This requirement on the counter Это требование на прилавке
blocks extends to the CCM mode. блоки распространяется на режиме СКК. See [6] for further discussion of the generation of counter Смотреть [6] для дальнейшего обсуждения генерации счетчика
blocks; блоки; see Section 5.4 below for an additional requirement on the counter blocks in CCM. см раздел 5.4 ниже для дополнительного требования по встречным блоков в СКК. The other cryptographic mechanism within CCM is an adaptation of the cipher block chaining Другой криптографической механизм в СКК является адаптация цепочкой цифровых блоков
(CBC) technique from [6] to provide assurance of authenticity. (CBC) техника из [6], чтобы обеспечить уверенность в подлинности. Specifically, the CBC technique В частности, этот метод СВС
with an initialization vector of zero is applied to the data to be authenticated; с инициализации вектор нулю применяется к данным для аутентификации; the final block of Последний блок
the resulting CBC output, possibly truncated, serves as a message authentication code (MAC) of Результирующий выходной СВС, возможно, усеченной, служит в качестве кода аутентификации сообщения (MAC) в
the data. данные. The algorithm for generating a MAC in this fashion is commonly called CBC-MAC. Алгоритм для генерации MAC таким образом, что обычно называют CBC-MAC.
This Recommendation does not approve CBC-MAC as an authentication mode outside of the Настоящая Рекомендация не одобряет CBC-MAC в качестве режима аутентификации за пределами
context of the CCM specification; Контекст спецификации СКК; however, a variation of CBC-MAC is proposed for general Тем не менее, изменение CBC-MAC Предложен целом
use in the second Part of this Recommendation [7]. использовать в части второй настоящей Рекомендации [7].
The same key, K , is used for both the CTR and CBC-MAC mechanisms within CCM. И тот же ключ, K, используется для обеих механизмов CTR и CBC-MAC в пределах СКК.
5.3 Data Elements 5.3 Элементы данных
The data that CCM protects consists of a message, ie, a bit string, called the payload, denoted P , Данные, которые защищают СКК состоит из сообщения, то есть, битовая строка, называется полезной нагрузки, обозначенный Р,
of bit length denoted Plen , and a bit string, called the associated data, denoted A . длины разрядной обозначается ПЛЭН, и немного строка, называется ассоциированным данных, обозначается. The associated Связаны
data is optional, ie, A may be the empty string. Данные не является обязательным, то есть, может быть пустой строкой.
CCM provides assurance of the CCM предоставляет гарантию
confidentiality of P and assurance of the authenticity of the origin of both A and P ; конфиденциальность P и гарантии подлинности происхождения А и Р;
confidentiality is not provided for A . конфиденциальность не предусмотрено А.
A bit string called the nonce, denoted N , is assigned to the data pair to be protected, ie, the Битовая строка называется одноразовый номер, обозначается Н, присваивается пары данных, подлежащих защите, т.е.
∗ *
For the AES algorithm, the forward cipher is explicitly identified in [2]. Для алгоритма AES, вперед шифр четко определены в [2].
** **
The payload may also be empty, in which case the specification degenerates to an authentication mode on the Полезная нагрузка может также быть пустым, и в этом случае параметры вырождаются в режиме проверки подлинности на
associated data. связанные с ними данные.
7 7
payload and its associated data. полезная нагрузка и связанные с ней данные. The nonce shall be non-repeating in the sense that any two Одноразовый номер должен быть не повторяя в том смысле, что любые два
distinct data pairs to be protected by CCM during the lifetime of the key shall be assigned различных пар данных, чтобы быть защищены СКК во время жизни ключа присваивается
distinct nonces. различные одноразовые. In effect, the nonce determines an invocation of CCM. По сути, одноразовый определяет вызов СКК. The nonce is not Случайное не
required to be random. обязаны быть случайным.
The MAC that is generated within CCM is an internal variable, denoted T . МАС, который генерируется в СКК внутренней переменной, обозначается Т. The bit length of T , Немного длина Т,
denoted Tlen , is a parameter of the mode that shall be fixed for all invocations of CCM with the обозначаемое Tlen, является параметром режима, который должен быть установлен для всех вызовов СКК с
given key. учитывая ключ. The requirements for the selection of Tlen are discussed in Appendix B. Требования к отбору Tlen обсуждаются в Приложении Б.
5.4 Input Formatting 5.4 Входной Форматирование
The CCM data elements N , P , and A shall be formatted into a non-empty sequence of complete Элементы данных СКК N, P, и А должны быть отформатированы в непустой последовательности полное
data blocks, denoted B блоки данных, обозначается B
B B
0 0
, B , B
1 1
B B
, …, B , ..., В
B B
r г
for some non-negative integer r , in accordance with a function для некоторого неотрицательного целого числа г, в соответствии с функцией
called the formatting function (in [8], the formatting function is called the encoding function, β ). называется функцией форматирования (в [8], функция форматирования называется функцией кодирования, β).
The value of r depends on the formatting function and the input elements. Значение г зависит от функции форматирования и входных элементов. For any given key, the Для любого данного ключа,
following three properties shall hold for the formatting function: следующие три свойства проводит для функции форматирования:
1. The first block, B 1 Первый блок, В
B B
0 0
, uniquely determines the nonce N . , Однозначно определяет временное значение N.
2. The formatted data uniquely determines P and A ; 2 отформатированные данные однозначно определяет Р и А; moreover, if ( N , P, A ) and ( N , P ', A ') более того, если (N, P, A) и (N, P ', а')
are distinct input triples whose formatting is B являются различными входные тройки, чьи форматирование B
B B
0 0
, B , B
1 1
B B
, …, B , ..., В
B B
r г
and B и B
0 0
B B
', B ', В
B B
1 1
', …, B ', ..., В
r ' г '
B B
', then B ', То В
B B
i я
is является
distinct from B отличие от B
i я
B B
' for some index i such that i ≤ r and i≤ r '. Для некоторого индекса я такая, что ≤ R и i≤ г '.
3. The first block, B 3 первый блок, В
B B
0 0
, is distinct from any counter blocks that are used across all invocations , Отличается от любых встречных блоков, которые используются во всех вызовов
of CCM under the key. МНЛЗ под ключ.
The third property suggests that the formatting function and the counter generation function Третье свойство предполагает, что функция форматирования и функция счетчика поколений
should not be selected or constructed independently of each other. не должны быть выбраны или сконструированы независимо друг от друга.
The formatting function may impose restrictions on the contents and the bit lengths of the input Функция форматирования может наложить ограничения на содержание и бит длины входа
data N , P, and A , as well as the parameter Tlen . Данные N, P, и, так же как параметр Tlen. For example, the bit lengths may be restricted to Например, длины бит может быть ограничено
multiples of eight and to a given range of values. кратные восьми и до заданном диапазоне значений. Values that satisfy the restrictions of the Значения, которые удовлетворяют ограничениям
formatting function are called valid. Функция форматирования называются действительными. No value of Tlen smaller than 32 shall be valid. Нет стоимость Tlen меньше 32 не действует.
An example of a formatting function and counter generation function that together satisfy these Примером функции форматирования и контр функцией генерации, что вместе удовлетворить эти
requirements is given in Appendix A. Alternative formatting functions may be developed in the требования приведены в функции форматирования Приложение A. Альтернативные могут быть разработаны в
future. Будущее.
5.5 Examples of Operations and Functions 5.5 Примеры операций и функций
Given a positive integer s and a non-negative integer x that is less than 2 Учитывая положительное целое с и неотрицательное целое х, которое меньше 2
s с
, the binary , Двоичный
representation of x in s bits is denoted [ x ] представление х в ы бит обозначается [х]
s с
. . For example, for the (base 10) integer 45, the binary Например, для (основание 10) целого числа 45, в двоичной системе
representation (base 2) is 101101, so [45] Представление (основание 2) 101101, так [45]
8 8
= 00101101. = 00101101.
The concatenation operation on bit strings is denoted ||; Операция конгатенации битовых строк обозначается ||; for example, 001 || 10111 = 00110111. например, 001 || 10111 = 00110111.
∗ *
This property deals with the case that a nonce is repeated within two distinct input triples. Это свойство рассматривается случай, что одноразовый повторяется в двух различных входных троек. Although the legitimate Хотя законным
source/sender of the data is already required to assign distinct nonces to different input triples, the security model in источник / отправитель данных уже требуется назначить различные одноразовые номера для различных входных троек, модель безопасности в
[8] takes into account that the recipient of purported ciphertexts might not monitor whether a nonce is repeated. [8] учитывает, что получатель предполагаемых шифртекстов не может контролировать повторяется ли одноразовый.
8 8
Given bit strings of equal length, the exclusive-OR operation, denoted ⊕, specifies the addition, Учитывая битовые строки равной длины, исключающее ИЛИ операция, обозначается ⊕, указывает добавление,
modulo 2, of the bits in each bit position, ie, without carries. по модулю 2, из битов в позиции каждого бита, то есть, без переносов. For example, 10011 ⊕ 10101 = Например, 10011 10101 ⊕ =
00110. 00110.
The functions LSB Функции LSB
s с
and MSB и MSB
s с
return the s least significant (ie, right-most) bits and the s most возвращаются с наименее значимых (т.е. самая правая) битов и самых
significant (ie, left-most) bits of their arguments, respectively. значительные (то есть, самый левый) бит своих аргументов, соответственно. For example, LSB Например, LSB
3 3
(111011010) (111011010)
= 010, and MSB = 010, и MSB
4 4
(111011010) = 1110. (111011010) = 1110.
Given a positive real number x , the base 2 logarithm x is denoted lg(x). Учитывая положительное действительное число х, база 2 логарифм х обозначается LG (х). For example, lg(2 Например, LG (2
10 10
)=10. ) = 10.
6 CCM Specification 6 СКК Спецификация
The two CCM processes are called generation-encryption and decryption-verification. Эти два процесса СКК называются поколение-шифрование и дешифрование-проверка. The
prerequisites, inputs, outputs, steps, and summaries for the execution of the two CCM processes предпосылки, входы, выходы, ступеньки, и резюме для исполнения двух процессов СКК
are specified in Sections 6.1 and 6.2 below. указаны в разделах 6.1 и 6.2 ниже. The prerequisites are inputs that are typically fixed Предпосылками являются входами, которые обычно фиксированные across many invocations of CCM. во многих вызовами СКК. The prerequisites and inputs shall meet the requirements in Предпосылки и входы должны соответствовать требованиям в
Section 5. Раздел 5.
There is some flexibility in the order of the steps of the two processes. Существует некоторая гибкость в порядке ступеньках двух процессов. For example, the Например,
generation of the counter blocks can occur at any time before they are used; поколение встречным блоков может произойти в любое время, прежде чем они используются; in fact, the counter В самом деле, счетчик
blocks may be generated in advance and be considered as inputs to the processes. Блоки могут быть созданы заранее и рассматривать в качестве вклада в процессы.
6.1 Generation-Encryption Process 6.1 Генерация-Шифрование Процесс
The following is a specification of the generation-encryption process of CCM: Ниже приводится спецификация процесса поколение-шифрования СКК:
Prerequisites: Необходимые условия:
block cipher algorithm; блокировать алгоритм шифрования;
key K ; ключ К;
counter generation function; Функция генерации счетчика;
formatting function; форматирование функция;
MAC length Tlen . Длина MAC Tlen.
Input : Вход:
valid nonce N ; действует одноразовый N;
valid payload P of length Plen bits; действует нагрузка Р длины PLEN бит;
valid associated data A ; действует связанные с ними данные;
Output : Выход:
ciphertext C. зашифрованный текст C.
Steps : Шаги:
1. 1.
Apply the formatting function to ( N , A , P ) to produce the blocks B Использование функции форматирования к (N, A, P), чтобы произвести блоки B
B B
0 0
, B , B
1 1
B B
, …, B , ..., В
B B
r г
. .
2. 2.
Set Y Установите Y
0 0
= CIPH = CIPH
K K
( B (В
B B
0 0
). ).
3. 3.
For i = 1 to r , do Y Для я = 1 до т, сделать Y
i я
= CIPH = CIPH
K K
( B (В
B B
i я
⊕ Y ⊕ Y
i -1 я -1
). ).
9 9
4. 4.
Set T =MSB Установите T = MSB
Tlen Tlen
( Y (Y
r г
). ).
5. 5.
Apply the counter generation function to generate the counter blocks Ctr Применить функцию генерации счетчик для генерации встречных блоки CTR
0 0
, Ctr , Ctr
1 1
, ,
…, Ctr ..., Ctr
m м
, where , Где
⎡ ⎡
⎤ ⎤
128 128
Plen Плен
m = м =
. .
6. 6.
For j =0 to m , do S Для J = 0 т, сделать S
j J
= CIPH = CIPH
K K
( Ctr (Ctr
j J
). ).
7. 7.
Set S= S Установите S = S
1 1
|| S || S
2 2
|| …|| S || ... || S
m м
. .
8. 8.
Return C =( P ⊕ MSB Вернуться C = (P ⊕ MSB
Plen Плен
( S )) || ( T ⊕ MSB (S)) || (T ⊕ MSB
Tlen Tlen
( S (S
0 0
)). )).
The input data to the generation-encryption process are a valid nonce, a valid payload string, and Входные данные для процесса генерации-шифрования являются действительными одноразовый, допустимая строка полезной нагрузки, и
a valid associated data string, which are formatted according to the formatting function. действительный связаны строка данных, которые отформатированы в соответствии с функцией форматирования. The
CBC-MAC mechanism is applied to the formatted data to generate a MAC, whose length is a Механизм CBC-MAC применяется к форматированных данных, чтобы генерировать MAC, длина которой
prerequisite. условием. Counter mode encryption, which requires a sufficiently long sequence of counter Счетчик режим шифрования, который требует достаточно длинную последовательность счетчика
blocks as input, is applied to the payload string and separately to the MAC. блоки, как ввода, применяется к строке полезной нагрузки и по отдельности к MAC. The resulting data, Полученные данные,
called the ciphertext, denoted C , is the output of the generation-encryption process. называется зашифрованный текст, обозначается C, является результатом процесса поколение-шифрования.
6.2 Decryption-Verification Process 6.2 Расшифровка-Процесс проверки
Prerequisites : Необходимые условия:
block cipher algorithm; блокировать алгоритм шифрования;
key K ; ключ К;
counter generation function; Функция генерации счетчика;
formatting function; форматирование функция;
valid MAC length Tlen . действительный длина MAC Tlen.
Input : Вход:
nonce N ; одноразовый N;
associated data A ; связано данных A;
purported ciphertext C of length Clen bits; предполагаемый зашифрованный текст С длины Clen бит;
Output : Выход:
either the payload P or INVALID . либо полезная нагрузка P или недействительным.
Steps : Шаги:
1. 1.
If Clen ≤ Tlen , then return INVALID. Если Clen ≤ Tlen, а затем вернуться СИЛЫ.
2. 2.
Apply the counter generation function to generate the counter blocks Ctr Применить функцию генерации счетчик для генерации встречных блоки CTR
0 0
, Ctr , Ctr
1 1
, ,
…, Ctr ..., Ctr
m м
, where , Где
⎡ ⎡
⎤ ⎤
128 128
) )
( (
Tlen Tlen
Clen Clen
m м
− -
= =
. .
3. 3.
For j =0 to m , do S Для J = 0 т, сделать S
j J
= CIPH = CIPH
K K
( Ctr (Ctr
j J
). ).
4. 4.
Set S= S Установите S = S
1 1
|| S || S
2 2
|| …|| S || ... || S
m м
. .
5. 5.
Set P =MSB Установите P = MSB
Clen - Tlen Clen - Tlen
( C ) ⊕ MSB (C) ⊕ MSB
Clen - Tlen Clen - Tlen
( S ). (S).
6. 6.
Set T =LSB Установите T = LSB
Tlen Tlen
( C ) ⊕ MSB (C) ⊕ MSB
B B
Tlen Tlen
( S (S
0 0
). ).
7. 7.
If N , A , or P is not valid, as discussed in Section 5.4, then return INVALID, else Если N, или P не действует, как описано в разделе 5.4, а затем вернуться недействительными, еще
apply the formatting function to ( N , A , P ) to produce the blocks B применить функцию форматирования к (N, A, P), чтобы произвести блоки B
B B
0 0
, B , B
1 1
B B
, …, B , ..., В
B B
r г
. .
8. 8.
Set Y Установите Y
0 0
= CIPH = CIPH
K K
( B (В
B B
0 0
). ).
9. 9.
For i = 1 to r , do Y Для я = 1 до т, сделать Y
j J
= CIPH = CIPH
K K
( B (В
B B
i я
⊕ Y ⊕ Y
i -1 я -1
). ).
10. 10.
If T ≠ MSB Если T ≠ MSB
Tlen Tlen
( Y (Y
r г
), then return INVALID, else return P . ), А затем вернуться недействительными, еще обратный P.
10 10
The input to the decryption-verification process is a purported ciphertext, an associated data Вкладом в процесс расшифровки-проверки является предполагаемый зашифрованный текст, связанные с ними данные
string, and the nonce that was purportedly used in the generation of the purported ciphertext. Строка и одноразовый номер, который был предположительно используется в генерации предполагаемого зашифрованного текста.
Counter mode decryption is applied to the purported ciphertext to produce the corresponding Расшифровка режим Счетчик применяется для предполагаемого зашифрованного текста с получением соответствующего
MAC and payload. MAC и полезной нагрузки. If the nonce, the associated data string, and the payload are valid, as Если одноразовый номер, соответствующий строка данных и полезной нагрузки являются действительными, как
discussed in Section 5.4, then these strings are formatted into blocks according to the formatting обсуждаются в разделе 5.4, то эти строки форматирования в блоки в соответствии с форматированием function, and the CBC-MAC mechanism is applied to verify the MAC. Функция, и механизм CBC-MAC применяется для проверки MAC. If verification succeeds, Если проверка прошла успешно,
the decryption-verification process returns the payload as output; Процесс расшифровки-проверка возвращает полезную нагрузку в качестве вывода; otherwise, only the error В противном случае, только ошибка
message INVALID is returned. сообщение INVALID возвращается.
When the error message INVALID is returned, the payload P and the MAC T shall not be Когда инвалид возвращается сообщение об ошибке, полезная нагрузка P и MAC T не несет
revealed. выявлено. Moreover, the implementation shall ensure that an unauthorized party cannot Кроме того, реализация должна обеспечить, чтобы посторонние не смогут
distinguish whether the error message results from Step 7 or from Step 10, for example, from the различие приводит ли сообщение об ошибке на стадии 7, или с шагом 10, например, из
timing of the error message. Сроки сообщении об ошибке.
11 11
Appendix A: Example of a Formatting and Counter Generation Function Приложение: Пример функции форматирования и Счетчик поколения
In this appendix, a formatting function for the input data and a counter generation function are В этом приложении, функция форматирования для входных данных и функция счетчика поколений являются
specified that together satisfy the requirements of Section 5.4. указано, что вместе удовлетворяют требованиям раздела 5.4. With these functions, this С помощью этих функций, в этом
specification of CCM is essentially equivalent to the specification of CCM in the draft спецификация СКК по существу эквивалентно спецификации СКК в проекте
amendment [4] to the IEEE Standard 802.11 for wireless local area networks [5]. Поправка [4] в стандарте IEEE 802.11 для беспроводных локальных сетей [5].
The requirements that this particular formatting function imposes on the lengths of the variables Требования, что именно этот Функция форматирования налагает на длин переменных
in CCM are given in Section A.1; в СКК приведены в разделе A.1; the formatting of the input data is specified in Section A.2; форматирование входных данных указан в разделе А.2; the
counter generation function is specified in Section A.3. Функция генерации счетчика указано в разделе А.3.
A.1 A.1
Length Requirements Длина Требования
The bit length of each input string, ie, N , A , and P , shall be a multiple of 8 bits, ie, each input Битовая длина каждого входной строки, то есть, N, и P, должна быть кратна 8 бит, т.е., каждый вход
string shall be an octet string. Строка должна быть строка октетов. The octet lengths of these strings are denoted n , a , and p ; Длины октет этих строк обозначаются н,, и р; thus, n , a Таким образом, N,
and p are integers. и р являются целыми числами. Similarly, the parameter t denotes the octet length of T . Кроме того, параметр T обозначает длину октет T. The octet length of P Длина октет P
(ie, the integer p ) is represented within the first block of the formatted data as an octet string (То есть, целое р) представлена в первом блоке отформатированных данных в качестве строки октетов
denoted Q . обозначаемое Q. The octet length of Q , denoted q , is a parameter of the formatting function. Длина октет Q, которое обозначают д, является параметр функции форматирования. Thus, Q is Таким образом, Q является
equivalent to [ p ] эквивалентно [р]
8 q 8 д
, the binary representation of p in q octets. , Бинарное представление р в Q октетов. For example, if q = 3 and P is a Например, если Q = 3 и Р
string that consists of 4096 bits, ie, p = 512, then Q is the string 00000000 00000010 00000000. строка, состоящая из 4096 бит, то есть, р = 512, то Q является строка 00000000 00000010 00000000.
The formatting in this appendix imposes the following length conditions: Форматирование в этом приложении накладывает следующие условия длины:
• t is an element of • T является элементом
{ {
4, 6, 8, 10, 12, 14, 16}; 4, 6, 8, 10, 12, 14, 16};
• q is an element of {2, 3, 4, 5, 6, 7, 8}; • Q представляет собой элемент {2, 3, 4, 5, 6, 7, 8};
• n is an element of {7, 8, 9, 10, 11, 12, 13} • N является элементом {7, 8, 9, 10, 11, 12, 13}
• n + q =15; • п + д = 15;
• a <2 • <2
64 64
. .
The parameter q determines the maximum length of the payload: by definition, p <2 Параметр Q определяет максимальную длину полезной нагрузки: по определению, р <2
8 q 8 д
, so P , Так P
consists of fewer than 2 состоит из менее чем 2
8 q 8 д
octets, ie, fewer than 2 октетов, то есть меньше, чем 2
8 q -4 8 кв -4
128-bit blocks. 128-битные блоки. The fourth condition Четвертое условие
implies that a choice for q determines the value of n , namely, n =15- q . подразумевает, что выбор для д определяет величину п, а именно, N = 15-д. (Equivalently, the nonce (Это эквивалентно тому, одноразовый
length, n , may be considered as the parameter of the formatting function that determines the Длина, N, могут быть рассмотрены в качестве параметра функции форматирования, который определяет
value of q .) The value of n , in turn, determines the maximum number of distinct nonces, namely, Значение Q). Значение N, в свою очередь, определяет максимальное число различных одноразовых номеров, а именно
2 2
8 n 8 н
. . Thus, the fourth condition amounts to a tradeoff between the maximum number of Таким образом, четвертое условие составляет компромисса между максимальным числом
invocations of CCM under a given key and the maximum payload length for those invocations. вызовы СКК под данным ключом, а максимальная длина полезной нагрузки для этих вызовов.
A.2 А.2
Formatting of the Input Data Форматирование входных данных
The formatting of the input data ( N , A , P ) into a sequence of blocks B Форматирование входных данных (N, A, P) в последовательность блоков B
B B
0 0
, B , B
1 1
B B
, …, B , ..., В
B B
r г
is presented in представлена в
the following three sections: in Section A.2.1, the formatting of the nonce and control следующие три секции: в разделе А.2.1, форматирование нонса и контроля
information such as length indicators is specified; информация, такая как индикаторами длины задается; in Section A.2.2, the formatting of A is в разделе А.2.2, форматирование А
specified; указано; in Section A.2.3, the formatting of P is specified. в разделе A.2.3, форматирование P указывается.
12 12
A.2.1 А.2.1
Formatting of the Control Information and the Nonce Форматирование информации управления и Nonce
The leading octet of the first block of the formatting, B Ведущая октет первого блока форматирования, B
B B
0 0
, contains four flags for control , Содержит четыре флаги для контроля
information: two single bits, called Reserved and Adata , and two strings of three bits, to encode информация: две односпальные биты, называемые защищены и Adata, и две строки из трех битов, чтобы закодировать
the values t and q . Значения т и д. The encoding of t is [( t -2)/2] Кодирование Т [(трет -2) / 2]
3 3
, and the encoding of q is [ q -1] , И кодирование д является [д -1]
3 3
. . Thus, for Таким образом, для
example, if the MAC length is 8 octets, then t is encoded as 011. Note that the encoding 000 in Например, если длина МАС-8 октетов, то Т кодируется как 011. Следует отметить, что кодирование в 000
both cases does not correspond to a permitted value of t or q . оба случая не соответствуют разрешенным значением т или д. The Reserved bit is reserved to Защищены бит зарезервирован для
enable future extensions of the formatting; возможность будущим расширения форматирования; it shall be set to '0'. он должен быть установлен на «0». The Adata bit is '0' if a =0 and Adata бит "0", если = 0 и
'1' if a >0. «1», если а> 0. The ordering of the flags within the octet is given in Table 1. Упорядочение флагов в пределах октета приведены в таблице 1.
Table 1: Formatting of the Flags Octet in B Таблица 1: Форматирование поле флагов в B
B B
0 0
Bit number Номер бита
7 7
6 6
5 5
4 4
3 3
2 2
1 1
0 0
Contents Содержание
Reserved Adata Зарезервировано Adata
[( t -2)/2] [(Трет -2) / 2]
3 3
[ q -1] [Q -1]
3 3
The remaining 15 octets of the first block of the formatting are devoted to the nonce and the Остальные 15 октета первого блока форматирования посвящены одноразового номера и
binary representation of the message length in q octets, as given in Table 2. двоичное представление длины сообщения в октетах Q, как указано в таблице 2.
Table 2: Formatting of B Таблица 2: Форматирование B
B B
0 0
Octet number Число октет
0 0
1 ... 15- q 1 ... 15-д
16- q ... 15 16-д ... 15
Contents Содержание
Flags Флаги
N N
Q Q
For example, if B Например, если В
B B
0 0
is является
01101110 00010011 11010100 10100011 01011101 01110001 10100101 00000000 01101110 00010011 11010100 10100011 01011101 01110001 10100101 00000000
00000000 00000000 00000000 00000000 00000000 00000000 01000100 00000001: 00000000 00000000 00000000 00000000 00000000 00000000 01000100 00000001:
• The associated data will not be empty (because Adata =1). • связанные с ними данные не будут пустыми (потому Adata = 1).
• The MAC will consist of 12 octets (because [( t -2)/2] • MAC будет состоять из 12 октетов (потому что [(т -2) / 2]
3 3
=101). = 101).
• The octet length of Q is 7 (because [ q -1] • Длина октет Q 7 (потому что [д -1]
3 3
=110), so Q is 00000000 000000000 00000000 = 110), так Q 00000000 000000000 00000000
00000000 00000000 01000100 00000001. 00000000 00000000 01000100 00000001.
• The payload will consist of 17,409 octets (because Q =[17409] • Полезная нагрузка будет состоять из 17 409 октетов (потому Q = [17409]
56 56
). ).
• The octet length of N is 8 (because n =15- q and q =7), so N =00010011 11010100 • Длина октет N 8 (потому что п = 15-д, д = 7), так N = 00010011 11010100
10100011 01011101 01110001 10100101 00000000 00000000. 10100011 01011101 01110001 10100101 00000000 00000000.
A.2.2 А.2.2
Formatting of the Associated Data Форматирование соответствующих данных
If a =0, as indicated by the Adata field in the first octet of B Если а = 0, как указано в поле AData в первом октете B
B B
0 0
, then there are no blocks devoted to , То нет никаких блоков, посвященных
the associated data in the formatted data. соответствующие данные в отформатированных данных. If a >0, then a is encoded as described below, and the Если а> 0, то кодируется, как описано ниже, и
encoding of a is concatenated with the associated data A , followed by the minimum number of Кодирование объединяется с соответствующим данных А, после чего минимальное число
'0' bits, possibly none, such that the resulting string can be partitioned into 16-octet blocks. '0' бит, возможно, нет, так что результирующая строка может быть разделена на 16-октетных блоков.
These blocks are denoted in the formatted data as B Эти блоки обозначаются в отформатированных данных как B
1 1
B B
, B , B
B B
2 2
, … B , ... B
u у
B B
for some positive integer u that для некоторого натурального числа U, что
depends on a . зависит от.
The value a is encoded according to the following three cases: Значение кодируется согласно следующих трех случаях:
13 13
• If 0 < a < 2 • Если 0 <а <2
16 16
-2 -2
8 8
, then a is encoded as [ a ] , Затем кодируется как []
16 16
, ie, two octets. , То есть, два октета.
• If 2 • Если 2
16 16
-2 -2
8 8
≤ a < 2 ≤ <2
32 32
, then a is encoded as 0xff || 0xfe || [ a ] , Затем кодируется как 0xff || 0xfe || []
32 32
, ie, six octets. , Т.е. шесть октетов.
• If 2 • Если 2
32 32
≤ a < 2 ≤ <2
64 64
, then a is encoded as 0xff || 0xff || [ a ] , Затем кодируется как 0xff || 0xff || []
64, 64,
ie, ten octets. т.е. десять октета.
For example, if a =2 Например, если а = 2
16 16
, the encoding of a is 11111111 11111110 00000000 00000001 00000000 , Кодирование является 11111111 11111110 00000000 00000001 00000000
00000000. 00000000.
The formatting of distinct sets of associated data will not overlap, because for distinct values of Форматирование отдельных групп связанных данных не будут пересекаться, потому что для различных значений
a , the leading bits of the encodings of a are distinct: in the first case, the first octet will not be , ведущие биты кодировок различны: в первом случае, первый октет не будет
0xff as it will for the second and third cases; 0xff, как это будет для второго и третьего случаев; the second and third cases can be distinguished by второй и третий случаи можно отличить по
the second octet. второй октет. Encodings that are not specified in these three cases are reserved, eg, when Кодировки, которые не указаны в этих трех случаях зарезервированы, например, когда
the first two octets are 0x0000, 0xff00, 0xff01, etc. первые два октета являются 0x0000, 0xff00, 0xff01 и т.д.
A.2.3 A.2.3
Formatting of the Payload Форматирование Payload
The associated data blocks, if any, are followed in the sequence of formatted blocks by the Соответствующие блоки данных, если таковые имеются, а затем в последовательности отформатированных блоков по
payload blocks. полезная нагрузка блоки. The payload is concatenated with the minimum number of '0' bits, possibly Полезная нагрузка объединяется с минимальным количеством битов «0», возможно
none, such that the result can be partitioned into 16-octet blocks. ни один, таким образом, что результат может быть разделена на 16-октетных блоков. These blocks are denoted in the Эти блоки обозначаются в
formatted data as B отформатированные данные как B
B B
u +1 у +1
, B , B
B B
u +2 у +2
… B ... B
B B
r г
, where r = u + , Где г = и +
⎡ ⎡
⎤ ⎤
16 16
p р
. .
A.3 А.3
Formatting of the Counter Blocks Форматирование счетчика блоков
The counter generation function in this section is equivalent to a formatting of the counter index i Функция счетчика поколений в этом разделе эквивалентно форматирования индекса счетчика I
into a complete data block. в полного блока данных. The counter blocks Ctr Счетчик блоки Ctr
i я
are formatted as shown in Table 3 below. отформатированы, как показано в таблице 3 ниже.
Table 3: Formatting of Ctr Таблица 3: Форматирование Ctr
i я
Octet number: Октет номер:
0 0
1 ... 15- q 1 ... 15-д
16- q ... 15 16-д ... 15
Contents: Содержание:
Flags Флаги
N N
[ i ] [Я]
8q 8q
Within each block Ctr В каждом блоке Ctr
i я
, the Flags field is formatted as shown in Table 4 below. , Поле флагов форматирования, как показано в таблице 4 ниже.
Table 4: Formatting of the Flags Field in Ctr Таблица 4: Форматирование в поле флагов в Ctr
i я
Bit number Номер бита
7 7
6 6
5 5
4 4
3 3
2 2
1 1
0 0
Contents Содержание
Reserved Зарезервировано
Reserved Зарезервировано
0 0
0 0
0 0
[ q -1] [Q -1]
3 3
The Reserved bits are reserved for future expansions and shall be set to 0. Bits 3, 4, and 5 shall Зарезервированные биты зарезервированы для будущих расширений и должен быть установлен в 0. Биты 3, 4, и 5 должны
also be set to 0, to ensure that all the counter blocks are distinct from B Также будет установлено в 0, чтобы гарантировать, что все блоки счетчик отличны от B
B B
0 0
(as specified in A.2.1 (Как указано в А.2.1
above). выше). Bits 0, 1, and 2 contain the same encoding of q as in B Биты 0, 1, и 2 содержат одинаковое кодирование д а в B
0 0
B B
. .
14 14
Appendix B: Length of the MAC Приложение B: Длина MAC
The length, Tlen , of the MAC within CCM is an important security parameter. The role of this
parameter in providing authentication assurance is outlined in Section B.1, and guidance in the
selection of Tlen is given in Section B.2.
B.1
Authentication Assurance
The decryption-verification process determines whether a purported ciphertext input is, in fact, a
ciphertext, ie, the output of the generation-encryption process with the given key, associated
data string, and nonce. The basis of the CCM authentication assurance is the scarcity of
ciphertexts, which suggests that an attacker, ie, a party without access to the key or to the
generation-encryption process, cannot easily generate a ciphertext. Therefore, any purported
ciphertext that passes the decryption-verification process was probably generated legitimately.
For any purported ciphertext that is at least Tlen bits long, the rightmost Tlen bits correspond to
an encrypted MAC, and the remaining bits correspond to an encrypted payload. The decryption-
verification process checks the correctness of the MAC for the payload, the associated data
string, and the nonce. Depending on the result, the output is either the error message INVALID
or the payload. The nature of the authentication assurance, in turn, depends on the output:
• If the output is INVALID, then the payload and the associated data string cannot both be
authentic, ie, they cannot have originated from a source that executed the generation-
encryption process on them with the given nonce to produce the purported ciphertext.
• If the output is the payload, then the design of the mode provides assurance that the
payload and the associated data are authentic. This assurance, however, is not absolute:
an attacker can generate a ciphertext with a certain probability.
In the second case, the scarcity of ciphertexts and, thus, the expected probability that an attacker
can guess a ciphertext, is regulated by the size of Tlen . In particular, the probability is no greater
than 1 in 2
Tlen
that a single inauthentic purported ciphertext will pass the decryption-verification
process with a given associated data string and nonce. Of course, an attacker may attempt to
present many purported ciphertexts to the decryption-verification process and thereby increase
the probability that at least one of them will turn out to be a true ciphertext.
Moreover, an attacker may be able to choose the purported ciphertext in such a way as to control
every bit of the corresponding payload, as described in [9].
Therefore, if the output of the
* *
In particular, given a single valid ciphertext, and the corresponding payload and nonce, the attacker chooses any set
of bits to flip in the payload and flips the corresponding set of bits in the ciphertext. The attacker then tries to induce
the decryption-verification process to reuse the associated counter blocks with the altered ciphertext. When the Когда
counter blocks are generated as in Appendix A, this step is equivalent to inducing the decryption-verification
process to reuse the nonce. In principle, a system could monitor the nonces that are presented to the decryption-
verification process to facilitate some defense against this attack, but such monitoring may not be feasible in
practice.
15 15
decryption-verification process is a payload, the contents of the payload do not constitute
evidence for its authenticity beyond the assurance that the mode already provides.
Also, an attacker may be able to intercept a legitimate ciphertext and “replay” it for verification
at a later time. To defend against such an event, the controlling protocol or application should
typically provide the receiver with a means to detect replayed messages, out-of-sequence
messages, and missing messages, for example, by numbering legitimate messages sequentially.
B.2
Selection of the MAC Length
Larger values of Tlen provide greater authentication assurance, as described in Section B.1. The
performance tradeoff is that larger values of Tlen require more bandwidth/storage for the
ciphertext.
Although the formatting function in Appendix A permits Tlen to be any integer multiple of 16
between 32 and 128, inclusive, a value of Tlen that is less than 64 shall not be used without a
careful analysis of the risks of accepting inauthentic data as authentic.
In particular, a value of Tlen smaller than 64 should not be used unless the controlling protocol
or application environment sufficiently restricts the number of times that the decryption-
verification process can return INVALID, across all implementations under any given key. For Для
example, the short duration of a session or, more generally, the low bandwidth of the
communication channel may preclude many repeated trials.
Similarly, for larger values of Tlen , the controlling protocol or the application environment
should limit the number of inauthentic input sets that may be presented to the decryption-
verification process to a number commensurate with the value of the protected data.
This guidance can be quantified in terms of the following two bounds: 1) the highest acceptable
probability for an inauthentic message to pass the decryption-verification process, and 2) a limit
on the number of times that the output is the error message INVALID before the key is retired,
across all implementations of the decryption-verification process under the key. Given estimates
of these quantities, denoted Risk and MaxErrs , respectively, Tlen should satisfy the following
inequality:
. .
) )
/ /
lg(
Risk
MaxErrs
Tlen ≥
For example, suppose that a system will not output INVALID for more than 1024 messages
before retiring the key (ie, MaxErrs =2
10 10
), and that the users can tolerate about a one in a million
chance that the system will accept an inauthentic message (ie, Risk =2
-20 -20
). ). In this case, Tlen may
be as low as 32. On the other hand, if MaxErrs =2
32 32
and Risk= 2
-32
, then Tlen should be at least
64. 64.
16 16
Appendix C: Example Vectors
In this appendix, four examples are provided for the encryption-generation process of CCM with
the formatting and counter generation functions that are specified in Appendix A. The underlying
block cipher algorithm is the AES algorithm [2] under a key of 128 bits. The MACs, the nonces,
the associated data strings, and the payload strings have different lengths in each example,
including a very long, repetitive string of associated data in Example 4. The bit strings are
represented in hexadecimal notation.
From each example, a corresponding example of the decryption-verification process of CCM is
straightforward to construct.
C.1
Example 1
In the following example, Klen = 128, Tlen =32, Nlen = 56, Alen = 64, and Plen = 32.
K :
40414243 44454647 48494a4b 4c4d4e4f
N :
10111213 141516
A :
00010203 04050607
P :
20212223
B :
4f101112 13141516 00000000 00000004
00080001 02030405 06070000 00000000
20212223 00000000 00000000 00000000
T :
6084341b
Ctr
0 0
: :
07101112 13141516 00000000 00000000
S S
0 0
: :
2d281146 10676c26 32bad748 559a679a
Ctr
1 1
: :
07101112 13141516 00000000 00000001
S S
1 1
: :
51432378 e474b339 71318484 103cddfb
C :
7162015b 4dac255d
C.2
Example 2
In the following example, Klen = 128, Tlen =48, Nlen = 64, Alen = 128, and Plen = 128.
K :
40414243 44454647 48494a4b 4c4d4e4f
N :
10111213 14151617
A :
00010203 04050607 08090a0b 0c0d0e0f
P :
20212223 24252627 28292a2b 2c2d2e2f
17 17
B :
56101112 13141516 17000000 00000010
00100001 02030405 06070809 0a0b0c0d
0e0f0000 00000000 00000000 00000000
20212223 24252627 28292a2b 2c2d2e2f
T :
7f479ffc a464
Ctr
0 0
: :
06101112 13141516 17000000 00000000
S S
0 0
: :
6081d043 08a97dcc 20cdcc60 bf947b78
Ctr
1 1
: :
06101112 13141516 17000000 00000001
S S
1 1
: :
f280d2c3 75cf7945 20335db9 2b107712
C :
d2a1f0e0 51ea5f62 081a7792 073d593d
1fc64fbf accd
C.3
Example 3
In the following example, Klen = 128, Tlen =64, Nlen = 96, Alen = 160, and Plen = 192.
K :
40414243 44454647 48494a4b 4c4d4e4f
N :
10111213 14151617 18191a1b
A :
00010203 04050607 08090a0b 0c0d0e0f
10111213
P :
20212223 24252627 28292a2b 2c2d2e2f
30313233 34353637
B: В:
5a101112 13141516 1718191a 1b000018
00140001 02030405 06070809 0a0b0c0d
0e0f1011 12130000 00000000 00000000
20212223 24252627 28292a2b 2c2d2e2f
30313233 34353637 00000000 00000000
T :
67c99240 c7d51048
Ctr
0 0
: :
02101112 13141516 1718191a 1b000000
S S
0 0
: :
2f8a00bb 06658919 c3a040a6 eaed1a7f
Ctr
1 1
: :
02101112 13141516 1718191a 1b000001
S S
1 1
: :
c393238a d1923c5d b335c0c7 e1bac924
Ctr
2 2
: :
02101112 13141516 1718191a 1b000002
S S
2 2
: :
514798ea 9077bc92 6c22ebef 2ac732dc
C :
e3b201a9 f5b71a7a 9b1ceaec cd97e70b
18 18
6176aad9 a4428aa5 484392fb c1b09951
C.4
Example 4
In the following example, Klen = 128, Tlen =112, Nlen = 104, Alen = 524288, and Plen = 256.
The associated data string is too large to comfortably present in its entirety; therefore, the given
string of the first sixteen blocks of the associated data string is concatenated with itself
repeatedly to form a string of 524288 bits. Similarly, only the beginning and the end of the
resulting formatted data string B are presented.
K :
40414243 44454647 48494a4b 4c4d4e4f
N :
10111213 14151617 18191a1b 1c
A :
00010203 04050607 08090a0b 0c0d0e0f
10111213 14151617 18191a1b 1c1d1e1f
20212223 24252627 28292a2b 2c2d2e2f
30313233 34353637 38393a3b 3c3d3e3f
40414243 44454647 48494a4b 4c4d4e4f
50515253 54555657 58595a5b 5c5d5e5f
60616263 64656667 68696a6b 6c6d6e6f
70717273 74757677 78797a7b 7c7d7e7f
80818283 84858687 88898a8b 8c8d8e8f
90919293 94959697 98999a9b 9c9d9e9f
a0a1a2a3 a4a5a6a7 a8a9aaab acadaeaf
b0b1b2b3 b4b5b6b7 b8b9babb bcbdbebf
c0c1c2c3 c4c5c6c7 c8c9cacb cccdcecf
d0d1d2d3 d4d5d6d7 d8d9dadb dcdddedf
e0e1e2e3 e4e5e6e7 e8e9eaeb ecedeeef
f0f1f2f3 f4f5f6f7 f8f9fafb fcfdfeff
... ...
P :
20212223 24252627 28292a2b 2c2d2e2f
30313233 34353637 38393a3b 3c3d3e3f
B :
71101112 13141516 1718191a 1b1c0020
fffe0001 00000001 02030405 06070809
0a0b0c0d 0e0f1011 12131415 16171819
1a1b1c1d 1e1f2021 22232425 26272829
... ...
dadbdcdd dedfe0e1 e2e3e4e5 e6e7e8e9
eaebeced eeeff0f1 f2f3f4f5 f6f7f8f9
fafbfcfd feff0000 00000000 00000000
20212223 24252627 28292a2b 2c2d2e2f
30313233 34353637 38393a3b 3c3d3e3f
19 19
T :
f4dd5d0e e4046172 25ffe34f ce91
Ctr
0 0
: :
01101112 13141516 1718191a 1b1c0000
S S
0 0
: :
407136e2 77ec38fc 5af24ef3 24ca1178
Ctr
1 1
: :
01101112 13141516 1718191a 1b1c0001
S S
1 1
: :
49b07f8e 3aa1e010 4241e8bd 5260854e
Ctr
2 2
: :
01101112 13141516 1718191a 1b1c0002
S S
2 2
: :
6ad1cf2c 9af17af3 bcbbbf12 7a01f14d
C :
69915dad 1e84c637 6a68c296 7e4dab61
5ae0fd1f aec44cc4 84828529 463ccf72
b4ac6bec 93e8598e 7f0dadbc ea5b
20 20
Appendix D: References
[1] [1]
D. Whiting, R. Housley, N. Ferguson, Counter with CBC-MAC (CCM) . Available at В наличии в
http://csrc.nist.gov/ CryptoToolkit/modes/proposedmodes/.
[2] [2]
FIPS Publication 197, Advanced Encryption Standard (AES) . US DoC/NIST, November
26, 2001. Available at http://csrc.nist.gov/publications/.
[3] [3]
FIPS Publication 46-3, Data Encryption Standard (DES) . US DoC/NIST, October 25,
1999. Available at http://csrc.nist.gov/publications/.
[4] [4]
Institute of Electrical and Electronics Engineers, Inc., IEEE Std. 802.11i/D7.0, Draft
Amendment to Standard for Telecommunications and Information Exchange Between
Systems – LAN/MAN Specific Requirements – Part 11: Wireless Medium Access Control
(MAC) and Physical Layer (PHY) Specifications: Medium Access Control (MAC)
Security Enhancements , October 2003.
[5] [5]
Institute of Electrical and Electronics Engineers, Inc., IEEE Std. 802.11-1999, IEEE
Standard for Telecommunications and Information Exchange Between Systems –
LAN/MAN Specific Requirements – Part 11: Wireless Medium Access Control (MAC)
and Physical Layer (PHY) Specifications, New York: IEEE Press, 1999.
[6]
NIST Special Publication 800-38A, Recommendation for Block Cipher Modes of
Operation – Methods and Techniques . US DoC/NIST, December 2001. Available at
http://csrc.nist.gov/publications/.
[7] [7]
Draft NIST Special Publication 800-38B, Recommendation for Block Cipher Modes of
Operation: the CMAC Authentication Mode . US DoC/NIST, October 2003. Available
at http://csrc.nist.gov/CryptoToolkit/modes.
[8] [8]
J. Jonsson, On the Security of CTR + CBC-MAC , in Proceedings of Selected Areas in
Cryptography – SAC, 2002, K. Nyberg, H. Heys, Eds., Lecture Notes in Computer
Science, Vol. 2595, pp. 76-93, Berlin: Springer, 2002.
[9] [9]
P. Rogaway and D. Wagner, A Critique of CCM. Cryptology ePrint Archive: Report
2003/070, April, 2003. Available at http://eprint.iacr.org/2003/070/.
21 21