1、Information technology Telecommunications and information exchange between systems NFC Security Part 3: NFC-SEC cryptography standard using ECDH-256 and AES-GCM Technologies de linformation Tlinformatique Scurit NFC Partie 3: Norme de cryptographie NFC-SEC utilisant ECDH-256 et AES-GCM INTERNATIONAL
2、 STANDARD ISO/IEC 13157-3 Reference number ISO/IEC 13157-3:2016(E) First edition 2016-04-01 ISO/IEC 2016 ii ISO/IEC 2016 All rights reserved COPYRIGHT PROTECTED DOCUMENT ISO/IEC 2016, Published in Switzerland All rights reserved. Unless otherwise specified, no part of this publication may be reprodu
3、ced or utilized otherwise in any form or by any means, electronic or mechanical, including photocopying, or posting on the internet or an intranet, without prior written permission. Permission can be requested from either ISO at the address below or ISOs member body in the country of the requester.
4、ISO copyright office Ch. de Blandonnet 8 CP 401 CH-1214 Vernier, Geneva, Switzerland Tel. +41 22 749 01 11 Fax +41 22 749 09 47 copyrightiso.org www.iso.org ISO/IEC 13157-3:2016(E)ISO/IEC 13157-3:2016(E) ISO/IEC 2016 All rights reserved iii Contents Page Foreword iv Introduction . v 1 Scope 1 2 Conf
5、ormance . 1 3 Normative references 1 4 Terms and definitions . 2 5 Conventions and notations 2 6 Acronyms . 2 7 General . 2 8 Protocol Identifier (PID) 2 9 Primitives . 2 9.1 Key agreement . 3 9.1.1 Curve P- 256 . 3 9.1.2 EC Key Pair Generation Primitive 3 9.1.3 EC Public key validation . 3 9.1.4 EC
6、DH secret value derivation Primitive 3 9.1.5 Random nonces . 3 9.2 Key Derivation Functions . 3 9.2.1 KDF for the SSE . 4 9.2.2 KDF for the SCH 4 9.3 Key Usage 4 9.4 Key Confirmation . 4 9.4.1 Key confirmation tag generation . 5 9.4.2 Key confirmation tag verification 5 9.5 Data Authenticated Encryp
7、tion 5 9.5.1 Starting Variable (StartVar) 5 9.5.2 Additional Authenticated Data (AAD) 5 9.5.3 Generation-Encryption 5 9.5.4 Decryption-Verification . 5 9.6 Data Integrity 6 9.7 Message Sequence Integrity 6 10 Data Conversions 6 11 SSE and SCH service invocation . 6 12 SCH data exchange . 6 12.1 Prep
8、aration . 6 12.2 Data Exchange . 7 12.2.1 Send 7 12.2.2 Receive . 7 Annex A (normative) Fields sizes 8 iv ISO/IEC 2016 All rights reserved ISO/IEC 13157-3:2016(E) Foreword ISO (the International Organization for Standardization) and IEC (the International Electrotechnical Commission) form the specia
9、lized system for worldwide standardization. National bodies that are members of ISO or IEC participate in the development of International Standards through technical committees established by the respective organization to deal with particular fields of technical activity. ISO and IEC technical com
10、mittees collaborate in fields of mutual interest. Other international organizations, governmental and non-governmental, in liaison with ISO and IEC, also take part in the work. In the field of information technology, ISO and IEC have established a joint technical committee, ISO/IEC JTC 1. The proced
11、ures used to develop this document and those intended for its further maintenance are described in the ISO/IEC Directives, Part 1. In particular the different approval criteria needed for the different types of document should be noted. This document was drafted in accordance with the editorial rule
12、s of the ISO/IEC Directives, Part 2 (see www.iso.org/ directives). Attention is drawn to the possibility that some of the elements of this document may be the subject of patent rights. ISO and IEC shall not be held responsible for identifying any or all such patent rights. Details of any patent righ
13、ts identified during the development of the document will be in the Introduction and/or on the ISO list of patent declarations received (see www.iso.org/patents). Any trade name used in this document is information given for the convenience of users and does not constitute an endorsement. For an exp
14、lanation on the meaning of ISO specific terms and expressions related to conformity assessment, as well as information about ISOs adherence to the WTO principles in the Technical Barriers to Trade (TBT), see the following URL: Foreword Supplementary information. ISO/IEC 13157-3 was prepared by Ecma
15、International (as ECMA-409) and was adopted, under a special “fast-track procedure”, by Joint Technical Committee ISO/IEC JTC 1, Information technology, in parallel with its approval by national bodies of ISO and IEC. ISO/IEC 13157 consists of the following parts, under the general title Information
16、 technology Telecommunications and information exchange between systems NFC Security: Part 1: NFC-SEC NFCIP-1 security services and protocol Part 2: NFC-SEC cryptography standard using ECDH and AES Part 3: NFC-SEC cryptography standard using ECDH-256 and AES-GCM Part 4: NFC-SEC entity authentication
17、 and key agreement using asymmetric cryptography Part 5: NFC-SEC entity authentication and key agreement using symmetric cryptography. ISO/IEC 13157-3:2016(E) ISO/IEC 2016 All rights reserved v Introduction The NFC Security series of standards comprise a common services and protocol Standard and NFC
18、- SEC cryptography standards. This NFC-SEC cryptography Standard specifies cryptographic mechanisms that use the Elliptic Curves Diffie-Hellman (ECDH-256) protocol for key agreement and the AES algorithm in GCM mode to provide data authenticated encryption. This International Standard addresses secu
19、re communication of two NFC devices that do not share any common secret data (“keys“) before they start communicating which each other. It is based on ISO/IEC 13157-2 (ECMA-386) with some adaptations to address actual cryptography standards. This International Standard refers to the latest standards
20、 and updates the generation method for StartVar in compliance with ISO/IEC 19772:2009/Cor.1:2014 which also complies with NIST SP 800-38B. INTERNATIONAL STANDARD ISO/IEC 13157-3:2016(E) ISO/IEC 2016 All rights reserved 1 Information technology Telecommunications and information exchange between syst
21、ems NFC Security Part 3: NFC-SEC cryptography standard using ECDH-256 and AES-GCM 1 Scope This International Standard specifies the message contents and the cryptographic methods for PID 02. This International Standard specifies cryptographic mechanisms that use the Elliptic Curves Diffie-Hellman (E
22、CDH) protocol with a key length of 256 bits for key agreement and the AES algorithm in GCM mode to provide data authenticated encryption. 2 Conformance Conformant implementations employ the security mechanisms specified in this NFC-SEC cryptography Standard (identified by PID 02) and conform to ISO/
23、IEC 13157-1 (ECMA-385). The NFC-SEC security services shall be established through the protocol specified in ISO/IEC 13157-1 (ECMA-385) and the mechanisms specified in this International Standard. 3 Normative references The following documents, in whole or in part, are normatively referenced in this
24、 document and are indispensable for its application. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies. ISO/IEC 9797-1:2011, Information technology - Security techniques - Message Authenticat
25、ion Codes (MACs) - Part 1: Mechanisms using a block cipher ISO/IEC 11770-3, Information technology - Security techniques - Key management - Part 3: Mechanisms using asymmetric techniques ISO/IEC 13157-1, Information technology - Telecommunications and information exchange between systems - NFC Secur
26、ity - Part 1: NFC-SEC NFCIP-1 security services and protocol (ECMA-385) ISO/IEC 13157-2, Information technology - Telecommunications and information exchange between systems - NFC Security - Part 2: NFC-SEC cryptography standard using ECDH and AES (ECMA-386) ISO/IEC 18031:2011, Information technolog
27、y - Security techniques - Random bit generation ISO/IEC 18031:2011/Cor.1:2014, Information technology - Security techniques - Random bit generation - Technical Corrigendum 1 ISO/IEC 18033-3:2010, Information technology - Security techniques - Encryption algorithms - Part 3: Block ciphers ISO/IEC 131
28、57-3:2016(E) 2 ISO/IEC 2016 All rights reservedISO/IEC 19772:2009, Information technology - Security techniques - Authenticated encryption ISO/IEC 19772:2009/Cor.1:2014, Information technology - Security techniques - Authenticated encryption - Technical Corrigendum 1 FIPS 186-4, Digital Signature St
29、andard (DSS) 4 Terms and definitions Clause 4 of ISO/IEC 13157-2 (ECMA-386) applies. 5 Conventions and notations Clause 5 of ISO/IEC 13157-2 (ECMA-386) applies. 6 Acronyms Clause 6 of ISO/IEC 13157-2 (ECMA-386) applies. Additionally, the following acronyms apply. AAD Additional Authenticated Data GC
30、M Galois Counter Mode CMAC Cipher-based MAC 7 General Clause 7 of ISO/IEC 13157-2 (ECMA-386) applies. 8 Protocol Identifier (PID) This International Standard shall use the one octet protocol identifier PID with value 2. 9 Primitives This Clause specifies cryptographic primitives. Clauses 11 and 12 s
31、pecify the actual use of these primitives. Table 1 summarizes the features. ISO/IEC 13157-3:2016(E) ISO/IEC 2016 All rights reserved 3Table 1 Summary of features Supported services SSE (see ISO/IEC 13157-1 (ECMA-385) SCH (see ISO/IEC 13157-1 (ECMA-385) Key agreement ECDH P-256 KDF AES-CMAC-PRF-128 K
32、ey confirmation AES-CMAC-96 Data authenticated encryption AES128-GCM Sequence integrity SN (see ISO/IEC 13157-1 (ECMA-385) Encryption order Authenticated encryption (MAC then encrypt) 9.1 Key agreement Clause 9.1 of ISO/IEC 13157-2 (ECMA-386) applies. 9.1.1 Curve P- 256 Curve P-256 as specified in D
33、.1.2.3 Curve P-256 of FIPS 186-4 shall be used. 9.1.2 EC Key Pair Generation Primitive Clause 9.1.2 of ISO/IEC 13157-2 (ECMA-386) applies. 9.1.3 EC Public key validation Clause 9.1.3 of ISO/IEC 13157-2 (ECMA-386) applies. 9.1.4 ECDH secret value derivation Primitive Clause 9.1.4 of ISO/IEC 13157-2 (
34、ECMA-386) applies. 9.1.5 Random nonces Each peer NFC-SEC entity shall send fresh random nonces with the EC public key of the entity. The entity shall guarantee that the nonces it generates have 128 bits of entropy valid for the duration of the protocol. The nonces used in an NFC-SEC transaction shal
35、l be cryptographically uncorrelated with the nonces from a previous transaction, see also ISO/IEC 18031. 9.2 Key Derivation Functions Two Key Derivation Functions (KDF) are specified; one for the SSE and one for the SCH. The PRF shall be AES in CMAC mode as specified in MAC algorithm 5 of ISO/IEC 97
36、97-1, used with 128 bits output length, denoted AES-CMAC-PRF-128. For the following sections PRF is: PRF (K, S) = AES-CMAC-PRF-128K (S) ISO/IEC 13157-3:2016(E) 4 ISO/IEC 2016 All rights reservedThe random source (nonces and the SharedSecret z obtained from 9.1.4) used for the SCH shall be different
37、from the random source used for the SSE. 9.2.1 KDF for the SSE The KDF for the SSE is: MK SSE= KDF-SSE (Nonce S , Nonce R , ID S , ID R , SharedSecret) Detail of the KDF-SSE function: Seed = (Nonce S164 | Nonce R164) SKEYSEED = PRF (Seed, SharedSecret) MK SSE= PRF (SKEYSEED, Seed | ID S| ID R| (01)
38、9.2.2 KDF for the SCH The KDF for the SCH is: MK SCH , K SCH = KDF-SCH (Nonce S , Nonce R , ID S , ID R , SharedSecret) Detail of the KDF-SCH function: Seed = (Nonce S164 |Nonce R164) SKEYSEED = PRF (Seed, SharedSecret) MK SCH= PRF (SKEYSEED, Seed | ID S| ID R| (01) K SCH= PRF (SKEYSEED, MK SCH| See
39、d | ID S| ID R| (02) 9.3 Key Usage Each derived key MK SCH , K SCHand MK SSEshall be used only for the purpose specified in Table 2. The Keys MK SCH , K SCH , and MK SSEshall be different for each NFC-SEC transaction. Table 2 Key usage Key Key description Key usage MK SCHMaster Key for SCH Key Verif
40、ication for the Secure Channel Keys K SCHAuthenticated Encryption Key for SCH Authenticated Encryption of data packets sent through SCH MK SSEMaster Key for SSE Master Key for SSE used as Shared secret to be passed to the upper layer and as Key Verification 9.4 Key Confirmation When a key is derived
41、 using one of the KDF processes specified in 9.2 both NFC-SEC entities check that they indeed have the same key. Each entity shall generate a key confirmation tag as specified in 9.4.1 and shall send it to the peer entity. Entities shall verify the key confirmation tag upon reception as specified in
42、 9.4.2. ISO/IEC 13157-3:2016(E) ISO/IEC 2016 All rights reserved 5This key confirmation mechanism is according to 9, Key Confirmation, of ISO/IEC 11770-3. 9.4.1 Key confirmation tag generation MacTag, the Key confirmation tag, equals MAC-KC (K, MsgID, IDS, IDR, PKS, PKR) and shall be calculated usin
43、g AES-CMAC-96 K(MsgID | ID S| ID R| PK S| PK R ), specified in MAC algorithm 5 of ISO/IEC 9797-1 with 96-bit truncated output in msb-first order, with key K. The MsgID field is specified at each invocation of MAC-KC. 9.4.2 Key confirmation tag verification Clause 9.4.2 of ISO/IEC 13157-2 (ECMA-386)
44、applies. 9.5 Data Authenticated Encryption The underlying block cipher used is AES as specified in 5.1 AES of ISO/IEC 18033-3 with a block size of 128 bits. The data authenticated encryption mode shall be GCM mode as specified in 11 Authenticated encryption mechanism 6 (GCM) of ISO/IEC 19772. 9.5.1
45、Starting Variable (StartVar) To ensure that Starting Variable StartVar is distinct for every message to be protected, it shall be generated by both entities from the nonces in the following way: StartVal shall be generated using bit 17112 of AES-CMAC-PRF-128 MK(MK, K SCH | NA | NB | (03), with the k
46、ey MK. 9.5.2 Additional Authenticated Data (AAD) This data is only authenticated, but not encrypted. AAD = SEP | PID | S3 | S2 | S1 The 3-octect value of SNV equals S3 | S2 | S1 where S1 is the LSB and S3 is the MSB. For the NFC-SEC-PDUs where PID is prohibited (see Table 2 NFC-SEC-PDU Fields of ISO
47、/IEC 13157-1 (ECMA-385), PID is replaced by one byte (00). 9.5.3 Generation-Encryption The data shall be authenticated and encrypted using the Secure Channel Key K SCHas specified in 11.6 Encryption procedure of ISO/IEC 19772 with t = 96: AuthEncData = GEN-ENC KSCH (AAD, StartVar, Data) 9.5.4 Decryp
48、tion-Verification The authenticated and encrypted data shall be decrypted and verified using the Secure Channel Key K SCHas specified in 11.7 Decryption procedure of ISO/IEC 19772 with t = 96: DEC-VER KSCH (AAD, StartVar, AuthEncData) shall return Data if valid INVALID otherwise ISO/IEC 13157-3:2016
49、(E) 6 ISO/IEC 2016 All rights reserved9.6 Data Integrity The requirements in 9.5.3 and 9.5.4 provide data integrity. 9.7 Message Sequence Integrity Clause 9.7 of ISO/IEC 13157-2 (ECMA-386) applies. 10 Data Conversions Clause 10 of ISO/IEC 13157-2 (ECMA-386) applies. 11 SSE and SCH service invocation Clause 11 of ISO/IEC 13157-2 (ECMA-386) applies. 12 SCH data exchange After invocation of the