draft special publication 800-73-4, interfaces for personal ...2015/05/29  · 210 the piv data...

22
Revised Draft NIST Special Publication 800-73-4 1 2 3 4 Interfaces for Personal Identity 5 Verification – Part 3: PIV Client 6 Application Programming Interface 7 8 9 Ramaswamy Chandramouli 10 David Cooper 11 Hildegard Ferraiolo 12 Salvatore Francomacaro 13 Ketan Mehta 14 Jason Mohler 15 16 17 18 19 20 21 22 23 24 25 26 27 C O M P U T E R S E C U R I T Y

Upload: others

Post on 08-Nov-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Draft Special Publication 800-73-4, Interfaces for Personal ...2015/05/29  · 210 the PIV data elements’ identifiers, structure, and format. SP 800-73-4 also describes the client

Revised Draft NIST Special Publication 800-73-4 1

2

3 4

Interfaces for Personal Identity 5

Verification – Part 3: PIV Client 6

Application Programming Interface 7

8

9 Ramaswamy Chandramouli 10

David Cooper 11 Hildegard Ferraiolo 12

Salvatore Francomacaro 13 Ketan Mehta 14 Jason Mohler 15

16 17 18 19 20 21 22

23

24

25

26

27

C O M P U T E R S E C U R I T Y

Page 2: Draft Special Publication 800-73-4, Interfaces for Personal ...2015/05/29  · 210 the PIV data elements’ identifiers, structure, and format. SP 800-73-4 also describes the client

Revised Draft NIST Special Publication 800-73-4 28

29

30

Interfaces for Personal Identity 31

Verification – Part 3: PIV Client 32

Application Programming Interface 33

34 Ramaswamy Chandramouli 35

David Cooper 36 Hildegard Ferraiolo 37

Salvatore Francomacaro 38 Ketan Mehta 39

Computer Security Division 40 Information Technology Laboratory 41

42 43 44

Jason Mohler 45 Electrosoft Services, Inc. 46

47 48 49 50 51

May 2014 52 53 54 55 56 57 58 59 60

61 62 63

U.S. Department of Commerce 64 Penny Pritzker, Secretary 65

66 National Institute of Standards and Technology 67

Patrick D. Gallagher, Under Secretary of Commerce for Standards and Technology and Director 68

Page 3: Draft Special Publication 800-73-4, Interfaces for Personal ...2015/05/29  · 210 the PIV data elements’ identifiers, structure, and format. SP 800-73-4 also describes the client

Draft Special Publication 800-73-4 Interfaces for Personal Identity Verification Part 3: PIV Client Application Programming Interface

ii

Authority 69

This publication has been developed by NIST to further its statutory responsibilities under the Federal 70 Information Security Management Act (FISMA), Public Law (P.L.) 107-347. NIST is responsible for 71 developing information security standards and guidelines, including minimum requirements for Federal 72 information systems, but such standards and guidelines shall not apply to national security systems 73 without the express approval of appropriate Federal officials exercising policy authority over such 74 systems. This guideline is consistent with the requirements of the Office of Management and Budget 75 (OMB) Circular A-130, Section 8b(3), Securing Agency Information Systems, as analyzed in Circular A-76 130, Appendix IV: Analysis of Key Sections. Supplemental information is provided in Circular A-130, 77 Appendix III, Security of Federal Automated Information Resources. 78

Nothing in this publication should be taken to contradict the standards and guidelines made mandatory 79 and binding on Federal agencies by the Secretary of Commerce under statutory authority. Nor should 80 these guidelines be interpreted as altering or superseding the existing authorities of the Secretary of 81 Commerce, Director of the OMB, or any other Federal official. This publication may be used by 82 nongovernmental organizations on a voluntary basis and is not subject to copyright in the United States. 83 Attribution would, however, be appreciated by NIST. 84

National Institute of Standards and Technology Special Publication 800-73-4 85 Natl. Inst. Stand. Technol. Spec. Publ. 800-73-4, 22 pages (May 2014) 86

http://dx.doi.org/10.6028/NIST.SP.XXX 87 CODEN: NSPUE2 88

89 90 91 92 93 94

95 96

97

98

99

100

101 Public comment period: May 16, 2014 through June 16, 2014 102

National Institute of Standards and Technology 103 Attn: Computer Security Division, Information Technology Laboratory 104

100 Bureau Drive (Mail Stop 8930) Gaithersburg, MD 20899-8930 105 Email: [email protected] 106

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 NIST, nor is it intended to imply that the entities, materials, or equipment are necessarily the best available for the purpose.

There may be references in this publication to other publications currently under development by NIST in accordance with its assigned statutory responsibilities. The information in this publication, including concepts and methodologies, may be used by Federal agencies even before the completion of such companion publications. Thus, until each publication is completed, current requirements, guidelines, and procedures, where they exist, remain operative. For planning and transition purposes, Federal agencies may wish to closely follow the development of these new publications by NIST.

Organizations are encouraged to review all draft publications during public comment periods and provide feedback to NIST. All NIST Computer Security Division publications, other than the ones noted above, are available at http://csrc.nist.gov/publications.

Page 4: Draft Special Publication 800-73-4, Interfaces for Personal ...2015/05/29  · 210 the PIV data elements’ identifiers, structure, and format. SP 800-73-4 also describes the client

Draft Special Publication 800-73-4 Interfaces for Personal Identity Verification Part 3: PIV Client Application Programming Interface

iii

107 108 109

Reports on Computer Systems Technology 110

The Information Technology Laboratory (ITL) at the National Institute of Standards and Technology 111 (NIST) promotes the U.S. economy and public welfare by providing technical leadership for the Nation’s 112 measurement and standards infrastructure. ITL develops tests, test methods, reference data, proof of 113 concept implementations, and technical analyses to advance the development and productive use of 114 information technology. ITL’s responsibilities include the development of management, administrative, 115 technical, and physical standards and guidelines for the cost-effective security and privacy of other than 116 national security-related information in Federal information systems. The Special Publication 800-series 117 reports on ITL’s research, guidelines, and outreach efforts in information system security, and its 118 collaborative activities with industry, government, and academic organizations. 119

120 Abstract 121

122 FIPS 201 defines the requirements and characteristics of a government-wide interoperable identity 123 credential. FIPS 201 also specifies that this identity credential must be stored on a smart card. This 124 document, SP 800-73, contains the technical specifications to interface with the smart card to retrieve and 125 use the PIV identity credentials. The specifications reflect the design goals of interoperability and PIV 126 Card functions. The goals are addressed by specifying a PIV data model, card edge interface, and 127 application programming interface. Moreover, this document enumerates requirements where the 128 international integrated circuit card standards [ISO7816] include options and branches. The 129 specifications go further by constraining implementers’ interpretations of the normative standards. Such 130 restrictions are designed to ease implementation, facilitate interoperability, and ensure performance, in a 131 manner tailored for PIV applications. 132

133 134

Keywords 135 136

authentication; FIPS 201; identity credential; logical access control; on-card biometric comparison; 137 Personal Identity Verification (PIV); physical access control; smart cards; secure messaging 138

139 140

Acknowledgements 141 142

The authors (Ramaswamy Chandramouli, David Cooper, Hildegard Ferraiolo, Salvatore Francomacaro, 143 and Ketan Mehta of NIST, and Jason Mohler of Electrosoft Services, Inc.) wish to thank their colleagues 144 who reviewed drafts of this document and contributed to its development. 145

146

Page 5: Draft Special Publication 800-73-4, Interfaces for Personal ...2015/05/29  · 210 the PIV data elements’ identifiers, structure, and format. SP 800-73-4 also describes the client

Draft Special Publication 800-73-4 Interfaces for Personal Identity Verification Part 3: PIV Client Application Programming Interface

iv

Table of Contents 147

1. INTRODUCTION ............................................................................................................................................... 1 148 1.1 PURPOSE .......................................................................................................................................................... 1 149 1.2 SCOPE............................................................................................................................................................... 1 150 1.3 AUDIENCE AND ASSUMPTIONS ......................................................................................................................... 1 151 1.4 CONTENT AND ORGANIZATION ........................................................................................................................ 2 152

2. OVERVIEW: CONCEPTS AND CONSTRUCTS ........................................................................................... 3 153 3. CLIENT APPLICATION PROGRAMMING INTERFACE .......................................................................... 4 154

3.1 ENTRY POINTS FOR COMMUNICATION ............................................................................................................. 5 155 3.1.1 pivMiddlewareVersion ............................................................................................................................. 5 156 3.1.2 pivConnect ............................................................................................................................................... 5 157 3.1.3 pivDisconnect ........................................................................................................................................... 7 158

3.2 ENTRY POINTS FOR DATA ACCESS ................................................................................................................... 7 159 3.2.1 pivSelectCardApplication......................................................................................................................... 7 160 3.2.2 pivEstablishSecureMessaging .................................................................................................................. 8 161 3.2.3 pivLogIntoCardApplication ..................................................................................................................... 8 162 3.2.4 pivGetData ............................................................................................................................................... 9 163 3.2.5 pivLogoutOfCardApplication ................................................................................................................. 10 164

3.3 ENTRY POINTS FOR CRYPTOGRAPHIC OPERATIONS........................................................................................ 10 165 3.3.1 pivCrypt .................................................................................................................................................. 10 166

3.4 ENTRY POINTS FOR CREDENTIAL INITIALIZATION AND ADMINISTRATION ..................................................... 11 167 3.4.1 pivPutData ............................................................................................................................................. 11 168 3.4.2 pivGenerateKeyPair ............................................................................................................................... 12 169

170 171

List of Appendices 172

APPENDIX A— TERMS, ACRONYMS, AND NOTATION ............................................................................... 14 173 A.1 TERMS ........................................................................................................................................................... 14 174 A.2 ACRONYMS ................................................................................................................................................... 15 175 A.3 NOTATION ..................................................................................................................................................... 16 176

APPENDIX B— REFERENCES ............................................................................................................................. 17 177

178 179

List of Tables 180

Table 1. Entry Points on PIV Client Application Programming Interface .................................................................... 4 181 Table 2. Data Objects in a Connection Description Template (Tag 0x7F21) ............................................................... 6 182 Table 3. Data Objects in an Authenticator Template (Tag '67') .................................................................................... 9 183

184

Page 6: Draft Special Publication 800-73-4, Interfaces for Personal ...2015/05/29  · 210 the PIV data elements’ identifiers, structure, and format. SP 800-73-4 also describes the client

Draft Special Publication 800-73-4 Interfaces for Personal Identity Verification Part 3: PIV Client Application Programming Interface

1

1. Introduction 185

Homeland Security Presidential Directive-12 (HSPD-12) called for a common identification standard to 186 be adopted governing the interoperable use of identity credentials to allow physical and logical access to 187 Federally controlled facilities and information systems. Personal Identity Verification (PIV) of Federal 188 Employees and Contractors, Federal Information Processing Standard 201 (FIPS 201) [FIPS201] was 189 developed to establish standards for identity credentials. Special Publication 800-73-4 (SP 800-73-4) 190 contains technical specifications to interface with the smart card (PIV Card1) to retrieve and use the 191 identity credentials. 192

1.1 Purpose 193

FIPS 201 defines procedures for the PIV lifecycle activities including identity proofing, registration, PIV 194 Card issuance, and PIV Card usage. FIPS 201 also specifies that the identity credentials must be stored 195 on a smart card. SP 800-73-4 contains the technical specifications to interface with the smart card to 196 retrieve and use the identity credentials. The specifications reflect the design goals of interoperability and 197 PIV Card functions. The goals are addressed by specifying a PIV data model, card edge interface, and 198 application programming interface (API). Moreover, SP 800-73-4 enumerates requirements where the 199 international integrated circuit card (ICC) standards [ISO7816] include options and branches. The 200 specifications go further by constraining implementers’ interpretations of the normative standards. Such 201 restrictions are designed to ease implementation, facilitate interoperability, and ensure performance in a 202 manner tailored for PIV applications. 203

1.2 Scope 204

SP 800-73-4 specifies the PIV data model, application programming interface (API), and card interface 205 requirements necessary to comply with the use cases, as defined in Section 6 of FIPS 201 and further 206 described in Appendix B of SP 800-73-4 Part 1. Interoperability is defined as the use of PIV identity 207 credentials such that client-application programs, compliant card applications, and compliant ICCs can be 208 used interchangeably by all information processing systems across Federal agencies. SP 800-73-4 defines 209 the PIV data elements’ identifiers, structure, and format. SP 800-73-4 also describes the client API and 210 card command interface for use with the PIV Card. 211

This part, SP 800-73-4 Part 3: PIV Client Application Programming Interface, contains technical 212 specifications of the PIV client application programming interface to the PIV Card. 213

1.3 Audience and Assumptions 214

This document is targeted at Federal agencies and implementers of PIV systems. Readers are assumed to 215 have a working knowledge of smart card standards and applications. 216

Readers should also be aware of SP 800-73-4 Part 1, Section I, which details the revision history of 217 SP800-73, Section II, which contains configuration management recommendations, and Section III, 218 which specifies NPIVP conformance testing procedures. 219

1 A physical artifact (e.g., identity card, “smart” card) issued to an individual that contains a PIV Card Application which stores identity credentials (e.g., photograph, cryptographic keys, digitized fingerprint representation) so that the claimed identity of the cardholder can be verified against the stored credentials by another person (human readable and verifiable) or an automated process (computer readable and verifiable).

Page 7: Draft Special Publication 800-73-4, Interfaces for Personal ...2015/05/29  · 210 the PIV data elements’ identifiers, structure, and format. SP 800-73-4 also describes the client

Draft Special Publication 800-73-4 Interfaces for Personal Identity Verification Part 3: PIV Client Application Programming Interface

2

1.4 Content and Organization 220

All sections in this document are normative (i.e., mandatory for compliance) unless specified as 221 informative (i.e., non-mandatory). Following is the structure of Part 3: 222

+ Section 1, Introduction, provides the purpose, scope, audience and assumptions of the document 223 and outlines its structure. 224

+ Section 2, Overview: Concepts and Constructs, describes both the PIV Card Application and the 225 PIV client API. This section is informative. 226

+ Section 3, Client Application Programming Interface, describes the set of entry points accessible 227 by client applications through the PIV Middleware to interact with the PIV Card. 228

+ Appendix A, Terms, Acronyms, and Notation, contains the list of terms and acronyms used in this 229 document and explains the notation in use. This section is informative. 230

+ Appendix B, References, contains the list of documents used as references by this document. 231 This section is informative. 232

Page 8: Draft Special Publication 800-73-4, Interfaces for Personal ...2015/05/29  · 210 the PIV data elements’ identifiers, structure, and format. SP 800-73-4 also describes the client

Revised Draft Special Publication 800-73-4 Interfaces for Personal Identity Verification Part 3: PIV Client Application Programming Interface

3

2. Overview: Concepts and Constructs 233

SP 800-73-4 Parts 2 and 3 define two interfaces to an ICC that contains the PIV Card Application: a low-234 level card command interface (Part 2) and a high-level client API (Part 3). 235

The information processing concepts and data constructs on both interfaces are identical and may be 236 referred to generically as the information processing concepts and data constructs on the PIV interfaces 237 without specific reference to the client API or the card command interface. 238

The client API provides task-specific programmatic access to these concepts and constructs and the card 239 command interface provides communication access to concepts and constructs. The client API is used by 240 client applications using the PIV Card Application. The card command interface is used by software 241 implementing the client API (middleware). 242

The client API is thought of as being at a higher level than the card command interface because access to 243 a single entry point on the client API may cause multiple card commands to traverse the card command 244 interface. In other words, it may require more than one card command on the card command interface to 245 accomplish the task represented by a single call on an entry point of the client API. 246

The client API is a program execution, call/return style interface, whereas the card command interface is a 247 communication protocol, command/response style interface. Because of this difference, the 248 representation of the PIV concepts and constructs as bits and bytes on the client API may be different 249 from the representation of these same concepts and constructs on the card command interface. 250

251

Page 9: Draft Special Publication 800-73-4, Interfaces for Personal ...2015/05/29  · 210 the PIV data elements’ identifiers, structure, and format. SP 800-73-4 also describes the client

Draft Special Publication 800-73-4 Interfaces for Personal Identity Verification Part 3: PIV Client Application Programming Interface

4

252

3. Client Application Programming Interface 253

Table 1 lists the entry points on the PIV client API. This section references object identifiers (OIDs), 254 which are defined and can be found in Part 1 (Table 3). 255

Table 1. Entry Points on PIV Client Application Programming Interface 256

Type Name

Entry Points for Communication

pivMiddlewareVersion

pivConnect

pivDisconnect

Entry Points for Data Access

pivSelectCardApplication

pivEstablishSecureMessaging

pivLogIntoCardApplication

pivGetData

pivLogoutOfCardApplication

Entry Points for Cryptographic

Operations pivCrypt

Entry Points for Credential

Initialization and Administration

pivPutData

pivGenerateKeyPair

257 If both the PIV Middleware and the PIV Card support secure messaging then all non-card-management 258 functionality2 of the PIV Card may be accessed over either the contact or contactless interface of the card. 259 In order to perform non-card-management functionality that would otherwise be limited to the contact 260 interface, the client application must first establish a virtual contact interface by calling the 261 pivEstablishSecureMessaging function and then using the pivLogIntoCardApplication function to submit 262 the pairing code to the card. If the client application does not have another means of determining whether 263 communication with the PIV Card is over a contact or contactless interface, it may determine this by 264 using the pivGetData function to attempt to read a mandatory data object, such as the X.509 Certificate 265 for PIV Authentication or the Security Object, that has an access rule for read of “Always,” but that is 266 only accessible over the contact and virtual contact interfaces (see Part 1, Table 2). If the return code 267 from pivGetData is PIV_SECURITY_CONDITIONS_NOT_SATISFIED this indicates that communication 268 with the card is over a contactless interface. 269 2 Only the pivPutData and pivGenerateKeyPair API functions perform card-management functionality.

Page 10: Draft Special Publication 800-73-4, Interfaces for Personal ...2015/05/29  · 210 the PIV data elements’ identifiers, structure, and format. SP 800-73-4 also describes the client

Draft Special Publication 800-73-4 Interfaces for Personal Identity Verification Part 3: PIV Client Application Programming Interface

5

3.1 Entry Points for Communication 270

3.1.1 pivMiddlewareVersion 271

Purpose: Returns the PIV Middleware version string 272

Prototype: status_word pivMiddlewareVersion( 273 OUT version versionString 274

); 275

Parameter: versionString 276

+ For SP 800-73-4 Part 3 conformant PIV Middleware, the parameter returns 277 “800-73-4 Client API” or “800-73-4 Client API with SM”. 278

+ For SP 800-73-3 Part 3 conformant PIV Middleware, the parameter returns 279 “800-73-3 Client API”. 280

+ For SP 800-73-2 Part 3 conformant PIV Middleware, the parameter returns 281 “800-73-2 Client API”. 282

+ For SP 800-73-1 conformant PIV Middleware, the pivMiddlewareVersion client 283 API function is not supported. Therefore, a client application invoking the 284 pivMiddlewareVersion function should expect a “function-not-supported” error 285 from a SP 800-73-1 conformant PIV Middleware. For purposes of version 286 determination, failure to obtain a specific version from pivMiddlewareVersion 287 shall be considered equivalent to obtaining a response of “800-73-1 Client API”. 288

Return Codes: PIV_OK 289

PIV Middleware that returns a versionString of “800-73-4 Client API with SM” shall implement all PIV 290 Middleware functions listed in Table 1 and be able to recognize and process all mandatory and optional 291 PIV data objects. PIV Middleware that returns a versionString of “800-73-4 Client API” shall implement 292 all PIV Middleware functions listed in Table 1 except pivEstablishSecureMessaging and shall be able to 293 recognize and process all mandatory and optional PIV data objects. 294

Note: Only SP 800-73-4 based PIV Middleware supports the use of on-card biometric comparison (OCC) 295 data and the pairing code with the pivLogIntoCardApplication function, and only PIV Middleware that 296 returns a versionString of “800-73-4 Client API with SM” supports the use of secure messaging (SM) and 297 the virtual contact interface, which have been introduced in Parts 1 and 2 of SP 800-73-4. SP 800-73-1, 298 SP 800-73-2, and SP 800-73-3 based PIV Middleware remain valid implementations; however, agencies 299 are cautioned that using these implementations may result in limited interoperability. Further information 300 can be found in Part 1 of SP 800-73-4. It provides an SP 800-73 revision history (Section I) and 301 recommendations for PIV Middleware configuration management (Section II). 302

3.1.2 pivConnect 303

Purpose: Connects the client API to the PIV Card Application on a specific ICC. 304

Prototype: status_word pivConnect( 305 IN Boolean sharedConnection, 306 INOUT sequence of bytes connectionDescription, 307 INOUT LONG CDLength, 308 OUT handle cardHandle 309

); 310

Page 11: Draft Special Publication 800-73-4, Interfaces for Personal ...2015/05/29  · 210 the PIV data elements’ identifiers, structure, and format. SP 800-73-4 also describes the client

Draft Special Publication 800-73-4 Interfaces for Personal Identity Verification Part 3: PIV Client Application Programming Interface

6

Parameters: sharedConnection If TRUE other client applications can establish 311 concurrent connections to the ICC. If FALSE and the 312 connection is established then the calling client 313 application has exclusive access to the ICC. 314

connectionDescription A connection description data object (tag 0x7F21). 315 See Table 2. 316

If the length of the value field of the '8x' data object in 317 the connection description data object is zero then a 318 list of the card readers of the type indicated by the tag 319 of the '8x' series data object and available at the '9x' 320 location is returned in the connectionDescription. 321

In order to provide sufficient space for the return 322 value, the client application shall allocate a buffer of at 323 least 2048 bytes for connectionDescription. 324

The connection description BER-TLV [ISO8825] used 325 on the PIV client API shall have the structure 326 described in Table 2. 327

Table 2. Data Objects in a Connection Description Template (Tag 0x7F21) 328

Description Tag Comment Interface device – PC/SC '81' Card reader name

Interface device – SCP '82' Card reader identifier on terminal equipment

Interface device – EMR '83' Contactless connection using radio transmission

Interface device – IR '84' Contactless connection using infrared transmission

Interface device – PKCS#11 '85' PKCS#11 interface

Interface device – CryptoAPI '86' CryptoAPI interface

Network node – Local '90' No network between client application host and card reader host

Network node – IP '91' IP address of card reader host

Network node – DNS '92' Internet domain name of card reader host

Network node – ISDN '93' ISDN dialing number string of terminal equipment containing the card reader

329 At most one selection from the '8x' series and one selection from the '9x' series shall appear in the 330 connection description template. 331

For example, '7F 21 0C 82 04 41 63 6D 65 91 04 C0 00 02 17' describes a connection to a generic card 332 reader at Internet address 192.0.2.23. As another example, '7F 21 0B 82 01 00 93 06 16 17 55 50 12 3F' 333 describes a connection to the subscriber identity module in the mobile phone at +1 617 555 0123. 334

When used as an argument to the pivConnect entry point on the PIV client API described in this section, 335 an '8x' series data object with zero length together with a '9x' series data object requests the return of all 336

Page 12: Draft Special Publication 800-73-4, Interfaces for Personal ...2015/05/29  · 210 the PIV data elements’ identifiers, structure, and format. SP 800-73-4 also describes the client

Draft Special Publication 800-73-4 Interfaces for Personal Identity Verification Part 3: PIV Client Application Programming Interface

7

available card readers of the described type on the described node. Thus, '7F 21 04 81 00 90 00' would 337 request a list of all available PC/SC card readers on the host on which the client application was running. 338

CDLength Length of the card description parameter. 339

cardHandle The returned opaque identifier of a communication 340 channel to a particular ICC and hence of the card itself. 341 cardHandle is used in all other entry points on the PIV 342 client API to identify to which card the functionality of 343 the entry point is to be applied. 344

Return Codes: PIV_OK 345 PIV_CONNECTION_DESCRIPTION_MALFORMED 346 PIV_CONNECTION_FAILURE 347 PIV_CONNECTION_LOCKED 348

3.1.3 pivDisconnect 349

Purpose: Disconnect the PIV API from the PIV Card Application and the ICC containing the 350 PIV Card Application. 351

Prototype: status_word pivDisconnect( 352 IN handle cardHandle 353

); 354

Parameters: cardHandle Opaque identifier of the card to be acted upon as 355 returned by pivConnect. The value of cardHandle is 356 undefined upon return from pivDisconnect. 357

Return Codes: PIV_OK 358 PIV_INVALID_CARD_HANDLE 359 PIV_CARD_READER_ERROR 360

If secure messaging has been established then the PIV Middleware shall zeroize the secure messaging 361 session keys. 362

3.2 Entry Points for Data Access 363

3.2.1 pivSelectCardApplication 364

Purpose: Set the PIV Card Application as the currently selected card application and establish 365 the PIV Card Application’s security state. 366

Prototype: status_word pivSelectCardApplication( 367 IN handle cardHandle, 368 IN sequence of byte applicationAID, 369 IN LONG aidLength, 370 OUT sequence of byte applicationProperties, 371 INOUT LONG APLength 372

); 373

Parameters: cardHandle Opaque identifier of the card to be acted upon as 374 returned by pivConnect. 375

Page 13: Draft Special Publication 800-73-4, Interfaces for Personal ...2015/05/29  · 210 the PIV data elements’ identifiers, structure, and format. SP 800-73-4 also describes the client

Draft Special Publication 800-73-4 Interfaces for Personal Identity Verification Part 3: PIV Client Application Programming Interface

8

aidLength Length of the PIV Card Application AID. 376

applicationAID The AID of the PIV Card Application that is to 377 become the currently selected card application. 378

applicationProperties The application properties of the selected PIV 379 Card Application. See Part 2, Table 3. 380

APLength As an input, length of the buffer allocated for 381 applicationProperties. As an output, length of 382 the application properties. 383

Return Codes: PIV_OK 384 PIV_INVALID_CARD_HANDLE 385 PIV_CARD_APPLICATION_NOT_FOUND 386 PIV_CARD_READER_ERROR 387 PIV_INSUFFICIENT_BUFFER 388

If the length of application properties is longer than the buffer allocated by the client application, then the 389 PIV Middleware shall return PIV_INSUFFICIENT_BUFFER, but shall still set APLength to the length of 390 the application properties. 391

3.2.2 pivEstablishSecureMessaging 392

Purpose: Establish secure messaging with the PIV Card Application. 393

Prototype: status_word pivEstablishSecureMessaging( 394 IN handle cardHandle, 395

); 396

Parameters: cardHandle Opaque identifier of the card to be acted upon as 397 returned by pivConnect. 398

Return Codes: PIV_OK 399 PIV_INVALID_CARD_HANDLE 400 PIV_CARD_READER_ERROR 401 PIV_SM_FAILED 402

After successful execution of the key establishment protocol, the PIV Middleware shall perform all 403 subsequent GET DATA, VERIFY, and GENERAL AUTHENTICATE commands over secure 404 messaging, with the exception of any subsequent uses of the GENERAL AUTHENTICATE command to 405 perform the key establishment protocol. 406

3.2.3 pivLogIntoCardApplication 407

Purpose: Set security state within the PIV Card Application. 408

Prototype: status_word pivLogIntoCardApplication( 409 IN handle cardHandle, 410 IN sequence of byte authenticators, 411 IN LONG AuthLength 412

); 413

Page 14: Draft Special Publication 800-73-4, Interfaces for Personal ...2015/05/29  · 210 the PIV data elements’ identifiers, structure, and format. SP 800-73-4 also describes the client

Draft Special Publication 800-73-4 Interfaces for Personal Identity Verification Part 3: PIV Client Application Programming Interface

9

Parameters: cardHandle Opaque identifier of the card to be acted upon as 414 returned by pivConnect. 415

authenticators A sequence of zero or more BER-TLV encoded 416 authenticators to be used to authenticate and set security 417 state/status in the PIV Card Application context. 418

The authenticator BER-TLV used on the PIV client API 419 shall have the structure described in Table 3. 420

AuthLength Length of the authenticator template. 421

Table 3. Data Objects in an Authenticator Template (Tag '67') 422

Description Tag M/O Comment Reference data '81' M E.g., the PIN value Key reference '83' M See Table 4, Part 1 for PIV Card

Application PIN, Global PIN, pairing code, and OCC key reference values

423 Return Codes: PIV_OK 424 PIV_INVALID_CARD_HANDLE 425 PIV_AUTHENTICATOR_MALFORMED 426 PIV_AUTHENTICATION_FAILURE 427 PIV_SECURITY_CONDITIONS_NOT_SATISFIED 428 PIV_CARD_READER_ERROR 429 PIV_SM_FAILED 430

The PIV Middleware shall not submit authenticators to the PIV Card over a contactless interface without 431 secure messaging. If secure messaging has not been established, then the pivLogIntoCardApplication 432 function shall return PIV_SECURITY_CONDITIONS_NOT_SATISFIED. 433

3.2.4 pivGetData 434

Purpose: Return the entire data content of the named data object. 435 436 Prototype: status_word pivGetData( 437

IN handle cardHandle, 438 IN string OID, 439 IN LONG oidLength, 440 OUT sequence of byte data, 441 INOUT LONG DataLength 442

); 443

Parameters: cardHandle Opaque identifier of the card to be acted upon as 444 returned by pivConnect. 445

OID Object identifier of the object whose data content is to be 446 retrieved coded as a string; for example, 447 “2.16.840.1.101.3.7.2.96.80”. See Part 1, Table 3. 448

oidLength Length of the object identifier. 449

data Retrieved data content. 450

Page 15: Draft Special Publication 800-73-4, Interfaces for Personal ...2015/05/29  · 210 the PIV data elements’ identifiers, structure, and format. SP 800-73-4 also describes the client

Draft Special Publication 800-73-4 Interfaces for Personal Identity Verification Part 3: PIV Client Application Programming Interface

10

DataLength As an input, length of the buffer allocated for data. As 451 an output, length of the data retrieved from the PIV 452 Card. 453

Return Codes: PIV_OK 454 PIV_INVALID_CARD_HANDLE 455 PIV_INVALID_OID 456 PIV_DATA_OBJECT_NOT_FOUND 457 PIV_SECURITY_CONDITIONS_NOT_SATISFIED 458 PIV_CARD_READER_ERROR 459 PIV_SM_FAILED 460 PIV_INSUFFICIENT_BUFFER 461

If the length of the retrieved data is longer than the buffer allocated by the client application, then the PIV 462 Middleware shall return PIV_INSUFFICIENT_BUFFER, but shall still set DataLength to the length of the 463 retrieved data. 464

3.2.5 pivLogoutOfCardApplication 465

Purpose: Reset the application security state/status of the PIV Card Application. 466

Prototype: status_word pivLogoutOfCardApplication( 467 IN handle cardHandle 468

); 469

Parameters: cardHandle Opaque identifier of the card to be acted upon as 470 returned by pivConnect. The cardHandle remains valid 471 after execution of this function. 472

Return Codes: PIV_OK 473 PIV_INVALID_CARD_HANDLE 474 PIV_CARD_READER_ERROR 475

3.3 Entry Points for Cryptographic Operations 476

3.3.1 pivCrypt 477

Purpose: Perform a cryptographic operation3 such as encryption or signing on a sequence of 478 bytes. Part 1, Appendix C describes recommended procedures for PIV algorithm 479 identifier discovery. 480

Prototype: status_word pivCrypt( 481 IN handle cardHandle, 482 IN byte algorithmIdentifier, 483 IN byte keyReference, 484 IN sequence of byte algorithmInput, 485 IN LONG inputLength, 486 OUT sequence of byte algorithmOutput, 487 INOUT LONG outputLength 488

); 489 3 The pivCrypt function does not perform any cryptographic operations itself. It provides the interface to the GENERAL AUTHENTICATE command to perform cryptographic operations on card. All cryptographic operations, except SM on the client side, are performed outside the PIV Middleware.

Page 16: Draft Special Publication 800-73-4, Interfaces for Personal ...2015/05/29  · 210 the PIV data elements’ identifiers, structure, and format. SP 800-73-4 also describes the client

Draft Special Publication 800-73-4 Interfaces for Personal Identity Verification Part 3: PIV Client Application Programming Interface

11

Parameters: cardHandle Opaque identifier of the card to be acted upon as 490 returned by pivConnect. 491

algorithmIdentifier Identifier of the cryptographic algorithm to be used for 492 the cryptographic operation. [SP800-78, Tables 6-2 and 493 6-3] 494

keyReference Identifier of the on-card key to be used for the 495 cryptographic operation. See [SP800-78, Table 6-1] and 496 Part 1, Table 4. 497

algorithmInput Sequence of bytes used as the input to the cryptographic 498 operation. The algorithmInput for RSA algorithms shall 499 be restricted to the range 0 to n-1, where n is the RSA 500 modulus. 501

inputLength Length of the algorithm input. 502

algorithmOutput Sequence of bytes output by the cryptographic operation. 503

outputLength As an input, length of the buffer allocated for 504 algorithmOutput. As an output, length of the algorithm 505 output. 506

Return Codes: PIV_OK 507 PIV_INVALID_CARD_HANDLE 508 PIV_INVALID_KEYREF_OR_ALGORITHM 509 PIV_SECURITY_CONDITIONS_NOT_SATISFIED 510 PIV_INPUT_BYTES_MALFORMED 511 PIV_CARD_READER_ERROR 512 PIV_SM_FAILED 513 PIV_INSUFFICIENT_BUFFER 514

The PIV_INPUT_BYTES_MALFORMED error condition indicates that some property of the data to be 515 processed such as the length or padding was inappropriate for the requested cryptographic algorithm or 516 key. 517

If the value of keyReference is '03' (PIV Secure Messaging key) then the PIV Middleware shall return 518 PIV_INVALID_KEYREF_OR_ALGORITHM. 519

If the length of the algorithm output is longer than the buffer allocated by the client application, then the 520 PIV Middleware shall return PIV_INSUFFICIENT_BUFFER, but shall still set outputLength to the length 521 of the algorithm output. 522

3.4 Entry Points for Credential Initialization and Administration 523

The PIV Middleware shall not submit data provided to the pivPutData or pivGenerateKeyPair function 524 over the contactless interface. If the PIV Middleware is not communicating with the PIV Card via the 525 card’s contact interface then the pivPutData or pivGenerateKeyPair function shall return 526 PIV_SECURITY_CONDITIONS_NOT_SATISFIED. 527

3.4.1 pivPutData 528

Purpose: Replace the entire data content of the named data object with the provided data. 529 530

Page 17: Draft Special Publication 800-73-4, Interfaces for Personal ...2015/05/29  · 210 the PIV data elements’ identifiers, structure, and format. SP 800-73-4 also describes the client

Draft Special Publication 800-73-4 Interfaces for Personal Identity Verification Part 3: PIV Client Application Programming Interface

12

Prototype: status_word pivPutData( 531 IN handle cardHandle, 532 IN string OID, 533 IN LONG oidLength, 534 IN sequence of byte data, 535 IN LONG dataLength 536

); 537

Parameters: cardHandle Opaque identifier of the card to be acted upon as 538 returned by pivConnect. 539

OID Object identifier of the object whose data content is to be 540 replaced coded as a string; for example, 541 “2.16.840.1.101.3.7.2.96.80”. See Part 1, Table 3. 542

oidLength Length of the object identifier. 543

data Data to be used to replace in its entirety the data content 544 of the named data object. 545

dataLength Length of the provided data. 546

Return Codes: PIV_OK 547 PIV_INVALID_CARD_HANDLE 548 PIV_INVALID_OID 549 PIV_CARD_READER_ERROR 550 PIV_INSUFFICIENT_CARD_RESOURCE 551 PIV_SECURITY_CONDITIONS_NOT_SATISFIED 552

3.4.2 pivGenerateKeyPair 553

Purpose: Generates an asymmetric key pair in the currently selected card application. 554

If the provided key reference exists and the cryptographic mechanism associated with 555 the reference data identified by this key reference is the same as the provided 556 cryptographic mechanism, then the generated key pair replaces in entirety the key 557 pair currently associated with the key reference. 558

Prototype: status_word pivGenerateKeyPair( 559 IN handle cardHandle, 560 IN byte keyReference, 561 IN byte cryptographicMechanism, 562 OUT sequence of byte publicKey, 563 INOUT LONG KeyLength 564

); 565

Parameters: cardHandle Opaque identifier of the card to be acted upon as 566 returned by pivConnect. 567

keyReference The key reference of the generated key pair. 568

cryptographicMechanism The type of key pair to be generated. See Part 1, 569 Table 5. 570

publicKey BER-TLV data objects defining the public key 571 of the generated key pair. See Part 2, Table 11. 572

Page 18: Draft Special Publication 800-73-4, Interfaces for Personal ...2015/05/29  · 210 the PIV data elements’ identifiers, structure, and format. SP 800-73-4 also describes the client

Draft Special Publication 800-73-4 Interfaces for Personal Identity Verification Part 3: PIV Client Application Programming Interface

13

KeyLength As an input, length of the buffer allocated for 573 publicKey. As an output, length of the public 574 key related data retrieved from the PIV Card. 575

Return Codes: PIV_OK 576 PIV_INVALID_CARD_HANDLE 577 PIV_SECURITY_CONDITIONS_NOT_SATISFIED 578 PIV_INVALID_KEY_OR_KEYALG_COMBINATION 579 PIV_UNSUPPORTED_CRYPTOGRAPHIC_MECHANISM 580 PIV_CARD_READER_ERROR 581 PIV_INSUFFICIENT_BUFFER 582

If the length of public key related data retrieved from the PIV Card is longer than the buffer allocated by 583 the client application, then the PIV Middleware shall return PIV_INSUFFICIENT_BUFFER, but shall still 584 set KeyLength to the length of the public key related data retrieved from the PIV Card.585

Page 19: Draft Special Publication 800-73-4, Interfaces for Personal ...2015/05/29  · 210 the PIV data elements’ identifiers, structure, and format. SP 800-73-4 also describes the client

Revised Draft Special Publication 800-73-4 Interfaces for Personal Identity Verification Part 3: PIV Client Application Programming Interface

14

Appendix A—Terms, Acronyms, and Notation 586

A.1 Terms 587

Application Identifier A globally unique identifier of a card application as defined in ISO/IEC 588 7816-4. 589

Application Session The period of time within a card session between when a card application 590 is selected and a different card application is selected or the card session 591 ends. 592

Algorithm Identifier A PIV algorithm identifier is a one-byte identifier that specifies a 593 cryptographic algorithm and key size. For symmetric cryptographic 594 operations, the algorithm identifier also specifies a mode of operation 595 (i.e., ECB). 596

BER-TLV Data Object A data object coded according to ISO/IEC 8825-2. 597

Card An integrated circuit card. 598 599 Card Application A set of data objects and card commands that can be selected using an 600

application identifier. 601

Card Interface Device An electronic device that connects an integrated circuit card and the card 602 applications therein to a client application. 603

Card Reader Synonym for card interface device. 604

Client Application A computer program running on a computer in communication with a 605 card interface device. 606

Card Management Any operation involving the PIV Card Application Administrator. 607 Operation 608

Data Object An item of information seen at the card command interface for which are 609 specified a name, a description of logical content, a format and a coding. 610

Interface Device Synonym for card interface device. 611

Key Reference A PIV key reference is a one-byte identifier that specifies a 612 cryptographic key according to its PIV Key Type. The identifier used in 613 cryptographic protocols such as an authentication or a signing protocol. 614

Object Identifier A globally unique identifier of a data object as defined in ISO/IEC 8824-615 2. 616

Reference Data Cryptographic material used in the performance of a cryptographic 617 protocol such as an authentication or a signing protocol. The reference 618 data length is the maximum length of a password or PIN. For 619 algorithms, the reference data length is the length of a key. 620

Page 20: Draft Special Publication 800-73-4, Interfaces for Personal ...2015/05/29  · 210 the PIV data elements’ identifiers, structure, and format. SP 800-73-4 also describes the client

Draft Special Publication 800-73-4 Interfaces for Personal Identity Verification Part 3: PIV Client Application Programming Interface

15

Status Word Two bytes returned by an integrated circuit card after processing any 621 command that encodes the success of or errors encountered during said 622 processing. 623

Template A (constructed) BER-TLV data object whose value field contains 624 specific BER-TLV data objects. 625

A.2 Acronyms 626

AID Application Identifier 627 API Application Programming Interface 628 ASN.1 Abstract Syntax Notation One 629

BER Basic Encoding Rules 630

FIPS Federal Information Processing Standards 631 FISMA Federal Information Security Management Act 632

GSC-IS Government Smart Card Interoperability Specification 633

HSPD Homeland Security Presidential Directive 634

ICC Integrated Circuit Card 635 IEC International Electrotechnical Commission 636 INCITS InterNational Committee for Information Technology Standards 637 ISDN Integrated Services Digital Network 638 ISO International Organization for Standardization 639 ITL Information Technology Laboratory 640

LSB Least Significant Bit 641

MSB Most Significant Bit 642

NIST National Institute of Standards and Technology 643

OCC On-Card biometric Comparison 644 OID Object Identifier 645 OMB Office of Management and Budget 646

PC/SC Personal Computer/Smart Card 647 PIN Personal Identification Number 648 PIV Personal Identity Verification 649 PKCS Public-Key Cryptography Standards 650 PKI Public Key Infrastructure 651

RFU Reserved for Future Use 652

SM Secure Messaging 653 SP Special Publication 654

TLV Tag-Length-Value 655

Page 21: Draft Special Publication 800-73-4, Interfaces for Personal ...2015/05/29  · 210 the PIV data elements’ identifiers, structure, and format. SP 800-73-4 also describes the client

Draft Special Publication 800-73-4 Interfaces for Personal Identity Verification Part 3: PIV Client Application Programming Interface

16

A.3 Notation 656

The sixteen hexadecimal digits shall be denoted using the alphanumeric characters 0, 1, 2, …, 9, 657 A, B, C, D, E, and F. A byte consists of two hexadecimal digits, for example, '2D'. The two 658 hexadecimal digits are represented in quotations '2D' or as 0x2D. A sequence of bytes may be 659 enclosed in single quotation marks, for example 'A0 00 00 01 16', rather than given as a sequence 660 of individual bytes, 'A0' '00' '00' '01' '16'. 661

A byte can also be represented by bits b8 to b1, where b8 is the most significant bit (MSB) and b1 662 is the least significant bit (LSB) of the byte. In textual or graphic representations, the leftmost bit 663 is the MSB. Thus, for example, the most significant bit, b8, of '80' is 1 and the least significant 664 bit, b1, is 0. 665

All bytes specified as RFU shall be set to '00' and all bits specified as RFU shall be set to 0. 666

All lengths shall be measured in number of bytes unless otherwise noted. 667

Data objects in templates are described as being mandatory (M) or optional (O). 'Mandatory' 668 means the data object shall appear in the template. 'Optional' means the data object may appear 669 in the template. 670

In other tables the M/O/C column identifies properties of the PIV Card Application that shall be 671 present (M), may be present (O), or are conditionally required to be present (C). 672

BER-TLV data object tags are represented as byte sequences as described above. Thus, for 673 example, 0x4F is the interindustry data object tag for an application identifier and 0x7F60 is the 674 interindustry data object tag for the biometric information template. 675

Page 22: Draft Special Publication 800-73-4, Interfaces for Personal ...2015/05/29  · 210 the PIV data elements’ identifiers, structure, and format. SP 800-73-4 also describes the client

Revised Draft Special Publication 800-73-4 Interfaces for Personal Identity Verification Part 3: PIV Client Application Programming Interface

17

Appendix B—References 676

[FIPS201] Federal Information Processing Standard 201-2, Personal Identity Verification (PIV) 677 of Federal Employees and Contractors, August 2013. (See http://csrc.nist.gov) 678

[ISO8825] ISO/IEC 8825-1:2002, Information technology — ASN.1 encoding rules: Specification 679 of Basic Encoding Rules (BER), Canonical Encoding Rules (CER) and Distinguished Encoding 680 Rules (DER). 681

[SP800-78] Revised Draft NIST Special Publication 800-78-4, Cryptographic Algorithms and 682 Key Sizes for Personal Identity Verification. (See http://csrc.nist.gov) 683