In cryptography, a message authentication code (MAC), sometimes known as an authentication tag, is a short piece of information used for authenticating and integrity-checking a message. In other words, it is used to confirm that the message came from the stated sender (its authenticity) and has not been changed (its integrity). The MAC value allows verifiers (who also possess a secret key) to detect any changes to the message content.
Terminology
The term message integrity code (MIC) is frequently substituted for the term MAC, especially in communications[1] to distinguish it from the use of the latter as Media Access Control (as in MAC address). However, some authors[2] use MIC to refer to a message digest, which aims only to uniquely but opaquely identify a single message. As such, it is recommended to avoid the term message integrity code (MIC), and instead use checksum, error detection code, hash, keyed hash, message authentication code, or protected checksum.[3]
Definitions
Informally, a message authentication code system consists of three algorithms:
- A key generation algorithm selects a key from the key space uniformly at random.
- A MAC generation algorithm efficiently returns a tag given the key and the message.
- A verifying algorithm efficiently verifies the authenticity of the message given the same key and the tag. That is, return accepted when the message and tag are not tampered with or forged, and otherwise return rejected.
A secure message authentication code must resist attempts by an adversary to forge tags, for arbitrary, selected, or all messages, including under conditions of known- or chosen-message. It should be computationally infeasible to compute a valid tag of the given message without knowledge of the key, even if for the worst case, we assume the adversary knows the tag of any message but the one in question.[4]
Formally, a message authentication code (MAC) system is a triple of efficient[5] algorithms (G, S, V) satisfying:
- G (key-generator) gives the key k on input 1n, where n is the security parameter.
- S (signing) outputs a tag t on the key k and the input string x.
- V (verifying) outputs accepted or rejected on inputs: the key k, the string x and the tag t.
S and V must satisfy the following:
- Pr [ k ← G(1n), V( k, x, S(k, x) ) = accepted ] = 1.[6]
A MAC is unforgeable if for every efficient adversary A
- Pr [ k ← G(1n), (x, t) ← AS(k, · )(1n), x ∉ Query(AS(k, · ), 1n), V(k, x, t) = accepted] < negl(n),
where AS(k, · ) denotes that A has access to the oracle S(k, · ), and Query(AS(k, · ), 1n) denotes the set of the queries on S made by A, which knows n. Clearly we require that any adversary cannot directly query the string x on S, since otherwise a valid tag can be easily obtained by that adversary.[7]
Security
Si bien las funciones MAC son similares a las funciones hash criptográficas , poseen requisitos de seguridad diferentes. Para ser considerada segura, una función MAC debe resistir la falsificación existencial bajo ataques de mensajes elegidos . Esto significa que, incluso si un atacante tiene acceso a un oráculo que posee la clave secreta y genera códigos MAC para los mensajes que el atacante elija, no puede adivinar el código MAC de otros mensajes (que no se utilizaron para consultar el oráculo) sin realizar cálculos computacionales inviables.
Los MAC se diferencian de las firmas digitales en que los valores MAC se generan y verifican utilizando la misma clave secreta. Esto implica que el remitente y el receptor de un mensaje deben acordar la misma clave antes de iniciar las comunicaciones, como ocurre con el cifrado simétrico . Por la misma razón, los MAC no proporcionan la propiedad de no repudio que ofrecen las firmas, especialmente en el caso de una clave secreta compartida en toda la red : cualquier usuario que pueda verificar un MAC también es capaz de generar MAC para otros mensajes. En cambio, una firma digital se genera utilizando la clave privada de un par de claves, que es criptografía de clave pública. [ 5 ] Dado que esta clave privada solo es accesible para su titular, una firma digital prueba que un documento fue firmado únicamente por ese titular. Por lo tanto, las firmas digitales sí ofrecen no repudio. Sin embargo, el no repudio puede ser proporcionado por sistemas que vinculan de forma segura la información de uso de la clave a la clave MAC; La misma clave está en posesión de dos personas, pero una tiene una copia que puede usarse para generar la dirección MAC, mientras que la otra tiene una copia en un módulo de seguridad de hardware que solo permite la verificación de la dirección MAC. Esto es algo común en el sector financiero.
Si bien el objetivo principal de un MAC es prevenir la falsificación por parte de adversarios que desconocen la clave secreta, esto resulta insuficiente en ciertos escenarios. Cuando un adversario puede controlar la clave MAC, se requieren garantías más sólidas, similares a la resistencia a colisiones o la seguridad de preimagen en las funciones hash. En el caso de los MAC, estos conceptos se conocen como seguridad de compromiso y seguridad de descubrimiento de contexto . [ 8 ]
Implementación
MAC algorithms can be constructed from other cryptographic primitives, like cryptographic hash functions (as in the case of HMAC) or from block cipher algorithms (OMAC, CCM, GCM, and PMAC). However many of the fastest MAC algorithms, like UMAC-VMAC and Poly1305-AES, are constructed based on universal hashing.[9]
Intrinsically keyed hash algorithms such as SipHash are also by definition MACs; they can be even faster than universal-hashing based MACs.[10]
Additionally, the MAC algorithm can deliberately combine two or more cryptographic primitives, so as to maintain protection even if one of them is later found to be vulnerable. For instance, in Transport Layer Security (TLS) versions before 1.2, the input data is split in halves that are each processed with a different hashing primitive (SHA-1 and SHA-2) then XORed together to output the MAC.
One-time MAC
Universal hashing and in particular pairwise independent hash functions provide a secure message authentication code as long as the key is used at most once. This can be seen as the one-time pad for authentication.[11]
The simplest such pairwise independent hash function is defined by the random key, key = (a, b), and the MAC tag for a message m is computed as tag = (am + b) mod p, where p is prime.
More generally, k-independent hashing functions provide a secure message authentication code as long as the key is used less than k times for k-ways independent hashing functions.
Message authentication codes and data origin authentication have been also discussed in the framework of quantum cryptography. By contrast to other cryptographic tasks, such as key distribution, for a rather broad class of quantum MACs it has been shown that quantum resources do not offer any advantage over unconditionally secure one-time classical MACs.[12]
Standards
Various standards exist that define MAC algorithms. These include:
- FIPS PUB 113 Autenticación de datos informáticos , [ 13 ] retirado en 2002, [ 14 ] define un algoritmo basado en DES .
- FIPS PUB 198-1 El código de autenticación de mensajes con hash clave (HMAC) [ 15 ]
- Funciones derivadas de SHA-3 de NIST SP800-185 : cSHAKE, KMAC, TupleHash y ParallelHash [ 16 ]
- ISO/IEC 9797-1 Mecanismos que utilizan un cifrado de bloques [ 17 ]
- Mecanismos ISO /IEC 9797-2 que utilizan una función hash dedicada [ 18 ]
- ISO /IEC 9797-3 Mecanismos que utilizan una función hash universal [ 19 ]
- ISO /IEC 29192-6 Criptografía ligera - Códigos de autenticación de mensajes [ 20 ]
Las normas ISO/IEC 9797-1 y -2 definen modelos y algoritmos genéricos que pueden utilizarse con cualquier cifrado por bloques o función hash, y con diversos parámetros. Estos modelos y parámetros permiten definir algoritmos más específicos mediante la especificación de dichos parámetros. Por ejemplo, el algoritmo FIPS PUB 113 es funcionalmente equivalente al algoritmo MAC 1 de la norma ISO/IEC 9797-1 con el método de relleno 1 y el algoritmo de cifrado por bloques DES.
Un ejemplo de uso de MAC

[ 21 ] En este ejemplo, el remitente de un mensaje lo procesa mediante un algoritmo MAC para generar una etiqueta de datos MAC. El mensaje y la etiqueta MAC se envían al receptor. Este, a su vez, procesa la parte del mensaje de la transmisión mediante el mismo algoritmo MAC con la misma clave, generando una segunda etiqueta de datos MAC. El receptor compara la primera etiqueta MAC recibida con la segunda etiqueta MAC generada. Si son idénticas, el receptor puede asumir con seguridad que el mensaje no fue alterado ni manipulado durante la transmisión (integridad de los datos).
Sin embargo, para que el receptor pueda detectar ataques de repetición , el mensaje debe contener datos que garanticen que solo se puede enviar una vez (por ejemplo, marca de tiempo, número de secuencia o el uso de un MAC de un solo uso ). De lo contrario, un atacante podría, sin siquiera comprender su contenido, grabar el mensaje y reproducirlo posteriormente, obteniendo el mismo resultado que el remitente original.
Véase también
- Suma de verificación
- CMAC
- HMAC (código de autenticación de mensajes basado en hash)
- MAA
- MAC de tejón MMH
- Poli1305
- Cifrado autenticado
- UMAC
- VMAC
- SipHash
- KMAC
Notas
- ↑IEEE Standard for Information Technology - Telecommunications and Information Exchange Between Systems - Local and Metropolitan Area Networks - Specific Requirements - Part 11: Wireless LAN Medium Access Control (MAC) and Physical Layer (PHY) Specifications(PDF). (2007 revision). IEEE-SA. 12 June 2007. doi:10.1109/IEEESTD.2007.373646. ISBN 978-0-7381-5656-9. Archived from the original(PDF) on 13 October 2008.
- ↑"CS 513 System Security -- Hashes and Message Digests". www.cs.cornell.edu. Retrieved 20 December 2023.
- ↑R. Shirey (August 2007). Internet Security Glossary, Version 2. Network Working Group. doi:10.17487/RFC4949. RFC4949.Informational. Obsoletes RFC 2828.
- ↑The strongest adversary is assumed to have access to the signing algorithm without knowing the key. However, her final forged message must be different from any message she chose to query the signing algorithm before. See Pass's discussions before def 134.2.
- 12Theoretically, an efficient algorithm runs within probabilistic polynomial time.
- ↑Pass, def 134.1
- ↑Pass, def 134.2
- ↑Bhaumik, Ritam; Chakraborty, Bishwajit; Choi, Wonseok; Dutta, Avijit; Govinden, Jérôme; Shen, Yaobin (2024). "The Committing Security of MACs with Applications to Generic Composition". In Reyzin, Leonid; Stebila, Douglas (eds.). Advances in Cryptology – CRYPTO 2024. Lecture Notes in Computer Science. Vol. 14923. Cham: Springer Nature Switzerland. pp. 425–462. doi:10.1007/978-3-031-68385-5_14. ISBN 978-3-031-68385-5.
- ↑"VMAC: Message Authentication Code using Universal Hashing". CFRG Working Group. Retrieved 16 March 2010.
- ↑Jean-Philippe Aumasson & Daniel J. Bernstein (18 September 2012). "SipHash: a fast short-input PRF"(PDF).
- ↑Simmons, Gustavus (1985). "Authentication theory/coding theory". Advances in Cryptology – Proceedings of CRYPTO 84. Berlin: Springer. pp. 411–431.
- ↑ Nikolopoulos, Georgios M.; Fischlin, Marc (2020). "Autenticación del origen de datos segura desde el punto de vista de la teoría de la información con recursos cuánticos y clásicos" . Cryptography . 4 (4): 31. arXiv : 2011.06849 . doi : 10.3390/cryptography4040031 . S2CID 226956062 .
- ↑ "FIPS PUB 113 Autenticación de datos informáticos " . Archivado del original el 27 de septiembre de 2011. Consultado el 10 de octubre de 2010 .
- ↑ "Publicaciones de estándares federales de procesamiento de información, FIPS retiradas listadas por número" . Archivado del original el 1 de agosto de 2010. Recuperado el 10 de octubre de 2010 .
- ↑ " El código de autenticación de mensajes basado en hash con clave (HMAC) " (PDF) . Consultado el 20 de diciembre de 2023 .
- ↑ Funciones derivadas de SHA-3 nvlpubs.nist.gov
- ↑ "ISO/IEC 9797-1:2011" . ISO . Consultado el 20 de diciembre de 2023 .
- ↑ "ISO/IEC 9797-2:2011" . ISO . Consultado el 20 de diciembre de 2023 .
- ↑ "ISO/IEC 9797-3:2011" . ISO . Consultado el 20 de diciembre de 2023 .
- ↑ "ISO/IEC 29192-6:2019" . ISO . Consultado el 20 de diciembre de 2023 .
- ↑ "Descripción general de la seguridad de Mac", Mac® Security Bible , Wiley Publishing, Inc., 1 de noviembre de 2011, págs. 1–26 , doi : 10.1002/9781118257739.ch1 , ISBN 9781118257739
Referencias
- Goldreich, Oded (2001), Fundamentos de criptografía I: Herramientas básicas , Cambridge: Cambridge University Press, ISBN 978-0-511-54689-1
- Goldreich, Oded (2004), Fundamentos de criptografía II: Aplicaciones básicas (1.ª ed. publ .), Cambridge [ua]: Cambridge Univ. Press, ISBN 978-0-521-83084-3
- Pass, Rafael, Un curso de criptografía (PDF) , consultado el 31 de diciembre de 2015.[ 1 ]
Enlaces externos
- Entrada de RSA Laboratories en MACs
- Conferencia de Ron Rivest sobre MACs
- ↑ 11-12-20C8
- Códigos de autenticación de mensajes
- Detección y corrección de errores