1 Introduction Authenticated Encryption
authenticationconfiguration 使用

authenticationconfiguration 使用1.引言1.1 概述概述部分的内容可以介绍authenticationconfiguration的定义和作用。
你可以参考以下例子编写概述部分的内容:概述在当今数字化时代,随着网络应用和系统的快速发展,确保用户身份和信息的安全性变得尤为重要。
身份验证是一种广泛应用于多个领域的技术,其目的是确认用户的身份以授予访问特定资源或执行特定操作的权限。
在程序开发中,authenticationconfiguration的概念应运而生。
authenticationconfiguration是一种具有重要作用的配置选项,它提供了一种通用的框架,用于定义和配置身份验证的细节和规则。
通过authenticationconfiguration,开发人员能够灵活地设置和管理用户认证系统,确保只有合法用户能够获得授权访问系统资源。
authenticationconfiguration的主要作用是提供一个集中管理身份验证的机制,以确保系统安全和合规。
通过该配置选项,开发人员可以方便地配置不同的身份验证方式,如用户名密码、双因素认证、指纹识别等。
此外,authenticationconfiguration还允许开发人员定义和设置访问策略,例如密码复杂度要求、登录失败次数限制等,以增加系统的安全性。
除了提供身份验证的灵活性和安全性,authenticationconfiguration 还可以简化系统的开发和维护工作。
通过将身份验证的配置集中在一个地方,开发人员可以更加容易地管理和更新身份验证规则,而无需修改大量的代码和配置文件。
这不仅节省了开发时间,也减少了由于配置错误或安全漏洞引起的潜在问题。
综上所述,authenticationconfiguration是一种非常重要的配置选项,它提供了一个灵活、安全和高效的方式来定义和管理用户身份验证。
无论是在Web应用、移动应用还是其他类型的系统中,authenticationconfiguration都发挥着至关重要的作用,保护用户和系统的安全。
authenticationmanager的authenticate方法

authenticationmanager的authenticate方法(原创版3篇)篇1 目录1.AuthenticationManager 简介2.authenticate 方法的作用3.authenticate 方法的参数4.authenticate 方法的返回值5.authenticate 方法的实际应用篇1正文一、AuthenticationManager 简介AuthenticationManager 是 Java 中处理用户认证的一个接口,它负责管理与用户认证相关的操作。
在 Java 的安全模型中,AuthenticationManager 扮演着核心的角色,它允许我们实现自定义的认证逻辑,以满足不同场景下对安全性的需求。
二、authenticate 方法的作用AuthenticationManager 中的 authenticate 方法用于验证用户提供的身份凭据(如用户名和密码)是否与预期的凭据相匹配。
如果验证成功,该方法将返回一个 Authentication 对象,表示用户已成功登录;如果验证失败,则会抛出一个 AuthenticationException 异常。
三、authenticate 方法的参数authenticate 方法接收两个参数:ernamePasswordAuthenticationToken:这是用户提供的身份凭据,通常包括用户名和密码。
2.GrantedAuthority:这是一个可选参数,表示用户拥有的授权信息。
在实际应用中,我们可以利用这个参数为用户分配不同的权限。
四、authenticate 方法的返回值authenticate 方法的返回值是一个 Authentication 对象,它包含了用户认证的相关信息,如用户名、密码等。
如果验证失败,该方法将抛出一个 AuthenticationException 异常。
五、authenticate 方法的实际应用下面是一个使用 AuthenticationManager 的 authenticate 方法进行用户认证的简单示例:```javaimportorg.springframework.security.authentication.AuthenticationManag er;importernamePasswordAut henticationToken;importerDetails;importerDetailsServic e;importernameNotFoundE xception;public class CustomAuthenticationManager implements AuthenticationManager {private UserDetailsService userDetailsService;public CustomAuthenticationManager(UserDetailsService userDetailsService) {erDetailsService = userDetailsService;}@Overridepublic Authentication authenticate(AuthenticationToken token, GrantedAuthority authorities) throws AuthenticationException {String username = token.getName();String password = token.getPassword();try {UserDetails userDetails =erDetailsService.loadUserByUsername(username);if (userDetails == null||!userDetails.getPassword().equals(password)) {throw new UsernameNotFoundException("用户名或密码错误");}return new UsernamePasswordAuthenticationToken(userDetails, password, userDetails.getAuthorities());} catch (UsernameNotFoundException e) {throw new AuthenticationException("认证失败",e);}}}```在这个示例中,我们实现了一个自定义的 AuthenticationManager,它使用 UserDetailsService 来加载用户信息。
Android应用安全开发之浅谈加密算法的坑

Android应用安全开发之浅谈加密算法的坑作者:阿里移动安全@伊樵,@舟海阿里聚安全,一站式解决应用开发安全问题Android开发中,难免会遇到需要加解密一些数据内容存到本地文件、或者通过网络传输到其他服务器和设备的问题,但并不是使用了加密就绝对安全了,如果加密函数使用不正确,加密数据很容易受到逆向破解攻击。
还有很多开发者没有意识到的加密算法的问题。
1、需要了解的基本概念密码学的三大作用:加密(Encryption)、认证(Authentication),鉴定(Identification)加密:防止坏人获取你的数据。
认证:防止坏人修改了你的数据而你却并没有发现。
鉴权:防止坏人假冒你的身份。
明文、密文、密钥、对称加密算法、非对称加密算法,这些基本概念和加密算法原理就不展开叙述了。
2、Android SDK提供的API2.1 Android 加密相关API结构Android SDK使用的API和JAVA提供的基本相似,由Java Cryptography Architecture (JCA,java加密体系结构) ,Java Cryptography Extension (JCE,Java 加密扩展包) ,Java Secure Sockets Extension(JSSE,Java安全套接字扩展包),Java Authentication and Authentication Service(JAAS,Java 鉴别与安全服务)组成。
JCA提供基本的加密框架,如证书、数字签名、消息摘要和密钥对产生器,对应的Android API中的以下几个包:JCE扩展了JCA,提供了各种加密算法、摘要算法、密钥管理等功能,对应的Android API中的以下几个包:JSSE提供了SSL(基于安全套接层)的加密功能,使用HTTPS加密传输使用,对应的Android API主要是.ssl包中。
JAAS 提供了在Java平台上进行用户身份鉴别的功能。
IPSec故障排除了解和使用调试指令

IPSec故障排除:了解和使用调试指令ContentsIntroductionPrerequisitesRequirementsComponents UsedConventionsCisco IOS软件调试show crypto isakmp sashow crypto ipsec sashow crypto engine connection activedebug crypto isakmpdebug crypto ipsec示例错误信息Replay Check FailedQM FSM 错误无效本地地址IKE信息从X.X.X.X失败了其健全性检查或是畸形的Processing of Main Mode Failed with PeerProxy Identities Not SupportedTransform Proposal Not SupportedNo Cert and No Keys with Remote Peer没找到的对等体地址X.X.X.XIPsec Packet has Invalid SPIIPSEC(initialize_sas):Invalid Proxy IDs被保留的没有零在有效载荷5Hash Algorithm Offered does not Match PolicyHMAC Verification FailedRemote Peer Not Responding所有SA IPSec建议认为不可接受Packet Encryption/Decryption Error信息包接收错误由于ESP顺序失败设法的错误设立在7600系列路由器的VPN隧道PIX调试show crypto isakmp sashow crypto ipsec sadebug crypto isakmpdebug crypto ipsec常见路由器-VPN客户端问题无法访问 VPN 隧道外部的子网:分割隧道常见PIX-to-VPN客户端问题建立隧道之后流量不流通:无法 ping 通位于 PIX 后的网络内部建立隧道之后,用户无法浏览 Internet:分割隧道建立隧道之后,某些应用程序无法正常工作:对客户端进行 MTU 调节无法使用 sysopt 命令验证访问控制列表 (ACL)Related InformationIntroduction本文描述用于的普通的调试指令排除在两Cisco IOS的IPsec问题故障?软件和PIX/ASA。
spring中文API文档

这次发布的Spring Security-3.0.1 是一个bug fix 版,主要是对3.0 中存在的一些问题进行修正。
文档中没有添加新功能的介绍,但是将之前拼写错误的一些类名进行了修正,建议开发者以这一版本的文档为参考。
另:Spring Security 从2010-01-01 以后,版本控制从SVN 换成了GIT,我们在翻译文档的时候,主要是根据SVN 的变化来进行文档内容的比对,这次换成GIT 后,感觉缺少了之前那种文本比对工具,如果有对GIT 熟悉的朋友,还请推荐一下文本比对的工具,谢谢。
序言I. 入门1. 介绍1.1. Spring Security 是什么?1.2. 历史1.3. 发行版本号1.4. 获得Spring Security1.4.1. 项目模块1.4.1.1. Core - spring-security-core.jar1.4.1.2. Web - spring-security-web.jar1.4.1.3. Config - spring-security-config.jar1.4.1.4. LDAP - spring-security-ldap.jar1.4.1.5. ACL - spring-security-acl.jar1.4.1.6. CAS - spring-security-cas-client.jar1.4.1.7. OpenID - spring-security-openid.jar1.4.2. 获得源代码2. Security 命名空间配置2.1. 介绍2.1.1. 命名空间的设计2.2. 开始使用安全命名空间配置2.2.1. 配置web.xml2.2.2. 最小<http> 配置2.2.2.1. auto-config 包含了什么?2.2.2.2. 表单和基本登录选项2.2.3. 使用其他认证提供器2.2.3.1. 添加一个密码编码器2.3. 高级web 特性2.3.1. Remember-Me 认证2.3.2. 添加HTTP/HTTPS 信道安全2.3.3. 会话管理2.3.3.1. 检测超时2.3.3.2. 同步会话控制2.3.3.3. 防止Session 固定攻击2.3.4. 对OpenID 的支持2.3.4.1. 属性交换2.3.5. 添加你自己的filter2.3.5.1. 设置自定义AuthenticationEntryPoint2.4. 保护方法2.4.1. <global-method-security> 元素2.4.1.1. 使用protect-pointcut 添加安全切点2.5. 默认的AccessDecisionManager2.5.1. 自定义AccessDecisionManager2.6. 验证管理器和命名空间3. 示例程序3.1. Tutorial 示例3.2. Contacts3.3. LDAP 例子3.4. CAS 例子3.5. Pre-Authentication 例子4. Spring Security 社区4.1. 任务跟踪4.2. 成为参与者4.3. 更多信息II. 结构和实现5. 技术概述5.1. 运行环境5.2. 核心组件5.2.1. SecurityContextHolder, SecurityContext 和Authentication 对象5.2.1.1. 获得当前用户的信息5.2.2. UserDetailsService5.2.3. GrantedAuthority5.2.4. 小结5.3. 验证5.3.1. 什么是Spring Security 的验证呢?5.3.2. 直接设置SecurityContextHolder 的内容5.4. 在web 应用中验证5.4.1. ExceptionTranslationFilter5.4.2. AuthenticationEntryPoint5.4.3. 验证机制5.4.4. 在请求之间保存SecurityContext 。
shiro simpleauthenticationinfo() 构造方法讲解

shiro simpleauthenticationinfo() 构造方法讲解**一、背景介绍**Shiro是一个广泛使用的Java安全框架,它提供了身份认证、授权、会话管理和加密等功能。
在Shiro中,AuthenticationInfo类是用于存储和操作身份验证信息的核心类。
其中,simpleAuthenticationInfo()方法则是用于创建一个新的AuthenticationInfo对象,用于存储用户的身份验证信息。
**二、构造方法详解**simpleAuthenticationInfo()方法接受一个用户名和一个Realm 对象作为参数。
这个方法会根据提供的用户名和Realm对象创建一个新的AuthenticationInfo对象。
这个对象包含了用户名、密码以及其他身份验证信息。
这个方法的构造过程大致分为三个步骤:1. 创建一个新的AuthenticationInfo对象,并设置其属性。
这些属性包括用户名、密码、Realm对象等。
2. 根据Realm对象中的配置,对用户名和密码进行验证。
如果验证通过,则将用户名和Realm对象存储在AuthenticationInfo对象中。
3. 如果验证失败,则会抛出一个异常。
值得注意的是,simpleAuthenticationInfo()方法返回的是一个ReadOnlyAuthenticationInfo对象,这是因为Shiro的安全机制要求身份验证信息只能读取,不能修改。
**三、使用示例**下面是一个简单的使用示例:```java// 创建一个Realm对象,用于存储用户的信息和配置MyRealm realm = new MyRealm();// 创建一个用户名(例如"john")String username = "john";// 使用simpleAuthenticationInfo()方法创建一个新的AuthenticationInfo对象ReadOnlyAuthenticationInfo info = SimpleAuthenticationInfo.createReadOnly(username, "password", realm);```在这个示例中,我们创建了一个名为"john"的用户,并使用simpleAuthenticationInfo()方法创建了一个新的AuthenticationInfo对象,该对象包含了用户名"john"和密码"password"。
authenticationexception 构造-概述说明以及解释

authenticationexception 构造-概述说明以及解释1.引言概述部分的内容可以简要介绍身份验证异常的背景和意义。
以下是一个可能的写作参考:1.1 概述在现代互联网和信息化社会中,越来越多的应用程序和系统需要对用户进行身份验证,以确保数据安全和用户身份的合法性。
然而,身份验证过程中往往会出现各种问题和异常情况,其中最常见的即是身份验证异常。
身份验证异常是指在进行身份验证过程中出现的错误和异常情况。
当应用程序或系统无法成功验证用户的身份时,会抛出身份验证异常以指示错误的原因和相应的处理方式。
身份验证异常的发生可能是由于多种原因引起的,例如密码错误、凭据过期、网络错误等等。
身份验证异常的重要性不言而喻。
首先,它是确保系统和数据安全的重要一环。
通过身份验证异常的处理,我们可以及时检测到潜在的安全威胁,并采取相应的措施进行防范和应对。
其次,身份验证异常的准确处理可以提高用户体验。
当身份验证失败时,用户可能会受到困扰或不便,因此及时准确地处理身份验证异常,可以帮助用户更好地使用和访问系统。
在本文中,我们将探讨身份验证异常的定义和作用,并重点讨论常见的身份验证异常原因和解决方法。
通过深入了解和研究身份验证异常,我们可以进一步提高系统的安全性和用户体验,为身份验证异常的未来发展提供更多的应用前景。
1.2 文章结构文章结构部分的内容可以包括以下方面:文章结构指的是整篇文章的组织和布局,可以简单描述为引言、正文和结论三个部分。
引言部分主要介绍文章的背景和目的,引起读者的兴趣和对身份验证异常概念的关注。
正文部分是本文的核心部分,可以按照身份验证异常的定义和作用以及常见原因和解决方法来展开阐述。
- 在身份验证异常的定义和作用方面,可以从概念出发,简要介绍身份验证异常是什么,它在软件开发中的作用和意义,以及为什么我们需要对其进行研究和了解。
- 在身份验证异常的常见原因和解决方法方面,可以列举一些常见的身份验证异常的原因,例如密码错误、用户名不存在等,然后提供相应的解决方法,如加强密码策略、增加错误提示等。
ATECC508A Atmel密钥字符串认证设备数据手册说明书

ATECC508AAtmel CryptoAuthentication DeviceSUMMARY DATASHEETFeatures∙ Cryptographic Co-processor with Secure Hardware-based Key Storage ∙ Performs High-Speed Public Key (PKI) Algorithms– ECDSA: FIPS186-3 Elliptic Curve Digital Signature Algorithm – ECDH: FIPS SP800-56A Elliptic Curve Diffie-Hellman Algorithm ∙ NIST Standard P256 Elliptic Curve Support ∙ SHA-256 Hash Algorithm with HMAC Option ∙ Host and Client Operations ∙ 256-bit Key Length ∙ Storage for up to 16 Keys∙ Two high-endurance monotonic counters ∙ Guaranteed Unique 72-bit Serial Number∙ Internal High-quality FIPS Random Number Generator (RNG) ∙ 10Kb EEPROM Memory for Keys, Certificates, and Data ∙ Storage for up to 16 Keys∙ Multiple Options for Consumption Logging and One Time Write Information∙ Intrusion Latch for External Tamper Switch or Power-on Chip Enablement. Multiple I/O Options:– High-speed Single Pin Interface, with One GPIO Pin – 1MHz Standard I 2C Interface ∙ 2.0V to 5.5V Supply Voltage Range ∙ 1.8V to 5.5V IO levels ∙ <150nA Sleep Current∙ 8-pad UDFN, 8-lead SOIC, and 3-lead CONTACT PackagesApplications∙ IoT Node Security and ID ∙ S ecure Download and Boot ∙ E cosystem Control ∙ M essage Security ∙ A nti-CloningThis is a summary document. The complete document is available under NDA. For more information, please contact your local Atmel sales office.Secure Download and BootAuthentication and Protect Code In-transitEcosystem ControlEnsure Only OEM/Licensed Nodes and Accessories WorkAnti-cloningPrevent Building with Identical BOM or Stolen CodeMessage SecurityAuthentication, Message Integrity,and Confidentiality of Network Nodes (IoT)CryptoAuthenticationEnsures Things and Code are Real, Untampered, and ConfidentialPin Configuration and Pinouts Table 1. Pin ConfigurationFigure 1. PinoutsATECC508A [Summary Datasheet]Atmel-8923BS-CryptoAuth-ATECC508A-Datasheet-Summary_102015221 Introduction1.1 ApplicationsThe Atmel® ATECC508A is a member of the Atmel CryptoAuthentication™ family of crypto engine authentication devices with highly secure hardware-based key storage.The ATECC508A has a flexible command set that allows use in many applications, including the following,among many others:∙Network/IoT Node ProtectionAuthenticates node IDs, ensures the integrity of messages, and supports key agreement to create sessionkeys for message encryption.∙Anti-CounterfeitingValidates that a removable, replaceable, or consumable client is authentic. Examples of clients could besystem accessories, electronic daughter cards, or other spare parts. It can also be used to validate asoftware/firmware module or memory storage element.∙Protecting Firmware or MediaValidates code stored in flash memory at boot to prevent unauthorized modifications, encrypt downloadedprogram files as a common broadcast, or uniquely encrypt code images to be usable on a single systemonly.∙Storing Secure DataStore secret keys for use by crypto accelerators in standard microprocessors. Programmable protection isavailable using encrypted/authenticated reads and writes.∙Checking User PasswordValidates user-entered passwords without letting the expected value become known, maps memorablepasswords to a random number, and securely exchanges password values with remote systems.1.2 Device FeaturesThe ATECC508A includes an EEPROM array which can be used for storage of up to 16 keys, certificates,miscellaneous read/write, read-only or secret data, consumption logging, and security configurations. Access to the various sections of memory can be restricted in a variety of ways and then the configuration can be locked to prevent changes.The ATECC508A features a wide array of defense mechanisms specifically designed to prevent physical attacks on the device itself, or logical attacks on the data transmitted between the device and the system. Hardware restrictions on the ways in which keys are used or generated provide further defense against certain styles of attack.Access to the device is made through a standard I2C Interface at speeds of up to 1Mb/s. The interface iscompatible with standard Serial EEPROM I2C interface specifications. The device also supports a Single-Wire Interface (SWI), which can reduce the number of GPIOs required on the system processor, and/or reduce the number of pins on connectors. If the Single-Wire Interface is enabled, the remaining pin is available for use as a GPIO, an authenticated output or tamper input.Using either the I2C or Single-Wire Interface, multiple ATECC508A devices can share the same bus, which saves processor GPIO usage in systems with multiple clients such as different color ink tanks or multiple spare parts, for example.Each ATECC508A ships with a guaranteed unique 72-bit serial number. Using the cryptographic protocolssupported by the device, a host system or remote server can verify a signature of the serial number to prove that the serial number is authentic and not a copy. Serial numbers are often stored in a standard Serial EEPROM;however, these can be easily copied with no way for the host to know if the serial number is authentic or if it is a clone.ATECC508A [Summary Datasheet]Atmel-8923BS-CryptoAuth-ATECC508A-Datasheet-Summary_1020153 3ATECC508A [Summary Datasheet]Atmel-8923BS-CryptoAuth-ATECC508A-Datasheet-Summary_10201544The ATECC508A can generate high-quality FIPS random numbers and employ them for any purpose, including usage as part of the device’s crypto protocols. Because each random number is guaranteed to be essentially unique from all numbers ever generated on this or any other device, their inclusion in the protocol calculation ensures that replay attacks (i.e. re-transmitting a previously successful transaction) will always fail.System integration is easy due to a wide supply voltage range (of 2.0V to 5.5V) and an ultra-low sleep current (of <150nA). Multiple package options are available.See Section 3 for information regarding compatibility with the Atmel ATSHA204 and ATECC108.1.3 Cryptographic OperationThe ATECC508A implements a complete asymmetric (public/private) key cryptographic signature solution based upon Elliptic Curve Cryptography and the ECDSA signature protocol. The device features hardware acceleration for the NIST standard P256 prime curve and supports the complete key life cycle from high quality private key generation, to ECDSA signature generation, ECDH key agreement, and ECDSA public key signature verification.The hardware accelerator can implement such asymmetric cryptographic operations from ten to one-thousand times faster than software running on standard microprocessors, without the usual high risk of key exposure that is endemic to standard microprocessors.The device is designed to securely store multiple private keys along with their associated public keys andcertificates. The signature verification command can use any stored or an external ECC public key. Public keys stored within the device can be configured to require validation via a certificate chain to speed-up subsequent device authentications.Random private key generation is supported internally within the device to ensure that the private key can never be known outside of the device. The public key corresponding to a stored private key is always returned when the key is generated and it may optionally be computed at a later time.The ATECC508A also supports a standard hash-based challenge-response protocol in order to simplifyprogramming. In its most basic instantiation, the system sends a challenge to the device, which combines that challenge with a secret key and then sends the response back to the system. The device uses a SHA-256cryptographic hash algorithm to make that combination so that an observer on the bus cannot derive the value of the secret key, but preserving that ability of a recipient to verify that the response is correct by performing the same calculation with a stored copy of the secret on the recipient’s system.Due to the flexible command set of the ATECC508A, these basic operation sets (i.e. ECDSA signatures, ECDH key agreement and SHA-256 challenge-response) can be expanded in many ways.In a host-client configuration where the host (for instance a mobile phone) needs to verify a client (for instance an OEM battery), there is a need to store the secret in the host in order to validate the response from the client. The CheckMac command allows the device to securely store the secret in the host system and hides the correct response value from the pins, returning only a yes or no answer to the system.All hashing functions are implemented using the industry-standard SHA-256 secure hash algorithm, which is part of the latest set of high-security cryptographic algorithms recommended by various government agencies and cryptographic experts. The ATECC508A employs full-sized 256 bit secret keys to prevent any kind of exhaustive attack.2 Electrical Characteristics 2.1 Absolute Maximum Ratings*Operating Temperature .......................... -40°C to 85°C Storage Temperature ........................... -65°C to 150°C Maximum Operating Voltage................................. 6.0V DC Output Current ................................................ 5mA Voltage on any pin ...................... -0.5V to (V CC + 0.5V) *Notice: Stresses beyond those listed under “AbsoluteMaximum Ratings” may cause permanent damage tothe device. This is a stress rating only and functionaloperation of the device at these or any otherconditions beyond those indicated in the operationalsections of this specification are not implied.Exposure to absolute maximum rating conditions forextended periods may affect device reliability.2.2 ReliabilityThe ATECC508A is fabricated with the Atmel high reliability of the CMOS EEPROM manufacturing technology.Table 2-1. EEPROM Reliability2.3 AC Parameters: All I/O InterfacesFigure 2-1. AC Parameters: All I/O InterfacesNote: 1. These parameters are guaranteed through characterization, but not tested.ATECC508A [Summary Datasheet]Atmel-8923BS-CryptoAuth-ATECC508A-Datasheet-Summary_1020155 5ATECC508A [Summary Datasheet]Atmel-8923BS-CryptoAuth-ATECC508A-Datasheet-Summary_102015662.3.1AC Parameters: Single-Wire InterfaceTable 2-2.AC Parameters: Single-Wire InterfaceApplicable from T A = -40°C to +85°C, V CC = +2.0V to +5.5V, CL =100pF (unless otherwise noted).Note: 1.START, ZLO, ZHI, and BIT are designed to be compatible with a standard UART running at 230.4Kbaud for both transmit and receive. The UART should be set to seven data bits, no parity and one Stop bit.2.3.2 AC Parameters: I2C InterfaceTable 2-3. AC Characteristics of I2C InterfaceApplicable over recommended operating range from TA = -40°C to + 85°C, V CC = +2.0V to +5.5V, CL = 1 TTL Gate and 100pF (unless otherwise noted).Note: 1. Values are based on characterization and are not tested.AC measurement conditions:∙RL (connects between SDA and V CC): 1.2k (for V CC +2.0V to +5.0V)∙Input pulse voltages: 0.3V CC to 0.7V CC∙Input rise and fall times: ≤ 50ns∙Input and output timing reference voltage: 0.5V CCATECC508A [Summary Datasheet]Atmel-8923BS-CryptoAuth-ATECC508A-Datasheet-Summary_1020157 7ATECC508A [Summary Datasheet]Atmel-8923BS-CryptoAuth-ATECC508A-Datasheet-Summary_102015882.4DC Parameters: All I/O InterfacesTable 2-4. DC Parameters on All I/O Interfaces2.4.1V IH and V IL SpecificationsThe input voltage thresholds when in sleep or idle mode are dependent on the V CC level as shown in the graphbelow. When the device is active (i.e. not in sleep or idle mode), the input voltage thresholds are different depending upon the state of TTLenable (bit 1) within the ChipMode byte in the Configuration zone of theEEPROM. When a common voltage is used for the ATECC508A V CC pin and the input pull-up resistor, then this bit should be set to a one, which permits the input thresholds to track the supply.If the voltage supplied to the V CC pin of the ATECC508A is different than the system voltage to which the input pull-up resistor is connected, then the system designer may choose to set TTLenable to zero, which enables a fixed input threshold according to the following table. The following applies only when the device is active:Table 2-5. V IL , V IH on All I/O Interfaces3 Compatibility3.1 Atmel ATSHA204ATECC508A is fully compatible with the ATSHA204 and ATSHA204A devices. If properly configured, it can be used in all situations where the ATSHA204 or ATSHA204A is currently employed. Because the Configuration zone is larger, the personalization procedures for the device must be updated when personalizing theATSHA204 or ATSHA204A.3.2 Atmel ATECC108ATECC508A is designed to be fully compatible with the ATECC108 and ATECC108A devices. If properlyconfigured, can be used in all situations where ATECC108 is currently employed. In many situations, theATECC508A can also be used in an ATECC108 application without change. The new revisions providesignificant advantages as outlined below:New Features in ATECC108A vs. ATECC108∙Intrusion Detection Capability, Including Gating Key Use∙New SHA Command, Also Computes HMAC∙X.509 Certificate Verification Capability∙Programmable Watchdog Timer Length∙Programmable Power Reduction∙Shared Random Nonce and Key Configuration Validation (Gendig Command)∙Larger Slot 8 which is Extended to 416 bytes4 Ordering InformationNotes: 1. Please contact Atmel for availability.2. Please contact Atmel for thinner packages.ATECC508A [Summary Datasheet]Atmel-8923BS-CryptoAuth-ATECC508A-Datasheet-Summary_1020159 9ATECC508A [Summary Datasheet]Atmel-8923BS-CryptoAuth-ATECC508A-Datasheet-Summary_1020151105Package Drawings5.18-lead SOICATECC508A [Summary Datasheet]Atmel-8923BS-CryptoAuth-ATECC508A-Datasheet-Summary_10201511 115.2 8-pad UDFNATECC508A [Summary Datasheet]Atmel-8923BS-CryptoAuth-ATECC508A-Datasheet-Summary_1020151125.33-lead CONTACTATECC508A [Summary Datasheet]Atmel-8923BS-CryptoAuth-ATECC508A-Datasheet-Summary_10201513 136 Revision HistoryATECC508A [Summary Datasheet] Atmel-8923BS-CryptoAuth-ATECC508A-Datasheet-Summary_102015114Atmel Corporation 1600 Technology Drive, San Jose, CA 95110 USA T: (+1)(408) 441.0311 F: (+1)(408) 436.4200 │ © 2015 Atmel Corporation. / Rev.:Atmel-8923BS-CryptoAuth-ATECC508A-Datasheet-Summary_102015.Atmel ®, Atmel logo and combinations thereof, Enabling Unlimited Possibilities ®, CryptoAuthentication™, and others are registered trademarks or trademarks of Atmel Corporation in U.S. and other countries.DISCLAIMER: The information in this document is provided in connection with Atmel products. No license, express or implied, by estoppel or otherwise, to any intellectual property right is granted by this document or in connection with the sale of Atmel products. EXCEPT AS SET FORTH IN THE ATMEL TERMS AND COND ITIONS OF SALES LOCATED ON THE ATMEL WEBSITE, ATMEL ASSUMES NO LIABILITY WHATSOEVER AND DISCLAIMS ANY EXPRESS, IMPLIED OR STATUTORY WARRANTY RELATING TO ITS PRODUCTS INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON -INFRINGEMENT. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, CONSEQUENTIAL, PUNITIVE, SPECIAL OR INCIDENTAL DAMAGES (INCLUDING, WITHOUT LIMITATION, DAMAG ES FOR LOSS AND PROFITS, BUSINESS INTERRUPTION, OR LOSS OF INFORMATION) ARISING OUT OF THE USE OR INABILITY TO USE THIS DOCUMENT , EVEN IF ATMEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. Atmel makes no representations or warranties with respect to the accuracy or completeness of the contents of this document and reserves the right to make changes to specifications and products descriptions at any time without notice. Atmel does not make any commitment to update the information contained herein. Unless specifically provided otherwise, Atmel products are not suitable for, and shall not be used in, automotive applications. At mel products are not intended, authorized, or warranted for use as components in applications intended to support or sustain life.SAFETY-CRITICAL, MILITARY, AND AUTOMOTIVE APPLICATIONS DISCLAIMER: Atmel products are not designed for and will not be used in connection with any applications where the failure of such products would reasonably be expected to result in significant personal injury or death (“Safety -Critical Applications”) without an Atmel officer's specific written consent. Safety-Critical Applications include, without limitation, life support devices and systems, equipment or systems for the operation of nuclear fac ilities and weapons systems. Atmel products are not designed nor intended for use in military or aerospace applications or environments unless specifically designated by Atmel as military-grade. Atmel products are not designed nor intended for use in automotive applications unless specifically designated by Atmel as automotive -grade.。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
Authenticated EncryptionJ.Black∗August19,20041IntroductionOften when two parties communicate over a network,they have two main security goals:privacy and authentication.In fact,there is compelling evidence that one should never use encryption without also providing authentication[8,14].Many solutions for the privacy and authentication problems have existed for decades,and the traditional approach to solving both simultaneously has been to combine them in a straightforward manner using so-called“generic composition.”However,recently there have been a number of new constructions which achieve both privacy and authenticity simultaneously,often much faster than any solution which uses generic composition.In this article we will explore the various approaches to achieving both privacy and authenticity,the so-called“Authenticated Encryption”problem.We will often abbreviate this as simply“AE.”We will start with generic composition methods and then explore the newer combined methods.Background.Throughout this article we will consider the AE problem in the“symmetric-key model.”This means that we assume our two communicating parties,traditionally called“Alice”and“Bob,”share a copy of some bit-string K,called the“key.”This key is typically chosen at random and then distributed to Alice and Bob via one of various methods.This is the starting point for our work.We now wish to provide Alice and Bob with an AE algorithm such that Alice can select a message M from a pre-defined message-space,process it with the AE algorithm along with the key(and possibly a“nonce”N–a counter or random value),and then send the resulting output to Bob.The output will be the ciphertext C,the nonce N,and a short message authentication tag,σ.Bob should be able to recover M just given C,N, and his copy of the key K.He should also be able to certify that Alice was the originator by computing a verification algorithm using the above values along with the tagσ.But what makes an AE algorithm“good?”We may have many requirements,and the relative importance of these requirements may vary according to the problem domain.Certainly one requirement is that the AE algorithm be“secure.”We will speak more about what this means in a moment.But many other attributes of the algorithm may be important for us as well:performance,portability,simplicity/elegance, parallelizability,availability of reference implementations,or freedom from patents;we will pay attention to each of these concerns to varying levels as well.Security.Certainly an AE scheme is not going to serve our needs unless it is secure.An AE scheme has two goals:privacy and authenticity.And each of these goals has a precise mathematical meaning[2,3,19].In addition there is a precise definition for“authenticated encryption,”the combination of both goals[5,6,26]. It would take us too far afield to carefully define each notion,but we will give a brief intuitive idea of what is meant.In our discussion we will use the term“adversary”to mean someone who is trying to subvert the security of the AE scheme,who knows the definition of the AE scheme,but who does not possess the key K.Privacy means,intuitively,that a passive adversary who views the ciphertext C and the nonce N,cannot “understand”the content of the message M.One way to achieve this is to make C indistinguishable from random bits,and indeed this is one definition of security for an encryption scheme that is sometimes used, although it is quite a strong one.∗Department of Computer Science,430UCB,Boulder,Colorado80309USA.E-mail:jrblack@ WWW: /∼jrblack/Scheme#Passes Provably Secure Assoc Data Parallelizable On-line Patent-Free IAPM1XECB1OCB1CCM2EAX2CWC2Helix1 SOBER-1281Figure1:A comparison of the various AE schemes.Generic composition is omitted since answers would depend on the particular instantiation.For the schemes which do not support associated data,subsequent methods have been suggested to remedy this;for example,see[32].Authenticity means,intuitively,that an active adversary cannot successfully fabricate a ciphertext C, a nonce N,and a tagσin such a way that Bob will believe that Alice was the originator.In the formal security model we allow the adversary to generate tags for messages of his choice as if he were Alice for some period of time,and then he must attempt a forgery.We do not give him credit for simply“replaying”a previously-generated message and tag,of course:he must construct a new value.If he does so with any significant probability of success,the authentication scheme is considered insecure.Associated Data.In many application settings we wish not only to encrypt and authenticate message M,but we wish also to include auxiliary data H which should be authenticated,but left unencrypted.An example might be a network packet where the payload should be encrypted(and authenticated)but the header should be unencrypted(and authenticated).The reason being that routers must be able to read the headers of packets in order to know how to properly route them.This need spurred some designers of AE schemes to allow“associated data”to be included as input to their schemes.Such schemes have been termed AEAD schemes(Authenticated Encryption with Associated Data),a notion which wasfirst formalized by Rogaway[32].As we will see,the AEAD problem is easily solved in the generic composition setting,but can become challenging when designing the more complex schemes.In his paper,Rogaway describes a few simple,but limited,ways to include associated data in any AE scheme,and then presents a specific method to efficiently add associated data to the OCB scheme,which we discuss below.Provable Security.One unfortunate aspect of most cryptographic schemes is that we cannot prove that any scheme meets the formal goals required of it.However,we can prove some things related to security, but it depends on the type of cryptographic object we are analyzing.If the object is a“primitive,”such as a block cipher,no proof of security is possible so instead we hope for security once we have shown that no known attacks(eg,differential cryptanalysis)seem to work.However,for algorithms which are built on top of these primitives,called“modes,”we can prove some things about their security;namely that they are as secure as the primitives which underlie them.Almost all of the AE schemes we will describe here are modes; only two of them are primitives.AE Schemes.The remainder of this article is devoted to the description and discussion of various AE algorithms.For convenience we list them in Figure1.Note that we omit generic composition from the table since this approach comprises a class of schemes rather than a particular scheme.Conventions.Let denote the empty string.LetΣn denote the set of all n-bit strings.In general,if S is a set we write S+to mean1or more repetitions of elements from S;that is,the set{s1s2···s m|m> 0,s i∈S,1≤i≤m}.Thus(Σn)+is the set of all binary strings whose lengths are a positive multiple of n.If we write S∗we mean zero or more repetitions of elements from S.In other words,S∗=S+∪{ }.We write A⊕B to mean the exclusive-or of strings A and B.Many of our schemes use a block cipher.Throughout,n will be understood to be the block-size of theunderlying block cipher and k will be the size of its key.For block cipher E,we will write E K(P)to indicate invocation of block cipher E using the k-bit key K on the n-bit plaintext block P.In order to process a message M∈(Σn)+we will often wish to break M into m strings,M1,···,M m, each having n-bits such that M=M1M2···M m.For brevity,we will say“write M=M1···M m”and understand it to mean the above.2Generic CompositionAlthough AE did not get a formal definition until recently,the goal has certainly been implicit for decades. The traditional way of achieving both authenticity and privacy was to simplyfind an algorithm which yields each one and then use the combination of these two algorithms on our message.Intuitively it seems that this approach is obvious,straightforward,and completely safe.Unfortunately,there are many pitfalls accidentally “discovered”by well-meaning protocol designers.One commonly-made mistake is the assumption that AE can be achieved by using a non-cryptographic non-keyed hash function h and a good encryption scheme like CBC mode(Cipher Block Chaining mode;see CBC mode encryption)with key K and initialization vector N.One produces CBC K,N(M,h(M))and hopes this yields a secure AE scheme.However,these schemes are virtually always broken.Perhaps the best-known example is the Wired Equivalent Privacy protocol(WEP)used with802.11wireless networks.This protocol instantiates h as a Cyclic Redundancy Code(CRC)and then uses a stream cipher to encrypt.Borisov, Goldberg,and Wagner showed,among other things,that it was easy to circumvent the authentication mechanism[15].Another common pitfall is“key reuse.”In other words,using some key K both for the encryption scheme and the MAC scheme.This approach appliedly blindly almost always fails.We will later see that all of our “combined modes,”listed after this section,do in fact use a single key,but they are carefully designed to retain security in spite of this.It is now clear to researchers that one needs to use a keyed hash(ie,a MAC)with some appropriate key K1along with a secure encryption scheme with an independent key K2.However,it is unclear in what order these modes should be applied to a message M in order to achieve authenticated encryption.There are three obvious choices:•MtE:MAC-then-Encrypt.Wefirst MAC M under key K1to yield tagσand then encrypt the resulting pair(M,σ)under key K2.•EtM:Encrypt-then-MAC.Wefirst encrypt M under key K2to yield ciphertext C and then compute σ←MAC K1(C)to yield the pair(C,σ).•E&M:Encrypt-and-MAC.Wefirst encrypt M under key K2to yield ciphertext C and then compute σ←MAC K1(M)to yield the pair(C,σ).Also note that decryption and verification are straightforward for each approach above:for MtE decrypt first,then verify.For EtM and E&M verifyfirst,then decrypt.Security.In2000,Bellare and Namprempre gave formal definitions for AE[5],and then systematically examined each of the three approaches described above in this formal setting.Their results show that if the MAC has a property called“strongly unforgeable,”then it possible to achieve the strongest definition of security for AE only via the EtM approach.They further show that some known-good encryption schemes fail to provide privacy in the AE setting when using the E&M approach,and fail to provide a slightly stronger notion of privacy with the MtE approach.These theoretical results generated a great deal of interest since three major pre-existing protocols, SSL/TLS,IPSec,and SSH,each used a different one of these three approaches:the SSL/TLS protocol uses MtE,IPSec uses EtM,and SSH uses E&M.One might think that perhaps securityflaws exist in SSL/TLS and SSH because of the results of Bellare and Namprempre,however concurrent with their work,Krawczyk showed that SSL/TLS was in fact secure because of the encoding used alongside the MtE mechanism[29]. And later Bellare,Kohno,and Namprempre showed that despite some identified security-flaws in SSH,it could be made provably-secure via a number of simply modifications despite its E&M approach.The message here is that EtM with a provably-secure encryption scheme and a provably-secure MAC each with independent keys is the best approach for achieving AE.Although MtE and E&M can be secure, security will often depend on subtle details of how the data are encoded and on the particular MAC and encryption schemes used.Performance.Simple methods for doing very fast encryption have been known for quite some time. For example,CBC mode encryption has very little overhead beyond the calls to the block cipher.Even more attractive is CTR mode(CounTeR mode;see counter mode),which similarly has little overhead and in addition is parallelizable.However,MACing quickly is not so simple.The CBC MAC(Cipher Block Chaining Message Authentication Code;see CBC MAC and variants)is quite simple and just as fast as CBC mode encryption,but there are well-known ways to go faster.The fastest software MAC in common use today is HMAC[1,20].HMAC uses a cryptographic hash function to process the message M and this is faster than processing M block-by-block with a block cipher.However even faster approaches have been invented using the Wegman-Carter construction[34].This approach involves using a non-cryptographic hash function to process M,and then uses a cryptographic function to process the hash output.The non-cryptographic hash is randomly selected from a carefully-designed family of hash functions,all with a common domain and range.The goal is to produce a family such that distinct messages are unlikely to hash to the same value when the hash function is randomly chosen from that family.This is the so-called “universal hash family”[16].The fastest known MACs are based on the Wegman-Carter approach.The speed champions are UMAC[11]and hash127[10],though neither of these are in common use yet. Associated Data.As we mentioned in the introduction,it is a common requirement in cryptographic protocols that we allow authenticated but non-encrypted data to be included in our message.Although the single-pass modes we describe next do not naturally allow for associated data,due to the fact that their encryption and authentication methods are intricately interwoven,we do not have this problem with generically-composed schemes.Since the encryption and MAC schemes are entirely independent,we simply run the MAC on all the data and run the encryption scheme only on the data to be kept private.Can we do better?One obvious question when considering generically-composed AE schemes is“can we do better?”In other words,might there be a way of achieving AE without using two different algorithms, with two different keys,and making two separate passes over the message.The answer is“yes,”and a discussion of these results comprise the remainder of this article.3Single-Pass Combined ModesIt had long been a goal of cryptographers tofind a mode of operation which achieved AE using only a single pass over the message M.Many attempts were made at such schemes,but all were broken.Therefore until the year2000,people still used generic composition to achieve AE,which as we have seen requires two passes over M.3.1IAPMIn2000,Jutla of IBM invented two schemes which were thefirst correct single-pass AE modes[25].He called these modes IACBC(Integrity-Aware Cipher Block Chaining)and IAPM(Integrity-Aware Parallelizable Mode).Thefirst mode somewhat resembles CBC-mode encryption,however offsets were added in before and after each block-cipher invocation,a technique known as“whitening.”However,as we know,CBC-mode encryption is inherently serial:we cannot begin computation for the k+1-st block-cipher invocation until we have the result of the k-th invocation.Therefore,more interest has been generated around the second mode,IAPM,which does not have this disadvantage.Let’s look at how IAPM works.IAPM accepts a message M∈(Σn)+,a nonce N∈Σn,and a key pair K1,K2each selected fromΣk for use with the underlying block cipher E.The key pair is set up and distributed in advance between the communicating parties;the keys are reused for a large number of messages.However,N and(usually)M vary with each transmission.First we break M into M1···M m−1and proceed as follows.There are two main steps:(1)offset-generation and (2)encryption/tag-generation.For offset generation we encipher N to get a seed value,and then encipher sequential seed values to get the remaining seed values.In other words,set W 1←E K 2(N )and then set W i ←E K 2(W 1+i −2)for 2≤i ≤t where t = lg(m +2) .Here lg means log 2,so if we had a message M with 256n -bit blocks,we would require lg(259) =9block-cipher invocations to generate the W i values.Finally,to derive our m +1offsets from the seed values,for i from 1to m +1,we compute S i −1← t j =1(i [j ]·W j )where i [j ]is the j -th bit of i .Armed with S 0through S m we are now ready to process M .First we encrypt each block of M by computing C i ←E K 1(M i ⊕S i )⊕S i for 1≤i ≤m −1.This xoring of S i before and after the block-cipher invocation is the whitening we spoke of previously,and is the main idea in all schemes discussed in this section.Next we compute the authentication tag σ:set σ←E K 1(S m ⊕ m −1i =1M i )⊕S 0.Notice that we are whitening the simple sum of the plaintext blocks with two different offset values,S 0and S m .Finally,output (N,C 1,···,C m −1,σ)as the authenticated ciphertext.Note that the output length is two n -bit blocks longer than M .This “ciphertext expansion,”comparable to what we saw with generic composition,is quite minimal.Given the K 1,K 2,and some output (N,C 1,···,C m −1,σ),it is fairly straightforward to recover M and check the authenticity of the transmission.Notice that N is sent in the clear and so using K 2we can compute the W i values and therefore the S i values.We compute M i ←E −1K 1(C i ⊕S i )⊕S i for 1≤i ≤m −1to recover M .Then we check E K 1(S m ⊕ m −1i =1M i )⊕S 0to ensure it matches σ.If we get a match,we accept the transmission as authentic,and if not we reject the transmission as an attempted forgery.Comments on pared to generic composition,where we needed about 2m block-cipher invo-cations per message (assuming our encryption and authentication modes were block-cipher-based),we are now using only around m lg(m )invocations.Further refinements to IAPM reduce this even more,so the number of block-cipher invocations is nearly m in these optimized versions meaning that one can achieve AE at nearly the same cost of encryption alone.Proving a scheme like IAPM secure is not a simple task,and indeed we cannot present such a proof here.The interested reader is encouraged to read Halevi’s article which contains a rigorous proof that if the underlying block cipher is secure,then so are IACBC and IAPM [21].3.2XCBC and OCBQuickly after announcement of IACBC and IAPM other researchers went to work on finding similar single-pass AE schemes.Soon two other parties announced similar schemes:Gligor and Donescu produced a host of schemes,each with various advantages and disadvantages [18],and Rogaway,Bellare,Black,and Krovetz announced their OCB scheme [33],which is similar to IAPM but with a long list of added optimizations.Gligor and Donescu presented two classes of schemes:XCBC and XECB.XCBC is similar to CBC mode encryption just as IACBC was above,and XECB is similar to ECB mode encryption which allows parallelism to be exploited,much like the IAPM method presented above.Since many practitioners desire parallelizable modes,the largest share of attention has been paid to XECB.Similar to IAPM,XECB uses an offset to each message block,applied before and after a block cipher invocation.However,XECB generates these offsets in a very efficient manner,using arithmetic mod 2n ,which is very fast on most commodity processors.Once again,both schemes are highly-optimized and provide AE at a cost very close to that of encryption alone.Proofs of security are included in the paper,using the reductionist approach we described above.Rogaway,Bellare,Black,and Krovetz produced a single scheme called OCB (Offset CodeBook).This work was a follow-on to Jutla’s IAPM scheme,designed to be fully-parallelizable,along with a long list of other improvements.In comparison to IAPM,OCB uses a single block-cipher key,provides a message space of Σ∗so we never have to pad,and is nearly endian-neutral.Once again,a full detailed proof of security is included in the paper,demonstrating that the security of OCB is directly related to the security of the underlying block cipher.OCB is no-doubt the most aggressively-optimized scheme of those discussed in this section.Perfor-mance tests indicate that OCB is about 6.4%slower than CBC mode encryption,and this is without exploiting the parallelism that OCB offers up.For more information,one can find an in-depth FAQ,all relevant publications,reference code,test vectors,and performance figures on the OCB web page at /~rogaway/ocb/.Associated Data.In many settings,the ability to handle associated data is crucial.Rogaway[32]suggests methods to handle associated data in all three of the single-pass schemes mentioned above,and for OCB gives an extension which uses PMAC[13]to give a particularly efficient variant of OCB which handles associated data.Intellectual Property.Given the importance of these new highly-efficient AE algorithms,all of the authors decided tofile for patents.Therefore,IBM,Gligor,and Rogaway all have intellectual property claims for their algorithms and perhaps on some of the overriding ideas involved.To date,none of these patents has been tested in court,so the extent to which they are conflicting or interrelated is unclear.One effect,however,is that many would-be users of this new technology are worried that the possible legal entanglements are not worth the benefits offered by this technology.Despite this,OCB has appeared in the802.11draft standard as an alternate mode,and has been licensed several times.However,without IP claims it is possible all of these algorithms would be in common use today.It was the complications engendered by the IP claims which spurred new teams of researchers tofind further efficient AE algorithms which would not be covered by patents.Although not as fast as the single-pass modes described here,they still offer significant performance improvements over generic composition schemes.These schemes include CCM,CWC,and EAX,the latter invented in part by two researchers from the OCB team.We discuss these schemes next.4Two-Pass Combined ModesIf we have highly-efficient single-pass AE modes,why would researchers subsequently work to develop less efficient multi-pass AE schemes?Well,as we just discussed,this work was entirely motivated by the desire to provide patent-free AE schemes.Thefirst such scheme proposed was CCM(CBC MAC with Counter Mode)by Ferguson,Housley and Whiting.Citing several drawbacks to CCM,Bellare,Rogaway,and Wagner proposed EAX,another patent-free mode which addresses these drawbacks.And independently,Kohno, Viega,and Whiting proposed the CWC mode(Carter-Wegman with Counter mode encryption).CWC is also patent-free and,unlike the previous two modes,is fully parallelizable.We now discuss each of these modes in turn.4.1CCM ModeCCM was designed with AES specifically in mind.It therefore is hard-coded to assume a128-bit block size, though it could be recast for other block sizes.Giving all the details of the mode would be cumbersome,so we will just present the overriding ideas.For complete details,see the CCM specification[35].CCM is parameterized.It requires that you specify a128-bit block-cipher(eg,AES),a tag length(which must be one of4,6,8,10,12,14,or16),and the message-lengthfield’s size(which induces an upperbound on the message length).Like all other schemes we mention,CCM uses a nonce N each time it is invoked, and the size of N depends on the the parameters chosen above;specifically,if we choose a longer maximum message-length,we must accept a shorter nonce.It is left to the user to decide which parameters to use,but typical values might be to limit the maximum message length to16MBytes and then use a96-bit nonce.Once the parameters are decided,we invoke CCM by providing four inputs:the key K which will be used with AES,the nonce N of the proper size,associated data H which will be authenticated but not encrypted,and the plaintext M which will be authenticated and M operates in two passes:first we encode the above parameters into an initial block,prepend this block to H and M,and then run CBC MAC over this entire byte-string using K.This yields the authentication tagσ.(The precise details of how the above concatenation is done are important for the security of CCM,but are omitted here.) Next we form a counter-value using one of the scheme’s parameters along with N and any necessary padding to reach128bits.This counter is then used with CTR mode encryption on(σ M)under K to produce the ciphertext.Thefirst128bits are the authentication tag,and we return the appropriate number of bytes according to the tag-length parameter.The subsequent bytes are the encryption of M and are always included in the output.Decryption and verification are quite straightforward:N produces the counter-value and allows the recovery of M.Re-running CBC MAC on the same input used above allows verification of the tag.Comments on CCM.It would seem that CCM is not much better than simple generic composition;after all,it uses a MAC scheme(the CBC MAC)and an encryption scheme(CTR mode encryption),which are both well-known and provably-secure modes.But CCM does offer advantages over the straightforward use of these two primitives generically composed;in particular it uses the same key K for both the MAC and the encryption steps.Normally this practice would be very dangerous and unlikely to work,but the designers were careful to ensure the security of CCM despite this normally-risky practice.The CCM specification does not include performance data or a proof of security.However,a rigorous proof was published by Jonsson [24].CCM is currently the mandatory mode for the802.11wireless standard as well as currently being considered by NIST as a FIPS standard.4.2EAX ModeSubsequent to the publication and subsequent popularity of CCM,three researchers decided to examine the shortcomings of CCM and see if they could be remedied.Their offering is called EAX[7]and addresses several perceived problems with CCM,including the following:1.If the associated datafield isfixed from message to message,CCM does not take advantage of this,but rather re-processes this data anew with each invocation.2.Message lengths must be known in advance because the length is encoded into thefirst block beforeprocessing begins.This is not a problem in some settings,but in many applications we do not know the message length in advance.3.The parameterization is awkward and,in particular,the trade-offbetween maximum message lengthand the size of the nonce seems unnatural.4.The definition of CCM(especially the encodings of the parameters and length information in themessage before it is processed)is complex and difficult to understand.Moreover,the correctness of CCM strongly depends on the details of this encoding.Like CCM,EAX is a combination of a type of CBC MAC and CTR mode encryption.However,unlike CCM,the MAC used is not raw CBC MAC,but rather a variant.Two well-known problems exist with CBC MAC:(1)all messages must be of the samefixed length,and(2)that length must be a positive multiple of n.If we violate thefirst property,security is lost.Several variants to the CBC MAC have been proposed to address these problems:EMAC[9,31]adds an extra block-cipher call to the end of CBC MAC to solve problem(1).Not to be confused with the AE mode of the same name above,XCBC[12]solves both problems(1)and(2)without any extra block-cipher invocations,but requires k+2n key bits.Finally, OMAC[23]improves XCBC so that only k bits of key are needed.The EAX designers chose to use OMAC with an extra input called a“tweak”which allows them to essentially get several different MACs by using distinct values for this tweak input.This is closely-related to an idea of Liskov,Rivest,and Wagner who introduced tweakable block ciphers[30].We now describe EAX at a high level.Unlike CCM,the only EAX parameters are the choice of block cipher,which may have any block size n,and the number of authentication tag bits to be output,τ.To invoke EAX,we pass in a nonce N∈Σn,a header H∈Σ∗which will be authenticated but not encrypted, and the message M∈Σ∗which will be authenticated and encrypted,andfinally the key K,appropriate for the chosen block cipher.We will be using OMAC under key K three times,each time with a different tweak,written OMAC0K,OMAC1K,and OMAC2K;it’s conceptually easiest to think of these three OMAC invocations as three separate MACs,although this is not strictly true.First,we compute ctr←OMAC0K(N) to obtain the counter value we will use with CTR mode encryption.Then we computeσH←OMAC1K(H) to get an authentication tag for H.Then we encrypt and authenticate M with C←OMAC2K(CTR ctrK(M)). Andfinally we output thefirstτbits ofσ=(ctr⊕C⊕σH)as the authentication tag.We also output the nonce N,the associated data H,and the ciphertext C.The decryption and verification steps are quite straightforward.Note that each of the problem areas cited above have been addressed by the EAX mode:no restriction on message length,no inter-dependence between the tag length and maximum message length,a performance savings when there is static header data,and no need for message length to be known up-front.Also,EAX。