RFC 4758

Cryptographic Token Key Initialization Protocol (CT-KIP) Version 1.0 Revision 1

๐Ÿ“… published November 2006, from ietf

RFC 4758 ๐Ÿฆ‹ Cryptographic Token Key Initialization Protocol (CT-KIP) Version 1.0 Revision 1

Okay bestie, let's start with the header tea โ˜• This one's from the Network Working Group ๐ŸŒธ and it's written by M. Nystroem from RSA Security ๐Ÿ’ผ. It's Category: Informational, which means it's just sharing info, not a standard. It was published in November 2006 ๐Ÿ“…. It doesn't obsolete or update any other RFC, since the header doesn't list any ๐Ÿ™…

Status of This Memo โœจ

This memo just gives info to the Internet community ๐Ÿง  It is NOT an Internet standard of any kind, and it can be shared as much as you want, because distribution is unlimited ๐Ÿ”

Copyright (C) The IETF Trust (2006).

Abstract ๐Ÿ’–

Okay so this document is Revision 1 of CT-KIP Version 1.0 from RSA Laboratories' One-Time Password Specifications (OTPS) series ๐Ÿ” The main body is taken from the CT-KIP Version 1.0 document, except for the intellectual property section. The IETF review comments got reflected, which is why it's called a revised version ๐Ÿ’… Also, no "bits-on-the-wire" changed, so this protocol is still compatible with CT-KIP Version 1.0 ๐Ÿซถ

CT-KIP is a client-server protocol for initializing (and configuring) cryptographic tokens ๐ŸŽ€ The best part? It doesn't need private-key capabilities in the tokens, and it doesn't need an established public-key infrastructure ๐Ÿ™Œ Any secrets that get provisioned (or generated) are only available to the server and the cryptographic token itself ๐Ÿคซ Main character security energy ๐Ÿ‘‘

Table of Contents ๐Ÿ—‚๏ธ

   1. Introduction ....................................................4
      1.1. Scope ......................................................4
      1.2. Background .................................................4
      1.3. Document Organization ......................................5
   2. Acronyms and Notation ...........................................5
      2.1. Acronyms ...................................................5
      2.2. Notation ...................................................5
   3. CT-KIP ..........................................................6
      3.1. Overview ...................................................6
      3.2. Entities ...................................................7
      3.3. Principles of Operation ....................................7
      3.4. The CT-KIP One-Way Pseudorandom Function, CT-KIP-PRF ......10
           3.4.1. Introduction .......................................10
           3.4.2. Declaration ........................................11
      3.5. Generation of Cryptographic Keys for Tokens ...............11
      3.6. Encryption of Pseudorandom Nonces Sent from the
           CT-KIP Client .............................................12
      3.7. CT-KIP Schema Basics ......................................13
           3.7.1. Introduction .......................................13
           3.7.2. General XML Schema Requirements ....................13
           3.7.3. The AbstractRequestType Type .......................13
           3.7.4. The AbstractResponseType type ......................14
           3.7.5. The StatusCode Type ................................14
           3.7.6. The IdentifierType Type ............................16
           3.7.7. The NonceType Type .................................16
           3.7.8. The ExtensionsType and the
                  AbstractExtensionType Types ........................17
      3.8. CT-KIP Messages ...........................................17
           3.8.1. Introduction .......................................17
           3.8.2. CT-KIP Initialization ..............................17
           3.8.3. The CT-KIP Client's Initial PDU ....................18
           3.8.4. The CT-KIP server's initial PDU ....................20
           3.8.5. The CT-KIP Client's Second PDU .....................23
           3.8.6. The CT-KIP Server's Final PDU ......................24
      3.9. Protocol Extensions .......................................27
           3.9.1. The ClientInfoType Type ............................27
           3.9.2. The ServerInfoType Type ............................28
           3.9.3. The OTPKeyConfigurationDataType Type ...............28
   4. Protocol Bindings ..............................................29
      4.1. General Requirement .......................................29
      4.2. HTTP/1.1 binding for CT-KIP ...............................29
           4.2.1. Introduction .......................................29
           4.2.2. Identification of CT-KIP Messages ..................29
           4.2.3. HTTP Headers .......................................29
           4.2.4. HTTP Operations ....................................30
           4.2.5. HTTP Status Codes ..................................30
           4.2.6. HTTP Authentication ................................31
           4.2.7. Initialization of CT-KIP ...........................31
           4.2.8. Example Messages ...................................31
   5. Security considerations ........................................32
      5.1. General ...................................................32
      5.2. Active Attacks ............................................32
           5.2.1. Introduction .......................................32
           5.2.2. Message Modifications ..............................32
           5.2.3. Message Deletion ...................................34
           5.2.4. Message Insertion ..................................34
           5.2.5. Message Replay .....................................34
           5.2.6. Message Reordering .................................35
           5.2.7. Man in the Middle ..................................35
      5.3. Passive Attacks ...........................................35
      5.4. Cryptographic Attacks .....................................35
      5.5. Attacks on the Interaction between CT-KIP and User
           Authentication ............................................36
   6. Intellectual Property Considerations ...........................36
   7. References .....................................................37
      7.1. Normative References ......................................37
      7.2. Informative References ....................................37
   Appendix A. CT-KIP Schema .........................................39
   Appendix B. Examples of CT-KIP Messages ...........................46
      B.1. Introduction ..............................................46
      B.2. Example of a CT-KIP Initialization (Trigger) Message ......46
      B.3. Example of a <ClientHello> Message ........................46
      B.4. Example of a <ServerHello> Message ........................47
      B.5. Example of a <ClientNonce> Message ........................47
      B.6. Example of a <ServerFinished> Message .....................48
   Appendix C. Integration with PKCS #11 .............................48
   Appendix D. Example CT-KIP-PRF Realizations .......................48
      D.1. Introduction ..............................................48
      D.2. CT-KIP-PRF-AES ............................................48
           D.2.1. Identification .....................................48
           D.2.2. Definition .........................................49
           D.2.3. Example ............................................50
      D.3. CT-KIP-PRF-SHA256 .........................................50
           D.3.1. Identification .....................................50
           D.3.2. Definition .........................................51
           D.3.3. Example ............................................52
   Appendix E. About OTPS ............................................53

1. Introduction โœจ

Note: this document is Revision 1 of CT-KIP Version 1.0 [12] from RSA Laboratories' OTPS series ๐Ÿ“š

1.1. Scope ๐ŸŽฏ

Okay so this document describes a client-server protocol for initializing (and configuring) cryptographic tokens ๐Ÿ”‘ It doesn't need private-key capabilities in the tokens, and it doesn't need an established public-key infrastructure ๐Ÿ’…

The goals of this protocol are:

  • To provide a secure way of initializing cryptographic tokens with secret keys, without exposing generated secret material to any entities other than the server and the cryptographic token itself ๐Ÿ”’
  • To avoid, as much as possible, any impact on existing cryptographic token manufacturing processes ๐Ÿญ
  • To provide a solution that is easy to administer and scales well ๐Ÿ“ˆ

The mechanism is meant for general use in computer and communications systems that use connected cryptographic tokens (or software emulations of them) ๐ŸŒˆ

1.2. Background ๐Ÿ“–

A cryptographic token can be a handheld hardware device, a hardware device connected to a personal computer through an electronic interface such as USB, or a software module living on a personal computer ๐Ÿ’ป It offers cryptographic functionality that can be used, for example, to authenticate a user to some service ๐Ÿ™‹ These tokens are increasingly working in a connected way, which means they can be initialized programmatically and their output values can be retrieved programmatically too โšก

This document is here to meet the need for an open and interoperable mechanism to programmatically initialize and configure connected cryptographic tokens ๐Ÿซถ There's also a companion document, "A PKCS #11 Mechanism for the Cryptographic Token Key Initialization Protocol" [2], that describes an application-programming interface you can use with this mechanism ๐Ÿงš

1.3. Document Organization ๐Ÿ—บ๏ธ

Here's the tour bestie:

  • Section 1 is the introduction ๐ŸŒธ
  • Section 2 defines some notation used in this document ๐Ÿ”ค
  • Section 3 defines the protocol mechanism in detail ๐Ÿ”
  • Section 4 defines a binding of the protocol to transports ๐Ÿšš
  • Section 5 provides security considerations ๐Ÿ›ก๏ธ
  • Appendix A defines the XML schema for the protocol mechanism, Appendix B gives example messages, and Appendix C discusses integration with PKCS #11 [3] ๐ŸŽ€
  • Appendix D provides example realizations of an abstract pseudorandom function defined in Section 3 ๐Ÿงฉ
  • Appendix E provides general information about the One-Time Password Specifications ๐Ÿ“ฆ

2. Acronyms and Notation ๐Ÿ”ค

2.1. Acronyms ๐Ÿ’…

   MAC      Message Authentication Code

   PDU      Protocol Data Unit

   PRF      Pseudo-Random Function

   CT-KIP   Cryptographic Token Key Initialization Protocol (the
            protocol mechanism described herein)

2.2. Notation ๐Ÿง 

   ||       String concatenation

   [x]      Optional element x

   A ^ B    Exclusive-or operation on strings A and B (A and B of equal
            length)

   K_AUTH   Secret key used for authentication purposes
   K_TOKEN  Secret key used for token computations, generated in CT-KIP

   K_SERVER Public key of CT-KIP server

   K_SHARED Secret key shared between the cryptographic token and the
            CT-KIP server

   K        Key used to encrypt R_C (either K_SERVER or K_SHARED)

   R        Pseudorandom value chosen by the cryptographic token and
            used for MAC computations

   R_C      Pseudorandom value chosen by the cryptographic token

   R_S      Pseudorandom value chosen by the CT-KIP server

The typographical convention used in the body of the text is <XMLElement> โœจ

3. CT-KIP ๐ŸŽ€

3.1. Overview ๐ŸŽ€

Okay bestie, so CT-KIP is a client-server protocol for securely initializing cryptographic tokens ๐Ÿ”. The big goal is high assurance for both the server and the client (the cryptographic token), so each side can be sure the generated keys were properly and randomly made and haven't been exposed to anyone else ๐Ÿ‘€. And the best part? It does not need a public-key infrastructure. No PKI drama needed โœจ

+---------------+                            +---------------+
|               |                            |               |
| CT-KIP client |                            | CT-KIP server |
|               |                            |               |
+---------------+                            +---------------+
        |                                            |
        |        [ <---- CT-KIP trigger ---- ]       |
        |                                            |
        |        ------- Client Hello ------->       |
        |                                            |
        |        <------ Server Hello --------       |
        |                                            |
        |        ------- Client Nonce ------->       |
        |                                            |
        |        <----- Server Finished ------       |

Figure 1: The 4-pass CT-KIP protocol (with optional preceding trigger)

3.2. Entities ๐Ÿงš

In principle, the protocol involves a CT-KIP client and a CT-KIP server ๐Ÿ’•

So picture a desktop, a laptop, or a wireless device (like a mobile phone or a PDA) hosting an app that talks to the CT-KIP server and the cryptographic token. Together, the token and that app make up the CT-KIP client ๐Ÿซถ Whenever something needs to be done by the app or by the token specifically, the text will say so out loud, no guessing required.

The app handles passing CT-KIP protocol elements to and from the token, and the CT-KIP server doesn't see any of that part. It's totally transparent to the server ๐Ÿฆ‹ One method for this transfer is described in [2].

3.3. Principles of Operation ๐ŸŒธ

Okay, here's the flow! To start a CT-KIP session, a user can use a browser to connect to a web server running on some host. The user can then identify (and authenticate) herself, which is handled by some means that are basically out of scope for this document, and maybe tell the CT-KIP client how to contact the CT-KIP server ๐Ÿ—บ๏ธ There are other ways to kick things off too, like the CT-KIP client being pre-configured to reach a certain CT-KIP server, or the user being told out-of-band where the server lives. Either way, once the CT-KIP server's location is known, the two engage in a 4-pass protocol like this:

a. The CT-KIP client tells the CT-KIP server about the cryptographic token's identity, the CT-KIP versions it supports, the cryptographic algorithms the token supports (and which keys can be generated with this protocol), and the encryption and MAC algorithms the token supports for the purposes of this protocol ๐Ÿ“‹

b. Based on that info, the CT-KIP server sends the client a random nonce, R_S, along with info about the type of key to generate and the encryption algorithm it chose to protect sensitive data in the protocol. It also gives either info about a shared secret key to use for encrypting the token's random nonce (more on that below), or its own public key ๐Ÿ”‘ The length of the nonce R_S may depend on the selected key type.

c. The cryptographic token generates a random nonce R_C and encrypts it with the selected encryption algorithm, using a key K that's either the CT-KIP server's public key K_SERVER, or a shared secret key K_SHARED, whichever the CT-KIP server indicated ๐Ÿ” The length of the nonce R_C may depend on the selected key type. The CT-KIP client then sends the encrypted random nonce over to the CT-KIP server. The token also calculates a cryptographic key K_TOKEN of the selected type, using the CT-KIP-PRF function defined herein. It's built from the two random nonces R_S and R_C, the encryption key K, and possibly some other data ๐Ÿงฎ

d. The CT-KIP server decrypts R_C, then calculates K_TOKEN from the two random nonces R_S and R_C, the encryption key K, and possibly some other data, using the CT-KIP-PRF function defined herein ๐Ÿค“ Then the server associates K_TOKEN with the cryptographic token in a server-side data store ๐Ÿ—„๏ธ The whole idea is that a service can later use that data store to verify or decrypt data produced by the token and the key.

e. Once that association is made, the CT-KIP server sends a confirmation message to the CT-KIP client โœ… The message includes an identifier for the generated key, and it may also contain extra config info, like the identity of the CT-KIP server.

f. When the token gets the confirmation, it links the provided key identifier to the generated key K_TOKEN and stores the configuration data, if there is any ๐Ÿ’œ

Note: Conceptually, although R_C is one pseudorandom string, it can be viewed as two components, R_C1 and R_C2. R_C1 gets generated during the protocol run, and R_C2 can be generated when the token is manufactured and stored in the token itself. In that case, R_C2 should be unique for each cryptographic token for a given manufacturer ๐ŸŒˆ

+----------------------+    +-------+     +----------------------+
|    +------------+    |    |       |     |                      |
|    | Server key |    |    |       |     |                      |
| +<-|  Public    |------>------------->-------------+---------+ |
| |  |  Private   |    |    |       |     |          |         | |
| |  +------------+    |    |       |     |          |         | |
| |        |           |    |       |     |          |         | |
| V        V           |    |       |     |          V         V |
| |   +---------+      |    |       |     |        +---------+ | |
| |   | Decrypt |<-------<-------------<-----------| Encrypt | | |
| |   +---------+      |    |       |     |        +---------+ | |
| |      |  +--------+ |    |       |     |            ^       | |
| |      |  | Server | |    |       |     |            |       | |
| |      |  | Random |--->------------->------+  +----------+  | |
| |      |  +--------+ |    |       |     |   |  | Client   |  | |
| |      |      |      |    |       |     |   |  | Random   |  | |
| |      |      |      |    |       |     |   |  +----------+  | |
| |      |      |      |    |       |     |   |        |       | |
| |      V      V      |    |       |     |   V        V       | |
| |   +------------+   |    |       |     | +------------+     | |
| +-->| CT-KIP PRF |   |    |       |     | | CT-KIP PRF |<----+ |
|     +------------+   |    |       |     | +------------+       |
|           |          |    |       |     |       |              |
|           V          |    |       |     |       V              |
|       +-------+      |    |       |     |   +-------+          |
|       |  Key  |      |    |       |     |   |  Key  |          |
|       +-------+      |    |       |     |   +-------+          |
|       +-------+      |    |       |     |   +-------+          |
|       |Key Id |-------->------------->------|Key Id |          |
|       +-------+      |    |       |     |   +-------+          |
+----------------------+    +-------+     +----------------------+
     CT-KIP Server        CT-KIP Client     CT-KIP Client (Token)
                            (PC Host)

Figure 2: Principal data flow for CT-KIP key generation - using public server key

Here's why this design is so good ๐Ÿ™Œ Including both random nonces R_S and R_C in the key generation gives assurance to both sides (the token and the CT-KIP server) that they each contributed to the key's randomness, and that the key is unique. Including the encryption key K makes sure no man-in-the-middle can be there, or else the token would end up with a key that's different from the one the legitimate CT-KIP server stores ๐Ÿ›ก๏ธ

Note: A man-in-the middle (in the form of corrupt client software or a mistakenly contacted server) may present his own public key to the token ๐Ÿ˜ฌ This lets the attacker learn the client's version of K_TOKEN. But the attacker can't convince the legitimate server to derive the same value for K_TOKEN, since K_TOKEN is a function of the public key involved, and the attacker's public key must be different than the correct server's (or else the attacker couldn't decrypt the information received from the client). So once the attacker is no longer "in the middle," the client and server will detect that they are "out of synch" when they try to use their keys. That's why, when R_C is encrypted with K_SERVER, it's important to verify that K_SERVER really is the legitimate server's key ๐Ÿ” One way to do this is to independently validate a newly generated K_TOKEN against some validation service at the server (for example, by using a connection independent from the one used for the key generation).

The CT-KIP server can couple an initial user authentication to the CT-KIP execution in several ways, to make sure a generated K_TOKEN ends up associated with the correct token and user ๐Ÿ’ž One way is to give the user or CT-KIP client a one-time value after successful user authentication, and then require that value to be used when contacting the CT-KIP service. That basically couples the user authentication with the later CT-KIP protocol run. This value could be placed in a <TriggerNonce> element of the CT-KIP initialization trigger (if triggers are used; see Section 4.2.7). Another way is for the user to provide a token identifier that will later be used in the CT-KIP protocol, sent to the server during the authentication phase. The server can then include this token identifier in the CT-KIP initialization trigger. It's also legit for a CT-KIP client to start a CT-KIP protocol run without having received an initialization message from a server. But in that case, any provided token identifier shall not be accepted by the server unless the server has access to a unique token key for the identified token, and that key will be used in the protocol ๐Ÿšซ Whatever the method, the CT-KIP server must ensure that a generated key is associated with the correct token and, if applicable, the correct user. For a further discussion of this and threats related to man-in-the-middle attacks in this context, see Section 5.5 ๐Ÿ”’

3.4. The CT-KIP One-Way Pseudorandom Function, CT-KIP-PRF โœจ

3.4.1. Introduction โœจ

okay so CT-KIP-PRF has basically the same general requirements as a keyed hash function ๐Ÿ” It SHALL take an arbitrary length input, and be one-way and collision-free (for a definition of these terms, see, e.g., [4]). It also SHALL be capable of generating a variable-length output, and its output SHALL be unpredictable even if other outputs for the same key are known. bestie, that last part is everything ๐Ÿ˜ญ๐Ÿ’…

We assume any realization of CT-KIP-PRF takes three input parameters: a secret key k, some combination of variable data, and the desired length of the output ๐Ÿงš The variable data can be things like a current token counter value, the current token time, or a challenge. Without loss of generality, you can treat that combination of variable data as a salt value (see PKCS #5 Version 2.0 [5], Section 4). This way of looking at CT-KIP-PRF SHOULD fit all the actual PRF algorithms that tokens implement ๐ŸŽ€ From the point of view of this spec, CT-KIP-PRF is a "black-box" function: you hand it the inputs and it gives you back a pseudorandom value. no notes on the innards, just vibes ๐Ÿฆ‹

Separate specifications MAY define how CT-KIP-PRF gets implemented for different types of cryptographic tokens. Appendix D has two example realizations if you want to see it in action ๐ŸŒธ

3.4.2. Declaration

CT-KIP-PRF (k, s, dsLen)

Here's the breakdown of the inputs and output ๐Ÿ’–

  • Input: k, the secret key in octet string format
  • Input: s, an octet string of varying length made of variable data that distinguishes the particular string being derived
  • Input: dsLen, the desired length of the output
  • Output: DS, a pseudorandom string that is dsLen-octets long

For the purposes of this document, the secret key k SHALL be 16 octets long ๐Ÿ”‘

3.5. Generation of Cryptographic Keys for Tokens

In CT-KIP, keys get generated using CT-KIP-PRF. The ingredients are a secret random value R_C chosen by the CT-KIP client, a random value R_S chosen by the CT-KIP server, and the key k that's used to encrypt R_C ๐Ÿง The input parameter s of CT-KIP-PRF is the concatenation of the (ASCII) string "Key generation", k, and R_S. The input parameter dsLen is set to the desired length of the key, K_TOKEN, and the length of K_TOKEN depends on the key's type โœจ

dsLen = (desired length of K_TOKEN)

K_TOKEN = CT-KIP-PRF (R_C, "Key generation" || k || R_S, dsLen)

When computing K_TOKEN like above, the output of CT-KIP-PRF MAY be run through an algorithm-dependent transform before it's adopted as a key of the selected type. One example is the parity needed for DES keys ๐ŸŒˆ

3.6. Encryption of Pseudorandom Nonces Sent from the CT-KIP Client

The CT-KIP client's random nonce(s) are encrypted either with the public key the CT-KIP server gave, or with a shared secret key ๐Ÿซถ For example, if you've got a public RSA key, you can use an RSA encryption scheme from PKCS #1 [6].

For the shared secret key case, the CT-KIP client MAY use CT-KIP-PRF to avoid depending on other algorithms ๐Ÿงฉ The shared secret key K_SHARED goes in as the input parameter k. The input parameter s is the concatenation of the (ASCII) string "Encryption" and the server's nonce R_S, and dsLen is set to the length of R_C. Quick heads up: K_SHARED SHOULD be used solely for this purpose ๐Ÿšจ

dsLen = len(R_C)

DS = CT-KIP-PRF(K_SHARED, "Encryption" || R_S, dsLen)

That gives you a pseudorandom string DS the same length as R_C. Then you encrypt R_C by XOR-ing DS with R_C ๐Ÿ”

Enc-R_C = DS ^ R_C

The CT-KIP server then does the reverse operation to pull R_C back out of Enc-R_C โœจ

Note: It may appear that an attacker who learns a previous value of R_C could replay the matching R_S and, in turn, learn a new R_C too. Relax, though, because this attack is mitigated by the requirement for a server to show knowledge of K_AUTH (see below) in order to successfully complete a key re-generation ๐Ÿ›ก๏ธ

3.7. CT-KIP Schema Basics

3.7.1. Introduction

The core parts of the XML schema for CT-KIP live in Appendix A, and this section explains them ๐Ÿ“š The specific protocol message elements are defined in Section 3.8, and examples are in Appendix B ๐ŸŽ€

The XML format for CT-KIP messages was designed to be extensible. But heads up: using extensions might harm interoperability, so any use of extensions SHOULD be carefully considered ๐Ÿ™ˆ For example, if an implementation relies on a proprietary extension, it may not be able to interoperate with independent implementations that don't know about that extension.

XML types defined in this subsection are not CT-KIP messages. They're just building blocks that CT-KIP messages use ๐Ÿงฑ

3.7.2. General XML Schema Requirements

Some CT-KIP elements rely on the parties being able to compare received values with stored values ๐Ÿ‘€ Unless otherwise noted, every element in this document with the XML Schema "xs:string" type, or a type derived from it, MUST be compared using an exact binary comparison. Basically, CT-KIP implementations MUST NOT depend on case-insensitive string comparisons, normalization or trimming of white space, or conversion of locale-specific formats such as numbers ๐Ÿ™…โ€โ™€๏ธ

If implementations compare values that use different character encodings, they MUST use a comparison method that returns the same result as converting both values to the Unicode character encoding, Normalization Form C [1], and then doing an exact binary comparison ๐ŸŒ

No collation or sorting order for attributes or element values is defined. So CT-KIP implementations MUST NOT depend on specific sorting orders for values ๐Ÿ’…

3.7.3. The AbstractRequestType Type

All CT-KIP requests are defined as extensions to the abstract AbstractRequestType type. That means the elements of AbstractRequestType apply to all CT-KIP requests ๐Ÿ’– Every CT-KIP request MUST contain a Version attribute. For this version of the spec, Version SHALL be set to "1.0" โœจ

<xs:complexType name="AbstractRequestType" abstract="true">
  <xs:attribute name="Version" type="VersionType"
   use="required"/>
</xs:complexType>

3.7.4. The AbstractResponseType type

All CT-KIP responses are defined as extensions to the abstract AbstractResponseType type, so its elements apply to all CT-KIP responses ๐Ÿฆ‹ Every CT-KIP response contains a Version attribute saying which version got used. A Status attribute, which says whether the preceding request worked out, MUST also be present. Finally, responses MAY contain a SessionID attribute that identifies the particular CT-KIP session ๐ŸŒธ The SessionID attribute only needs to be there if more than one roundtrip is required for a successful protocol run (which is the case with the protocol version described here).

<xs:complexType name="AbstractResponseType" abstract="true">
  <xs:attribute name="Version" type="VersionType" use="required"/>
  <xs:attribute name="SessionID" type="IdentifierType"/>
  <xs:attribute name="Status" type="StatusCode" use="required"/>
</xs:complexType>

3.7.5. The StatusCode Type

The StatusCode type lists every possible return code ๐Ÿšฆ

<xs:simpleType name="StatusCode">
  <xs:restriction base="xs:string">
    <xs:enumeration value="Continue"/>
    <xs:enumeration value="Success"/>
    <xs:enumeration value="Abort"/>
    <xs:enumeration value="AccessDenied"/>
    <xs:enumeration value="MalformedRequest"/>
    <xs:enumeration value="UnknownRequest"/>
    <xs:enumeration value="UnknownCriticalExtension"/>
    <xs:enumeration value="UnsupportedVersion"/>
    <xs:enumeration value="NoSupportedKeyTypes"/>
    <xs:enumeration value="NoSupportedEncryptionAlgorithms"/>
    <xs:enumeration value="NoSupportedMACAlgorithms"/>
    <xs:enumeration value="InitializationFailed"/>
  </xs:restriction>
</xs:simpleType>

When a message comes in or goes out with a Status attribute value that isn't "Success" or "Continue", the default behavior is that both the CT-KIP server and the CT-KIP client SHALL immediately terminate the CT-KIP session, unless it's explicitly stated otherwise below ๐Ÿ›‘ CT-KIP servers and CT-KIP clients MUST delete any secret values generated by failed runs of the CT-KIP protocol ๐Ÿ—‘๏ธ Session identifiers MAY be retained from successful or failed protocol runs for replay detection purposes, but those retained identifiers SHALL NOT be reused for later runs of the protocol.

When possible, the CT-KIP client SHOULD show the user an appropriate error message ๐Ÿ’ฌ

These status codes are valid in all CT-KIP-Response messages unless explicitly stated otherwise. Here's what each one means:

  • Continue means the CT-KIP server is ready for a subsequent request from the CT-KIP client. It can't be sent in the server's final message.
  • Success means the CT-KIP session finished successfully. It can only be sent in the server's final message ๐ŸŽ‰
  • Abort means the CT-KIP server rejected the CT-KIP client's request for unspecified reasons.
  • AccessDenied means the CT-KIP client isn't authorized to contact this CT-KIP server.
  • MalformedRequest means the CT-KIP server couldn't parse the CT-KIP client's request.
  • UnknownRequest means the CT-KIP client made a request the CT-KIP server doesn't know.
  • UnknownCriticalExtension means a critical CT-KIP extension (see below) used by the CT-KIP client wasn't supported or recognized by the CT-KIP server.
  • UnsupportedVersion means the CT-KIP client used a CT-KIP protocol version the CT-KIP server doesn't support. This error is only valid in the CT-KIP server's first response message.
  • NoSupportedKeyTypes means the CT-KIP client only suggested key types the CT-KIP server doesn't support. This error is only valid in the CT-KIP server's first response message. Note that it only happens if the CT-KIP server doesn't support any of the CT-KIP client's suggested key types.
  • NoSupportedEncryptionAlgorithms means the CT-KIP client only suggested encryption algorithms the CT-KIP server doesn't support. This error is only valid in the CT-KIP server's first response message. Note that it only happens if the CT-KIP server doesn't support any of the CT-KIP client's suggested encryption algorithms.
  • NoSupportedMACAlgorithms means the CT-KIP client only suggested MAC algorithms the CT-KIP server doesn't support. This error is only valid in the CT-KIP server's first response message. Note that it only happens if the CT-KIP server doesn't support any of the CT-KIP client's suggested MAC algorithms.
  • InitializationFailed means the CT-KIP server couldn't generate a valid key from the data it was given. When this status code comes back, the CT-KIP client SHOULD try to restart CT-KIP, since a new run might succeed ๐Ÿ”„

3.7.6. The IdentifierType Type

The IdentifierType type is used to identify various CT-KIP elements, like sessions, users, and services ๐Ÿชช Identifiers MUST NOT be longer than 128 octets.

<xs:simpleType name="IdentifierType">
  <xs:restriction base="xs:string">
    <xs:maxLength value="128"/>
  </xs:restriction>
</xs:simpleType>

3.7.7. The NonceType Type โœจ

okay so the NonceType type is how we carry those pseudorandom values around in CT-KIP messages ๐ŸŽ€ A nonce, as the name suggests, is a number used ONCE, so it MUST be used only once ๐Ÿ™ˆ Every CT-KIP message that needs a nonce element sent SHALL get a fresh nonce each time, no reusing old ones! And nonce values MUST be at least 16 octets long, no shortcuts ๐Ÿ’…

<xs:simpleType name="NonceType">
  <xs:restriction base="xs:base64Binary">
    <xs:minLength value="16"/>
  </xs:restriction>
</xs:simpleType>

3.7.8. The ExtensionsType and the AbstractExtensionType Types ๐Ÿฆ‹

the ExtensionsType type is basically a list of type-value pairs that define optional CT-KIP features a client or server supports ๐ŸŒธ Extensions MAY be sent with any CT-KIP message, and you should check Section 3.8 of this document to see which extensions apply to each message ๐Ÿงš Unless an extension is marked as Critical, the receiving party doesn't need to be able to interpret it. The receiving party is always free to disregard any non-critical extensions, so it's giving chill vibes ๐Ÿ˜ญ

<xs:complexType name="AbstractExtensionsType">
  <xs:sequence maxOccurs="unbounded">
    <xs:element name="Extension" type="AbstractExtensionType"/>
  </xs:sequence>
</xs:complexType>

<xs:complexType name="AbstractExtensionType" abstract="true">
  <xs:attribute name="Critical" type="xs:boolean"/>
</xs:complexType>

3.8. CT-KIP Messages ๐Ÿ’œ

3.8.1. Introduction ๐ŸŒˆ

in this section we get into the actual CT-KIP messages, including their parameters, encodings, and semantics ๐Ÿซถ

3.8.2. CT-KIP Initialization ๐Ÿ‘‘

the CT-KIP server MAY kick off the CT-KIP protocol by sending a <CT-KIPTrigger> message ๐Ÿ”ฅ This message MAY, e.g., be sent when a user asks for token initialization during a browsing session ๐Ÿ’–

<xs:complexType name="InitializationTriggerType">
  <xs:sequence>
    <xs:element name="TokenID" type="xs:base64Binary" minOccurs="0"/>
    <xs:element name="KeyID" type="xs:base64Binary" minOccurs="0"/>
    <xs:element name="TokenPlatformInfo"
      type="TokenPlatformInfoType" minOccurs="0"/>
    <xs:element name="TriggerNonce" type="NonceType"/>
    <xs:element name="CT-KIPURL" type="xs:anyURI" minOccurs="0"/>
    <xs:any namespace="##other" processContents="strict"
      minOccurs="0"/>
  </xs:sequence>
  <xs:attribute name="id" type="xs:ID"/>
</xs:complexType>
<xs:element name="CT-KIPTrigger" type="CT-KIPTriggerType"/>

<xs:complexType name="CT-KIPTriggerType">
  <xs:annotation>
    <xs:documentation xml:lang="en">
       Message used to trigger the device to initiate a
       CT-KIP run.
    </xs:documentation>
  </xs:annotation>
  <xs:sequence>
    <xs:choice>
      <xs:element name="InitializationTrigger"
        type="InitializationTriggerType"/>
      <xs:any nameSpace="##other" processContents="strict"/>
    </xs:choice>
  </xs:sequence>
  <xs:attribute name="Version" type="ct-kip:VersionType"/>
</xs:complexType>

the <CT-KIPTrigger> element is meant for the CT-KIP client, and it MAY tell the client which token identifier is going to be initialized, plus (optionally) the identifier for the key on that token. That second bit applies when you're re-seeding ๐ŸŒท The trigger always has a nonce, so the server can couple the trigger with a later CT-KIP <ClientHello> request ๐Ÿ’… The trigger MAY also contain a URL to use when contacting the CT-KIP server ๐Ÿ“ The <xs:any> elements are there for future extensibility โœจ

Any provided <TokenID> or <KeyID> values SHALL be used by the CT-KIP client in the subsequent <ClientHello> request ๐Ÿซถ The optional <TokenPlatformInfo> element tells the CT-KIP client about the characteristics of the intended token platform. It applies in the public-key variant of CT-KIP, for times when the client might need to pick one of several tokens to initialize ๐ŸŽ€

The Version attribute SHALL be set to "1.0" for this version of CT-KIP ๐Ÿงš

3.8.3. The CT-KIP Client's Initial PDU ๐Ÿฆ‹

this is the very first message the CT-KIP client sends to the CT-KIP server, so it's literally the main character moment ๐ŸŒŸ

<xs:element name="ClientHello" type="ClientHelloPDU"/>

<xs:complexType name="ClientHelloPDU">
  <xs:annotation>
    <xs:documentation xml:lang="en">
       Message sent from CT-KIP client to CT-KIP server to
       initiate a CT-KIP session.
    </xs:documentation>
  </xs:annotation>
  <xs:complexContent>
    <xs:extension base="AbstractRequestType">
      <xs:sequence>
        <xs:element name="TokenID"
          type="xs:base64Binary" minOccurs="0"/>
        <xs:element name="KeyID"
          type="xs:base64Binary" minOccurs="0"/>
        <xs:element name="ClientNonce"
          type="NonceType" minOccurs="0"/>
        <xs:element name= "TriggerNonce"
          type="NonceType" minOccurs="0"/>
        <xs:element name="SupportedKeyTypes"
          type="AlgorithmsType"/>
        <xs:element name="SupportedEncryptionAlgorithms"
          type="AlgorithmsType"/>
        <xs:element name="SupportedMACAlgorithms"
          type="AlgorithmsType"/>
        <xs:element name="Extensions"
          type="ExtensionsType" minOccurs="0"/>
      </xs:sequence>
    </xs:extension>
  </xs:complexContent>
</xs:complexType>

here's what each piece of this message means, bestie ๐Ÿซถ

  • Version (an attribute inherited from the AbstractRequestType type): the highest version of this protocol the client supports. Right now only version one ("1.0") is specified ๐ŸŒธ
  • <TokenID>: an identifier for the cryptographic token, which lets the server find things like the correct shared secret for MACing ๐Ÿ”‘ This identifier SHALL only be present if such shared secrets exist, or if the server gave the identifier in a <CT-KIPTrigger> element (see Section 4.2.7 below). In that latter case, it MUST have the same value as the identifier in that element ๐Ÿ’–
  • <KeyID>: an identifier for the key that will be overwritten if the protocol run succeeds ๐Ÿฆ‹ It SHALL only be present if the key exists or if the server provided it in a <CT-KIPTrigger> element (see Section 4.2.7 below). In that latter case, it MUST have the same value as the identifier in that element โœจ
  • <ClientNonce>: this is the nonce R. When it's present, the server SHALL use it when calculating MAC values (see below) ๐Ÿงš It is RECOMMENDED that clients include this element whenever the <KeyID> element is present ๐ŸŒˆ
  • <TriggerNonce>: this optional element SHALL be present if and only if the CT-KIP run was started with a <CT-KIPTrigger> message (see Section 4.2.7 below). In that case it SHALL have the same value as the <TriggerNonce> child of that message ๐ŸŽ€ A server using nonces this way MUST verify that the nonce is valid, and that any token or key identifier values given in the <CT-KIPTrigger> message match the matching identifier values in the <ClientHello> message. no skipping this step ๐Ÿ˜ญ
  • <SupportedKeyTypes>: a sequence of URIs listing the key types the token is willing to generate keys for through CT-KIP ๐Ÿ‘‘
  • <SupportedEncryptionAlgorithms>: a sequence of URIs listing the encryption algorithms the cryptographic token supports for CT-KIP purposes. The CT-KIP client MAY list the same algorithm as both a supported key type and an encryption algorithm ๐Ÿ“
  • <SupportedMACAlgorithms>: a sequence of URIs listing the MAC algorithms the cryptographic token supports for CT-KIP purposes. The CT-KIP client MAY list the same algorithm as both an encryption algorithm and a MAC algorithm (e.g., http://www.rsasecurity.com/rsalabs/otps/schemas/2005/12/ct-kip#ct-kip-prf-aes, defined in Appendix D) ๐Ÿ’œ
  • <Extensions>: a sequence of extensions. One extension is defined for this message in this version of CT-KIP: the ClientInfoType (see Section 3.9.1) ๐ŸŒธ

3.8.4. The CT-KIP server's initial PDU โœจ

okay so this is the first message the CT-KIP server sends to the CT-KIP client ๐Ÿ’– (unless a trigger message already kicked the protocol off, in which case this one is the second message the server sends). the server sends it when it receives a <ClientHello> message ๐ŸŽ€

<xs:element name="ServerHello" type="ServerHelloPDU"/>

<xs:complexType name="ServerHelloPDU">
  <xs:annotation>
    <xs:documentation xml:lang="en">
      Message sent from CT-KIP server to CT-KIP
      client in response to a received ClientHello
      PDU.
    </xs:documentation>
  </xs:annotation>
  <xs:complexContent>
    <xs:extension base="AbstractResponseType">
      <xs:sequence minOccurs="0">
        <xs:element name="KeyType"
          type="AlgorithmType"/>
        <xs:element name="EncryptionAlgorithm"
          type="AlgorithmType"/>
        <xs:element name="MacAlgorithm"
          type="AlgorithmType"/>
        <xs:element name="EncryptionKey"
          type="ds:KeyInfoType"/>
        <xs:element name="Payload"
          type="PayloadType"/>
        <xs:element name="Extensions"
          type="ExtensionsType" minOccurs="0"/>
        <xs:element name="Mac" type="MacType"
          minOccurs="0"/>
      </xs:sequence>
    </xs:extension>
  </xs:complexContent>
</xs:complexType>


<xs:complexType name="PayloadType">
  <xs:annotation>
    <xs:documentation xml:lang="en">
      Currently, only the nonce is defined.  In future versions,
      other payloads may be defined, e.g., for one-roundtrip
      initialization protocols.
    </xs:documentation>
  </xs:annotation>
  <xs:choice>
    <xs:element name="Nonce" type="NonceType"/>
    <any namespace="##other" processContents="strict"/>
  </xs:choice>
</xs:complexType>

<xs:complexType name="MacType">
  <xs:simpleContent>
    <xs:extension base="xs:base64Binary">
      <xs:attribute name="MacAlgorithm" type="xs:anyURI"/>
    </xs:extension>
  </xs:simpleContent>
</xs:complexType>

The components of this message have the following meaning:

  • Version: (attribute inherited from the AbstractResponseType type) ๐ŸŒธ The version selected by the CT-KIP server. It MAY be lower than the version indicated by the CT-KIP client, in which case local policy at the client will determine whether or not to continue the session.
  • SessionID: (attribute inherited from the AbstractResponseType type) ๐Ÿฆ‹ An identifier for this session.
  • Status: (attribute inherited from the abstract AbstractResponseType type) ๐Ÿ’… Return code for the <ClientHello>. If Status is not "Continue", only the Status and Version attributes will be present; otherwise, all the other elements MUST be present as well.
  • <KeyType>: The type of the key to be generated.
  • <EncryptionAlgorithm>: The encryption algorithm to use when protecting R_C.
  • <MacAlgorithm>: The MAC algorithm to be used by the CT-KIP server.
  • <EncryptionKey>: Information about the key to use when encrypting R_C. It will either be the server's public key (the <ds:KeyValue> alternative of ds:KeyInfoType) or an identifier for a shared secret key (the <ds:KeyName> alternative of ds:KeyInfoType).
  • <Payload>: The actual payload. For this version of the protocol, only one payload is defined: the pseudorandom string R_S. ๐Ÿงš
  • <Extensions>: A list of server extensions. Two extensions are defined for this message in this version of CT-KIP: the ClientInfoType and the ServerInfoType (see Section 3.9).
  • <Mac>: ๐Ÿ”ฅ This is the big one, bestie. The MAC MUST be present if the CT-KIP run will result in the replacement of an existing token key with a new one (i.e., if the <KeyID> element was present in the <ClientHello> message). In this case, the CT-KIP server MUST prove to the cryptographic token that it is authorized to replace it. The MAC value SHALL be computed on the (ASCII) string "MAC 1 computation", the client's nonce R (if sent), and the server's nonce R_S using an authentication key K_AUTH that SHOULD be a special authentication key used only for this purpose but MAY be the current K_TOKEN.

The MAC value MAY be computed by using the CT-KIP-PRF function of Section 3.4, in which case the input parameter s SHALL be set to the concatenation of the (ASCII) string "MAC 1 computation", R (if sent by the client), and R_S, and k SHALL be set to K_AUTH. The input parameter dsLen SHALL be set to the length of R_S:

dsLen = len(R_S)

MAC = CT-KIP-PRF (K_AUTH, "MAC 1 computation" || [R ||] R_S,
dsLen)

The CT-KIP client MUST verify the MAC if the successful execution of the protocol will result in the replacement of an existing token key with a newly generated one. The CT-KIP client MUST terminate the CT-KIP session if the MAC does not verify, and MUST delete any nonces, keys, and/or secrets associated with the failed run of the CT-KIP protocol. ๐Ÿ˜ญ

The MacType's MacAlgorithm attribute SHALL, when present, identify the negotiated MAC algorithm. ๐Ÿซถ


3.8.5. The CT-KIP Client's Second PDU ๐Ÿ“

this message carries the nonce picked by the cryptographic token, R_C, encrypted with the specified encryption key and encryption algorithm ๐Ÿ”

<xs:element name="ClientNonce" type="ClientNoncePDU"/>

<xs:complexType name="ClientNoncePDU">
  <xs:annotation>
    <xs:documentation xml:lang="en">
      Second message sent from CT-KIP client to
      CT-KIP server in a CT-KIP session.
    </xs:documentation>
  </xs:annotation>
  <xs:complexContent>
    <xs:extension base="AbstractRequestType">
      <xs:sequence>
        <xs:element name="EncryptedNonce"
          type="xs:base64Binary"/>
        <xs:element name="Extensions"
          type="ExtensionsType" minOccurs="0"/>
      </xs:sequence>
      <xs:attribute name="SessionID" type="IdentifierType"
        use="required"/>
    </xs:extension>
  </xs:complexContent>

</xs:complexType>

The components of this message have the following meaning:

  • Version: (inherited from the AbstractRequestType type) โœจ This SHALL be the same version as in the <ServerHello> message.
  • SessionID: ๐ŸŒˆ This SHALL have the same value as the SessionID attribute in the received <ServerHello> message.
  • <EncryptedNonce>: The nonce generated and encrypted by the token. The encryption SHALL be made using the selected encryption algorithm and identified key, and as specified in Section 3.4. ๐Ÿฆ‹
  • <Extensions>: A list of extensions. Two extensions are defined for this message in this version of CT-KIP: the ClientInfoType and the ServerInfoType (see Section 3.9). ๐Ÿ’œ

3.8.6. The CT-KIP Server's Final PDU โœจ

Okay bestie, this is the last message in a two roundtrip CT-KIP exchange ๐Ÿ’… The CT-KIP server sends it to the CT-KIP client as the reply to the <ClientNonce> message ๐Ÿซถ

<xs:element name="ServerFinished" type="ServerFinishedPDU"/>

<xs:complexType name="ServerFinishedPDU">
  <xs:annotation>
    <xs:documentation xml:lang="en">
      Final message sent from CT-KIP server to
      CT-KIP client in a CT-KIP session.
    </xs:documentation>
  </xs:annotation>
  <xs:complexContent>
    <xs:extension base="AbstractResponseType">
      <xs:sequence minOccurs="0">
        <xs:element name="TokenID"
          type="xs:base64Binary"/>
        <xs:element name="KeyID"
          type="xs:base64Binary"/>
        <xs:element name="KeyExpiryDate"
          type="xs:dateTime" minOccurs="0"/>
        <xs:element name="ServiceID"
          type="IdentifierType" minOccurs="0"/>
        <xs:element name="ServiceLogo"
          type="LogoType" minOccurs="0"/>
        <xs:element name="UserID"
          type="IdentifierType" minOccurs="0"/>

        <xs:element name="Extensions"
          type="ExtensionsType" minOccurs="0"/>
        <xs:element name="Mac"
          type="MacType"/>
      </xs:sequence>
    </xs:extension>
  </xs:complexContent>
</xs:complexType>

Here's what each part of this message means ๐ŸŽ€

  • Version: (inherited from the AbstractResponseType type) The CT-KIP version used in this session.
  • SessionID: (inherited from the AbstractResponseType type) The previously established identifier for this session.
  • Status: (inherited from the AbstractResponseType type) Return code for the <ServerFinished> message. If Status is not "Success", only the Status, SessionID, and Version attributes will be present (the presence of the SessionID attribute is dependent on the type of reported error). Otherwise, all the other elements MUST be present as well. In this latter case, the <ServerFinished> message can be seen as a "Commit" message, instructing the cryptographic token to store the generated key and associate the given key identifier with this key. ๐Ÿ”ฅ
  • <TokenID>: An identifier for the token carrying the generated key. MUST have the same value as the <TokenID> element of the <ClientHello> message, if one was provided. When assigned by the CT-KIP server, the <TokenID> element SHALL be unique within the domain of the CT-KIP server.
  • <KeyID>: An identifier for the newly generated key. The identifier SHALL be globally unique. MUST have the same value as any key identifier provided by the CT-KIP client in the <ClientHello> message.

The reason for requiring globally unique key identifiers is that it avoids potential conflicts when associating key holders with key identifiers. One way of achieving global uniqueness with reasonable certainty is to hash the combination of the issuer's fully qualified domain name with an (issuer-specific) serial number, assuming that each issuer makes sure their serial numbers never repeat. ๐Ÿงš

CT-KIP clients MUST support key identifiers at least 64 octets long. CT-KIP servers SHOULD NOT generate key identifiers longer than 64 octets.

  • <KeyExpiryDate>: This optional element provides the date and time after which the generated key should be treated as expired and invalid. โฐ
  • <ServiceID>: An optional identifier for the service that has stored the generated key. The cryptographic token may store this identifier associated with the key in order to simplify later lookups. The identifier SHALL be a printable string.
  • <ServiceLogo>: This optional element provides a graphical logo image for the service that can be displayed in user interfaces, e.g., to help a user select a certain key. The logo SHOULD contain an image within the size range of 60 pixels wide by 45 pixels high, and 200 pixels wide by 150 pixels high. The required MimeType attribute of this type provides information about the MIME type of the image. This specification supports both the JPEG and GIF image formats (with MIME types of "image/jpeg" and "image/gif"). ๐ŸŒˆ
  • <UserID>: An optional identifier for the user associated with the generated key in the authentication service. The cryptographic token may store this identifier associated with the generated key in order to enhance later user experiences. The identifier SHALL be a printable string. ๐ŸŒธ
  • <Extensions>: A list of extensions chosen by the CT-KIP server. For this message, this version of CT-KIP defines two extensions, the OTPKeyConfigurationDataType and the ClientInfoType (see Section 3.9).
  • <Mac>: To avoid a false "Commit" message causing the token to end up in an initialized state for which the server does not know the stored key, <ServerFinished> messages MUST always be authenticated with a MAC. The MAC SHALL be made using the already established MAC algorithm. The MAC value SHALL be computed on the (ASCII) string "MAC 2 computation" and R_C using an authentication key K_AUTH. Again, this SHOULD be a special authentication key used only for this purpose, but MAY also be an existing K_TOKEN. (In this case, implementations MUST protect against attacks where K_TOKEN is used to pre-compute MAC values.) If no authentication key is present in the token, and no K_TOKEN existed before the CT-KIP run, K_AUTH SHALL be the newly generated K_TOKEN. ๐Ÿ”

If CT-KIP-PRF is used as the MAC algorithm, then the input parameter s SHALL consist of the concatenation of the (ASCII) string "MAC 2 computation" and R_C, and the parameter dsLen SHALL be set to the length of R_C:

dsLen = len(R_C)

MAC = CT-KIP-PRF (K_AUTH, "MAC 2 computation" || R_C, dsLen)

When receiving a <ServerFinished> message with Status = "Success" for which the MAC verifies, the CT-KIP client SHALL associate the generated key K_TOKEN with the provided key identifier and store this data permanently. After this operation, it SHALL NOT be possible to overwrite the key unless knowledge of an authorizing key is proven through a MAC on a later <ServerHello> (and <ServerFinished>) message.

The CT-KIP client MUST verify the MAC. The CT-KIP client MUST terminate the CT-KIP session if the MAC does not verify, and MUST, in this case, also delete any nonces, keys, and/or secrets associated with the failed run of the CT-KIP protocol. ๐Ÿ’ฅ

The MacType's MacAlgorithm attribute SHALL, when present, identify the negotiated MAC algorithm.


3.9. Protocol Extensions โœจ

3.9.1. The ClientInfoType Type

When present in a <ClientHello> or a <ClientNonce> message, the optional ClientInfoType extension contains CT-KIP client-specific information. CT-KIP servers MUST support this extension. CT-KIP servers MUST NOT attempt to interpret the data it carries and, if received, MUST include it unmodified in the current protocol run's next server response. Servers need not retain the ClientInfoType's data after that response has been generated. ๐Ÿฆ‹

<xs:complexType name="ClientInfoType">
  <xs:complexContent>
    <xs:extension base="AbstractExtensionType">
      <xs:sequence>
        <xs:element name="Data"
          type="xs:base64Binary"/>
      </xs:sequence>
    </xs:extension>
  </xs:complexContent>
</xs:complexType>

3.9.2. The ServerInfoType Type

When present, the optional ServerInfoType extension contains CT-KIP server-specific information. This extension is only valid in <ServerHello> messages for which Status = "Continue". CT-KIP clients MUST support this extension. CT-KIP clients MUST NOT attempt to interpret the data it carries and, if received, MUST include it unmodified in the current protocol run's next client request (i.e., the <ClientNonce> message). CT-KIP clients need not retain the ServerInfoType's data after that request has been generated. This extension MAY be used, e.g., for state management in the CT-KIP server. ๐Ÿ“

<xs:complexType name="ServerInfoType">
  <xs:complexContent>
    <xs:extension base="AbstractExtensionType">
      <xs:sequence>
        <xs:element name="Data"
          type="xs:base64Binary"/>
      </xs:sequence>
    </xs:extension>
  </xs:complexContent>
</xs:complexType>

3.9.3. The OTPKeyConfigurationDataType Type

The optional OTPKeyConfigurationDataType extension contains additional key configuration data for OTP keys ๐Ÿ”‘

<xs:complexType name="OTPKeyConfigurationDataType">
  <xs:annotation>
    <xs:documentation xml:lang="en">
      This extension is only valid in ServerFinished
      PDUs.  It carries additional configuration data
      that an OTP token should use (subject to local
      policy) when generating OTP values with a newly
      generated OTP key.
    </xs:documentation>
  </xs:annotation>
  <xs:complexContent>
    <xs:extension base="ExtensionType">
      <xs:sequence>
        <xs:element name="OTPFormat"
          type="OTPFormatType"/>
        <xs:element name="OTPLength"
          type="xs:positiveInteger"/>
        <xs:element name="OTPMode"
          type="OTPModeType" minOccurs="0"/>

      </xs:sequence>
    </xs:extension>
  </xs:complexContent>
</xs:complexType>

This extension is only valid in <ServerFinished> messages. It carries additional configuration data that the cryptographic token SHOULD use (subject to local policy) when generating OTP values from the newly generated OTP key. Its components mean the following:

  • OTPFormat: The default format of OTPs produced with this key.
  • OTPLength: The default length of OTPs produced with this key.
  • OTPMode: The default mode of operation when producing OTPs with this key.

4. Protocol Bindings โœจ

4.1. General Requirement

CT-KIP assumes a reliable transport. ๐Ÿš›

4.2. HTTP/1.1 binding for CT-KIP

4.2.1. Introduction

This section presents a binding of the previous messages to HTTP/1.1 [7]. Note that the HTTP client normally will be different from the CT-KIP client, i.e., the HTTP client will only exist to "proxy" CT-KIP messages from the CT-KIP client to the CT-KIP server. Likewise, on the HTTP server side, the CT-KIP server may receive CT-KIP PDUs from a "front-end" HTTP server. ๐ŸŒ

4.2.2. Identification of CT-KIP Messages

The MIME-type for all CT-KIP messages SHALL be

application/vnd.otps.ct-kip+xml

4.2.3. HTTP Headers

HTTP proxies MUST NOT cache responses carrying CT-KIP messages. For this reason, the following holds ๐Ÿ™ˆ

  • When using HTTP/1.1, requesters SHOULD:
    • Include a Cache-Control header field set to "no-cache, no-store".
    • Include a Pragma header field set to "no-cache".
  • When using HTTP/1.1, responders SHOULD:
    • Include a Cache-Control header field set to "no-cache, no-must-revalidate, private".
    • Include a Pragma header field set to "no-cache".
    • NOT include a Validator, such as a Last-Modified or ETag header.

There are no other restrictions on HTTP headers, besides the requirement to set the Content-Type header value to application/vnd.otps.ct-kip+xml. ๐Ÿ’–

4.2.4. HTTP Operations

Okay bestie, so persistent connections (the HTTP/1.1 kind ๐Ÿงš) are assumed but not REQUIRED ๐ŸŒธ Every CT-KIP request gets mapped to an HTTP POST operation, and every CT-KIP response gets mapped to an HTTP response. Simple and iconic ๐Ÿ’…

4.2.5. HTTP Status Codes

Okay, this section is giving rules for when things go wrong ๐Ÿ˜ญ A CT-KIP HTTP responder that refuses to do a message exchange with a CT-KIP HTTP requester SHOULD send back a 403 (Forbidden) response. In that case the HTTP body doesn't matter at all ๐Ÿ™ˆ

If an HTTP error happens while the server is handling a CT-KIP request, the HTTP server MUST return a 500 (Internal Server Error) response. This is for HTTP-related errors caught before control gets passed to the CT-KIP processor, or when the CT-KIP processor reports an internal error. Examples are when the CT-KIP XML namespace is wrong, or the CT-KIP schema can't be found ๐Ÿ’€ If the type of a CT-KIP request can't be figured out, the CT-KIP responder MUST return a 400 (Bad request) response. Main character energy for error handling ๐ŸŽ€

When the response code is 4xx or 5xx, the HTTP body is not significant, same as above โœจ

Redirection status codes (3xx) apply as usual, nothing new there ๐Ÿฆ‹

Now the big one: whenever the HTTP POST is successfully invoked, the CT-KIP HTTP responder MUST use the 200 status code and put a suitable CT-KIP message in the HTTP body. That message can include CT-KIP error information if needed ๐Ÿซถ

4.2.6. HTTP Authentication

No support for HTTP/1.1 authentication is assumed. So we're just not going there rn ๐Ÿ™…โ€โ™€๏ธ

4.2.7. Initialization of CT-KIP

The CT-KIP server MAY initialize the CT-KIP protocol by sending an HTTP response with Content-Type set to application/vnd.otps.ct-kip+xml and the response code set to 200 (OK) ๐ŸŽ€ This could happen, for example, when a user asks for token initialization during a browsing session. The initialization message MAY carry data in its body. If it does, the data SHALL be a valid instance of a <CT-KIPTrigger> element. Very strict, very iconic ๐Ÿ‘‘

4.2.8. Example Messages

Here are the examples, bestie, let's gooo โœจ

a. Initialization from CT-KIP server:

HTTP/1.1 200 OK
Cache-Control: no-store
Content-Type: application/vnd.otps.ct-kip+xml
Content-Length: <some value>

CT-KIP initialization data in XML form...

b. Initial request from CT-KIP client:

POST http://example.com/cgi-bin/CT-KIP-server HTTP/1.1
Cache-Control: no-store
Pragma: no-cache
Host: example.com
Content-Type: application/vnd.otps.ct-kip+xml
Content-Length: <some value>

CT-KIP data in XML form (supported version, supported algorithms...)

c. Initial response from CT-KIP server:

HTTP/1.1 200 OK
Cache-Control: no-store
Content-Type: application/vnd.otps.ct-kip+xml
Content-Length: <some other value>

CT-KIP data in XML form (server random nonce, server public key, ...)

5. Security considerations ๐Ÿ”ฅ

Okay this part is SERIOUS, so pay attention, bestie ๐Ÿ™

5.1. General

CT-KIP is designed to protect generated key material from being exposed ๐Ÿ” Nobody other than the CT-KIP server and the cryptographic token gets access to a generated K_TOKEN, as long as the crypto algorithms are strong enough and the CT-KIP client generates and encrypts R_C and generates K_TOKEN exactly as specified, in the token. This holds even if malicious software is sitting on the CT-KIP client ๐Ÿ˜ˆ

BUT, and this is a big but, CT-KIP does not protect against certain other threats from man-in-the-middle attacks and other kinds of attacks, as discussed below ๐Ÿ˜ญ So when those threats are a concern, CT-KIP SHOULD, therefore, be run over a transport that gives privacy and integrity, like HTTP over Transport Layer Security (TLS) with a suitable ciphersuite. Note that TLS ciphersuites with anonymous key exchanges are not suitable for those situations ๐Ÿ™…โ€โ™€๏ธ

5.2. Active Attacks

5.2.1. Introduction

An active attacker may try to modify, delete, insert, replay or reorder messages for all kinds of reasons, including service denial and stealing generated key material ๐Ÿ’€ Sections 5.2.2 through 5.2.7 go through these attack scenarios one by one ๐Ÿง

5.2.2. Message Modifications

Changing a <CT-KIPTrigger> message will either cause denial-of-service (if you modify any of the identifiers or the nonce), or it makes the CT-KIP client contact the wrong CT-KIP server. The second one is basically a man-in-the-middle attack, and we'll get into it more in Section 5.2.7 ๐Ÿฆ‹

An attacker may modify a <ClientHello> message. That means the attacker could name a different key or token than the one the CT-KIP client meant, and could also suggest other crypto algorithms than the ones the CT-KIP client prefers, like cryptographically weaker ones ๐Ÿ˜ฌ The attacker could also suggest older versions of the CT-KIP protocol, in case those versions have known vulnerabilities. These changes could let an attacker initialize or change a different token than the intended one (so the server assigns the generated key to the wrong token), or get access to a generated key by using weak algorithms or protocol versions. To guard against the second part, CT-KIP implementations MAY protect themselves by having strict policies about which versions and algorithms they support and accept โœจ The first threat (assigning a generated key to the wrong token) is not possible with the shared-key variant of CT-KIP, as long as existing shared keys are unique per token. It IS possible in the public-key variant, though ๐Ÿ˜ญ So CT-KIP servers MUST NOT accept unilaterally provided token identifiers in the public-key variant. The protocol description says this too ๐Ÿซถ

In the shared-key variant, an attacker might still give the wrong identifier, which could also end up associating the wrong user with the generated key, but only if the attacker has real-time access to the token with the identified key. In other words, the generated key ends up with the correct token, but the token ends up with the wrong user ๐Ÿ˜ณ See Section 5.5 for more on this threat and how to counter it.

An attacker may also modify a <ServerHello> message. That means the attacker could name different key types, algorithms, or protocol versions than the legit server would, like cryptographically weaker ones. The attacker could also send a different nonce than the one the legitimate server sent. Clients protect against the first one by strictly sticking to their policies about allowed algorithms and protocol versions ๐Ÿ›ก๏ธ The second one (a wrong nonce) isn't a security problem, because the generated key won't match the key generated on the legit server anyway. Also, whenever the CT-KIP run would replace an existing key, the <Mac> element protects against changes to R_S ๐Ÿ”’

Modifying <ClientNonce> messages is possible too ๐Ÿ‘€ If an attacker changes the SessionID attribute, the server effectively switches to another session, as long as the new SessionID is valid on the server at that time. That still doesn't let the attacker learn a generated K_TOKEN, since R_C was wrapped for the legitimate server ๐Ÿ™Œ Changing the <EncryptedNonce> element, for example by swapping in a value where the attacker knows the underlying R'C, won't make the client leave its pre-CT-KIP state, because the server won't be able to produce a valid MAC in its final message to the client. The server might, however, end up storing K'TOKEN instead of K_TOKEN. If the token has been tied to a particular user, that could be a security problem ๐Ÿ˜ฑ For more on this threat and a possible countermeasure, see Section 5.5 below. Also note that using Secure Socket Layer (SSL) or TLS does NOT protect against this attack if the attacker has access to the CT-KIP client (for example through malicious software, "trojans") ๐Ÿด

Finally, attackers may also modify the <ServerFinished> message. Replacing the <Mac> element only causes denial-of-service. Replacing any other element may make the CT-KIP client associate the wrong service with the generated key, for example. CT-KIP SHOULD be run over a transport providing privacy and integrity when this is a concern ๐Ÿซถ

5.2.3. Message Deletion

Deleting messages can only cause denial-of-service and nothing worse ๐Ÿ™Œ That's because a token SHALL NOT change its state (meaning it SHALL NOT "commit" to a generated key) until it gets the final message from the CT-KIP server and successfully processes it, including checking its MAC. A deleted <ServerFinished> message won't leave the server in an inconsistent state with respect to the token, as long as the server follows the suggestions in Section 5.5 โœจ

5.2.4. Message Insertion

An active attacker can start a CT-KIP run at any time and suggest any token identifier ๐Ÿ˜ค CT-KIP server implementations may get some protection against accidentally initializing a token, accidentally replacing an existing key, or accidentally assigning a key to a token, by starting the CT-KIP run with the <CT-KIPTrigger>. The <TriggerNonce> element lets the server tie a CT-KIP run to, for example, an earlier user-authenticated session ๐Ÿ”‘ So how well this works depends on being able to protect the <TriggerNonce> element in the CT-KIP initialization message. If an eavesdropper can capture that message, they could race the legit user for a key initialization ๐Ÿƒโ€โ™€๏ธ Running CT-KIP over a transport providing privacy and integrity, together with the recommendations in Section 5.5, is RECOMMENDED when this is a concern.

Inserting other messages into an existing protocol run is treated the same as modifying legitimately sent messages ๐Ÿ”

5.2.5. Message Replay

Trying to replay a previously recorded CT-KIP message will be detected, because the use of nonces makes sure both parties are live ๐ŸŒˆ

5.2.6. Message Reordering

An attacker may try to reorder messages, but this will be detected, since each message is of a unique type ๐Ÿงฉ

5.2.7. Man in the Middle

On top of the other active attacks, an attacker posing as a man in the middle may be able to give their own public key to the CT-KIP client ๐Ÿ‘ป This threat and its countermeasures are discussed in Section 3.3. A man-in-the-middle attacker may also act as a proxy, so they might not interfere with CT-KIP runs at all but still learn valuable info. See Section 5.3 for that ๐Ÿ•ต๏ธโ€โ™€๏ธ

5.3. Passive Attacks

Passive attackers can eavesdrop on CT-KIP runs to learn stuff they can use later to impersonate users, mount active attacks, and so on ๐Ÿ‘€

If CT-KIP is not run over a transport providing privacy, a passive attacker may learn:

  • What tokens a particular user has in their possession;
  • The identifiers of keys on those tokens, and other attributes of those keys, e.g., the lifetime of the keys; and
  • CT-KIP versions and cryptographic algorithms supported by a particular CT-KIP client or server.

Whenever any of the above is a concern, CT-KIP SHOULD be run over a transport providing privacy. If man-in-the-middle attacks for the purposes described above are a concern, the transport SHOULD also offer server-side authentication ๐Ÿ”’

5.4. Cryptographic Attacks

An attacker with unlimited access to an initialized token may use the token as an "oracle" to pre-compute values that could later be used to impersonate the CT-KIP server ๐Ÿ”ฎ Sections 3.6 and 3.8 talk about this threat and the steps recommended to protect against it ๐Ÿ’–

5.5. Attacks on the Interaction between CT-KIP and User Authentication ๐Ÿ’…

Okay so, if the keys generated in CT-KIP are going to be tied to a specific user at the CT-KIP server (or at a server that the CT-KIP server trusts and talks to), there's a sneaky threat ๐Ÿ˜ญ. An attacker could swap the client's encrypted R_C for their own R'C, and that works whether the public-key or the shared-secret variant of CT-KIP is used to encrypt the client nonce. To stop that, the server should not commit to linking a generated K_TOKEN to the token (user) until the user has proven, at the same time, that they hold a token containing K_TOKEN and that they have some out-of-band authenticating info, like a temporary password ๐Ÿ”.

For example, if the token is a one-time password token, the user could be asked for a one-time password from the token and an out-of-band temporary PIN. Only then does the server "commit" to that token value for that user ๐Ÿงš. Ideally (preferably, but still!), the user does this from a different host than the one they used to set up the token, so sketchy malware on the client has less chance to mess with the process ๐Ÿ™ˆ.

Another scary one: an attacker tricks a user into logging in to them instead of the real service, and they do it before the CT-KIP run even starts ๐Ÿšจ. If that works, the attacker can pretend to be the user toward the legit service and then grab a valid CT-KIP trigger. With the public-key variant, that could let the attacker keep impersonating the user even after a successful CT-KIP run ๐Ÿ’€. So ordinary precautions must, therefore, be in place to make sure users only ever log in to legitimate services ๐Ÿซถ.


6. Intellectual Property Considerations ๐ŸŒˆ

RSA and SecurID are registered trademarks or trademarks of RSA Security Inc. in the United States and/or other countries. The names of other products and services mentioned may be the trademarks of their respective owners ๐Ÿ’œ.


7. References ๐Ÿ“š

7.1. Normative References

[1] Davis, M. and M. Duerst, "Unicode Normalization Forms", March 2001, http://www.unicode.org/unicode/reports/tr15/tr15-21.html.

7.2. Informative References

[2] RSA Laboratories, "PKCS #11 Mechanisms for the Cryptographic Token Key Initialization Protocol", PKCS #11 Version 2.20 Amendment 2, December 2005, ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-11/v2-20/pkcs-11v2-20a2.pdf.

[3] RSA Laboratories, "Cryptographic Token Interface Standard", PKCS #11 Version 2.20, June 2004, ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-11/v2-20/pkcs-11v2-20.pdf.

[4] RSA Laboratories, "Frequently Asked Questions About Today's Cryptography. Version 4.1", 2000, http://www.rsasecurity.com/rsalabs/faq/files/rsalabs_faq41.pdf.

[5] RSA Laboratories, "Password-Based Cryptography Standard", PKCS #5 Version 2.0, March 1999, ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-5v2/pkcs5v2-0.pdf.

[6] RSA Laboratories, "RSA Cryptography Standard", PKCS #1 Version 2.1, June 2002, ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-1/pkcs-1v2-1.pdf.

[7] Fielding, R., Gettys, J., Mogul, J., Frystyk, H., Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext Transfer Protocol -- HTTP/1.1", RFC 2616, June 1999.

[8] National Institute of Standards and Technology, "Specification for the Advanced Encryption Standard (AES)", FIPS 197, November 2001, http://csrc.nist.gov/publications/fips/fips197/fips-197.pdf.

[9] Krawzcyk, H., Bellare, M., and R. Canetti, "HMAC: Keyed-Hashing for Message Authentication", RFC 2104, February 1997.

[10] Iwata, T. and K. Kurosawa, "OMAC: One-Key CBC MAC. In Fast Software Encryption, FSE 2003, pages 129 - 153. Springer-Verlag", 2003, http://crypt.cis.ibaraki.ac.jp/omac/docs/omac.pdf.

[11] National Institute of Standards and Technology, "Secure Hash Standard", FIPS 197, February 2004, http://csrc.nist.gov/publications/fips/fips180-2/fips180-2withchangenotice.pdf.

[12] RSA Laboratories, "Cryptographic Token Key Initialization Protocol", OTPS Version 1.0, December 2005, ftp://ftp.rsasecurity.com/pub/otps/ct-kip/ct-kip-v1-0.pdf.


Appendix A. CT-KIP Schema ๐ŸŽ€

Here's the whole schema, copied exactly, so you can see every type and enum for yourself โœจ.

<xs:schema
  targetNamespace=
  "http://www.rsasecurity.com/rsalabs/otps/schemas/2005/12/ct-kip#"
  xmlns:xs="http://www.w3.org/2001/XMLSchema"
  xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
  xmlns=
  "http://www.rsasecurity.com/rsalabs/otps/schemas/2005/12/ct-kip#">

<xs:import namespace="http://www.w3.org/2000/09/xmldsig#"
  schemaLocation=
  "http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/
xmldsig-core-schema.xsd"/>

<!-- Basic types -->

<xs:complexType name="AbstractRequestType" abstract="true">
  <xs:attribute name="Version" type="VersionType" use="required"/>
</xs:complexType>

<xs:complexType name="AbstractResponseType" abstract="true">
  <xs:attribute name="Version" type="VersionType" use="required"/>
  <xs:attribute name="SessionID" type="IdentifierType"/>
  <xs:attribute name="Status" type="StatusCode" use="required"/>
</xs:complexType>

<xs:simpleType name="StatusCode">
  <xs:restriction base="xs:string">
    <xs:enumeration value="Continue"/>
    <xs:enumeration value="Success"/>
    <xs:enumeration value="Abort"/>
    <xs:enumeration value="AccessDenied"/>
    <xs:enumeration value="MalformedRequest"/>
    <xs:enumeration value="UnknownRequest"/>
    <xs:enumeration value="UnknownCriticalExtension"/>
    <xs:enumeration value="UnsupportedVersion"/>
    <xs:enumeration value="NoSupportedKeyTypes"/>
    <xs:enumeration value="NoSupportedEncryptionAlgorithms"/>
    <xs:enumeration value="NoSupportedMACAlgorithms"/>
    <xs:enumeration value="InitializationFailed"/>
  </xs:restriction>
</xs:simpleType>

<xs:simpleType name="VersionType">
  <xs:restriction base="xs:string">
    <xs:pattern value="\d{1,2}\.\d{1,3}"/>
  </xs:restriction>

</xs:simpleType>

<xs:simpleType name="IdentifierType">
  <xs:restriction base="xs:string">
    <xs:maxLength value="128"/>
  </xs:restriction>
</xs:simpleType>

<xs:simpleType name="NonceType">
  <xs:restriction base="xs:base64Binary">
    <xs:length value="16"/>
  </xs:restriction>
</xs:simpleType>

<xs:complexType name="LogoType">
  <xs:simpleContent>
    <xs:extension base="xs:base64Binary">
      <xs:attribute name="MimeType" type="MimeTypeType"
      use="required"/>
    </xs:extension>
  </xs:simpleContent>
</xs:complexType>

<xs:simpleType name="MimeTypeType">
  <xs:restriction base="xs:string">
    <xs:enumeration value="image/jpeg"/>
    <xs:enumeration value="image/gif"/>
  </xs:restriction>
</xs:simpleType>

<!-- Algorithms are identified through URIs -->
<xs:complexType name="AlgorithmsType">
  <xs:sequence maxOccurs="unbounded">
    <xs:element name="Algorithm" type="AlgorithmType"/>
  </xs:sequence>
</xs:complexType>

<xs:simpleType name="AlgorithmType">
  <xs:restriction base="xs:anyURI"/>
</xs:simpleType>

<xs:complexType name="MacType">
  <xs:simpleContent>
    <xs:extension base="xs:base64Binary">
      <xs:attribute name="MacAlgorithm"
      type="xs:anyURI"/>
    </xs:extension>
  </xs:simpleContent>

</xs:complexType>

<!-- CT-KIP extensions (for future use) -->
<xs:complexType name="ExtensionsType">
  <xs:sequence maxOccurs="unbounded">
    <xs:element name="Extension" type="AbstractExtensionType"/>
  </xs:sequence>
</xs:complexType>

<xs:complexType name="AbstractExtensionType" abstract="true">
  <xs:attribute name="Critical" type="xs:boolean"/>
</xs:complexType>

<xs:complexType name="ClientInfoType">
  <xs:complexContent>
    <xs:extension base="AbstractExtensionType">
      <xs:sequence>
        <xs:element name="Data" type="xs:base64Binary"/>
      </xs:sequence>
    </xs:extension>
  </xs:complexContent>
</xs:complexType>

<xs:complexType name="ServerInfoType">
  <xs:complexContent>
    <xs:extension base="AbstractExtensionType">
      <xs:sequence>
        <xs:element name="Data" type="xs:base64Binary"/>
      </xs:sequence>
    </xs:extension>
  </xs:complexContent>
</xs:complexType>

<xs:complexType name="OTPKeyConfigurationDataType">
  <xs:annotation>
    <xs:documentation xml:lang="en">
      This extension is only valid in ServerFinished PDUs.  It
      carries additional configuration data that an OTP token should
      use (subject to local policy) when generating OTP values from a
      newly generated OTP key.
    </xs:documentation>
  </xs:annotation>
  <xs:complexContent>
    <xs:extension base="AbstractExtensionType">
      <xs:sequence>
        <xs:element name="OTPFormat" type="OTPFormatType"/>
        <xs:element name="OTPLength" type="xs:positiveInteger"/>
        <xs:element name="OTPMode" type="OTPModeType" minOccurs="0"/>

      </xs:sequence>
    </xs:extension>
  </xs:complexContent>
</xs:complexType>

<xs:simpleType name="OTPFormatType">
  <xs:restriction base="xs:string">
    <xs:enumeration value="Decimal"/>
    <xs:enumeration value="Hexadecimal"/>
    <xs:enumeration value="Alphanumeric"/>
    <xs:enumeration value="Binary"/>
  </xs:restriction>
</xs:simpleType>

<xs:complexType name="OTPModeType">
  <xs:choice maxOccurs="unbounded">
    <xs:element name="Time" type="TimeType"/>
    <xs:element name="Counter"/>
    <xs:element name="Challenge"/>
    <xs:any namespace="##other" processContents="strict"/>
  </xs:choice>
</xs:complexType>

<xs:complexType name="TimeType">
  <xs:complexContent>
    <xs:restriction base="xs:anyType">
      <xs:attribute name="TimeInterval" type="xs:positiveInteger"/>
    </xs:restriction>
  </xs:complexContent>
</xs:complexType>

<xs:complexType name="PayloadType">
  <xs:annotation>
    <xs:documentation xml:lang="en">
    </xs:documentation>
  </xs:annotation>
  <xs:choice>
    <xs:element name="Nonce" type="NonceType"/>
    <xs:any namespace="##other" processContents="strict"/>
  </xs:choice>
</xs:complexType>

<xs:simpleType name="PlatformType">
  <xs:restriction base="xs:string">
    <xs:enumeration value="Hardware"/>
    <xs:enumeration value="Software"/>
    <xs:enumeration value="Unspecified"/>
  </xs:restriction>

</xs:simpleType>

<xs:complexType name="TokenPlatformInfoType">
  <xs:annotation>
    <xs:documentation xml:lang="en">
      Carries token platform information helping the client to select
      a suitable token.
    </xs:documentation>
  </xs:annotation>
  <xs:attribute name="KeyLocation" type="PlatformType"/>
  <xs:attribute name="AlgorithmLocation" type="PlatformType"/>
</xs:complexType>

<xs:complexType name="InitializationTriggerType">
  <xs:sequence>
    <xs:element name="TokenID" type="xs:base64Binary" minOccurs="0"/>
    <xs:element name="KeyID" type="xs:base64Binary" minOccurs="0"/>
    <xs:element name="TokenPlatformInfo" type="TokenPlatformInfoType"
      minOccurs="0"/>
    <xs:element name="TriggerNonce" type="NonceType"/>
    <xs:element name="CT-KIPURL" type="xs:anyURI" minOccurs="0"/>
    <xs:any namespace="##other" processContents="strict"
      minOccurs="0"/>
  </xs:sequence>
</xs:complexType>

<!-- CT-KIP PDUs -->
   <!-- CT-KIP trigger -->
   <xs:element name="CT-KIPTrigger" type="CT-KIPTriggerType"/>

   <xs:complexType name="CT-KIPTriggerType">
     <xs:annotation>
       <xs:documentation xml:lang="en">
         Message used to trigger the device to initiate a CT-KIP run.
       </xs:documentation>
     </xs:annotation>
     <xs:sequence>
       <xs:choice>
         <xs:element name="InitializationTrigger"
         type="InitializationTriggerType"/>
         <xs:any namespace="##other" processContents="strict"/>
       </xs:choice>
     </xs:sequence>
     <xs:attribute name="Version" type="VersionType"/>
   </xs:complexType>

   <!-- ClientHello PDU -->
   <xs:element name="ClientHello" type="ClientHelloPDU"/>

   <xs:complexType name="ClientHelloPDU">
     <xs:annotation>
       <xs:documentation xml:lang="en">
         Message sent from CT-KIP client to CT-KIP server to initiate an
         CT-KIP session.
       </xs:documentation>
     </xs:annotation>
     <xs:complexContent>
       <xs:extension base="AbstractRequestType">
         <xs:sequence>
           <xs:element name="TokenID" type="xs:base64Binary"
             minOccurs="0"/>
           <xs:element name="KeyID" type="xs:base64Binary"
             minOccurs="0"/>
           <xs:element name="ClientNonce" type="NonceType"
             minOccurs="0"/>
           <xs:element name="TriggerNonce" type="NonceType"
             minOccurs="0"/>
           <xs:element name="SupportedKeyTypes" type="AlgorithmsType"/>
           <xs:element name="SupportedEncryptionAlgorithms"
             type="AlgorithmsType"/>
           <xs:element name="SupportedMACAlgorithms"
             type="AlgorithmsType"/>
           <xs:element name="Extensions" type="ExtensionsType"
             minOccurs="0"/>
         </xs:sequence>
       </xs:extension>
     </xs:complexContent>
   </xs:complexType>

   <!-- ServerHello PDU -->
   <xs:element name="ServerHello" type="ServerHelloPDU"/>

   <xs:complexType name="ServerHelloPDU">
     <xs:annotation>
       <xs:documentation xml:lang="en">
         Message sent from CT-KIP server to CT-KIP client in response to
         a received ClientHello PDU.
       </xs:documentation>
     </xs:annotation>
     <xs:complexContent>
       <xs:extension base="AbstractResponseType">
         <xs:sequence minOccurs="0">
           <xs:element name="KeyType" type="AlgorithmType"/>
           <xs:element name="EncryptionAlgorithm" type="AlgorithmType"/>
           <xs:element name="MacAlgorithm" type="AlgorithmType"/>
           <xs:element name="EncryptionKey" type="ds:KeyInfoType"/>
           <xs:element name="Payload" type="PayloadType"/>
           <xs:element name="Extensions" type="ExtensionsType"
             minOccurs="0"/>
           <xs:element name="Mac" type="MacType" minOccurs="0"/>
         </xs:sequence>
       </xs:extension>
     </xs:complexContent>
   </xs:complexType>

   <!-- ClientNonce PDU -->
   <xs:element name="ClientNonce" type="ClientNoncePDU"/>

   <xs:complexType name="ClientNoncePDU">
     <xs:annotation>
       <xs:documentation xml:lang="en">
         Second message sent from CT-KIP client to CT-KIP server to
         convey the client's chosen secret.
       </xs:documentation>
     </xs:annotation>
     <xs:complexContent>
       <xs:extension base="AbstractRequestType">
         <xs:sequence>
           <xs:element name="EncryptedNonce" type="xs:base64Binary"/>
           <xs:element name="Extensions" type="ExtensionsType"
             minOccurs="0"/>
         </xs:sequence>
         <xs:attribute name="SessionID" type="IdentifierType"
           use="required"/>
       </xs:extension>
     </xs:complexContent>
   </xs:complexType>

   <!-- ServerFinished PDU -->
   <xs:element name="ServerFinished" type="ServerFinishedPDU"/>
   <xs:complexType name="ServerFinishedPDU">
     <xs:annotation>
       <xs:documentation xml:lang="en">
         Final message sent from CT-KIP server to CT-KIP client in an
         CT-KIP session.
       </xs:documentation>
     </xs:annotation>
     <xs:complexContent>
       <xs:extension base="AbstractResponseType">
         <xs:sequence minOccurs="0">
           <xs:element name="TokenID" type="xs:base64Binary"/>
           <xs:element name="KeyID" type="xs:base64Binary"/>
           <xs:element name="KeyExpiryDate" type="xs:dateTime"

             minOccurs="0"/>
           <xs:element name="ServiceID" type="IdentifierType"
             minOccurs="0"/>
           <xs:element name="ServiceLogo" type="LogoType"
             minOccurs="0"/>
           <xs:element name="UserID" type="IdentifierType"
             minOccurs="0"/>
           <xs:element name="Extensions" type="ExtensionsType"
             minOccurs="0"/>
           <xs:element name="Mac" type="MacType"/>
         </xs:sequence>
       </xs:extension>
     </xs:complexContent>
   </xs:complexType>

   </xs:schema>

Appendix B. Examples of CT-KIP Messages โœจ

B.1. Introduction

okay so all the examples are syntactically correct ๐Ÿ’… but the MAC and cipher values are fictitious, fr ๐Ÿ™ˆ The examples walk through a complete CT-KIP exchange, starting with the initialization (trigger) message from the server ๐Ÿฆ‹

B.2. Example of a CT-KIP Initialization (Trigger) Message

   <CT-KIPTrigger
     xmlns=
     "http://www.rsasecurity.com/rsalabs/otps/schemas/2005/12/ct-kip#"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     Version="1.0">
     <InitializationTrigger>
       <TokenID>12345678</TokenID>
       <TriggerNonce>112dsdfwf312asder394jw==</TriggerNonce>
     </InitializationTrigger>
   </CT-KIPTrigger>

B.3. Example of a <ClientHello> Message

   <?xml version="1.0" encoding="UTF-8"?>
   <ClientHello
     xmlns=
     "http://www.rsasecurity.com/rsalabs/otps/schemas/2005/12/ct-kip#"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     Version="1.0">
     <TokenID>12345678</TokenID>

    <TriggerNonce>112dsdfwf312asder394jw==</TriggerNonce>
     <SupportedKeyTypes>
       <Algorithm>http://www.rsasecurity.com/rsalabs/otps/schemas
   /2005/09/otps-wst#SecurID-AES</Algorithm>
     </SupportedKeyTypes>
     <SupportedEncryptionAlgorithms>
       <Algorithm>http://www.w3.org/2001/04/xmlenc#rsa-1_5</Algorithm>
       <Algorithm>http://www.rsasecurity.com/rsalabs/otps/schemas/
   2005/12/ct-kip#ct-kip-prf-aes</Algorithm>
     </SupportedEncryptionAlgorithms>
     <SupportedMACAlgorithms>
       <Algorithm>http://www.rsasecurity.com/rsalabs/otps/schemas/
   2005/12/ct-kip#ct-kip-prf-aes</Algorithm>
     </SupportedMACAlgorithms>
   </ClientHello>

B.4. Example of a <ServerHello> Message

   <?xml version="1.0" encoding="UTF-8"?>
   <ServerHello
     xmlns=
   "http://www.rsasecurity.com/rsalabs/otps/schemas/2005/12/ct-kip#"
     xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     Version="1.0" SessionID="4114" Status="Success">
     <KeyType>http://www.rsasecurity.com/rsalabs/otps/schemas/2005/09/
   otps-wst#SecurID-AES</KeyType>
     <EncryptionAlgorithm>http://www.rsasecurity.com/rsalabs/otps/
   schemas/2005/12/ct-kip#ct-kip-prf-aes</EncryptionAlgorithm>
     <MacAlgorithm>http://www.rsasecurity.com/rsalabs/otps/schemas/
   2005/12/ct-kip#ct-kip-prf-aes</MacAlgorithm>
     <EncryptionKey>
       <ds:KeyName>KEY-1</ds:KeyName>
     </EncryptionKey>
     <Payload>
       <Nonce>qw2ewasde312asder394jw==</Nonce>
     </Payload>
   </ServerHello>

B.5. Example of a <ClientNonce> Message

   <?xml version="1.0" encoding="UTF-8"?>
   <ClientNonce
     xmlns="http://www.rsasecurity.com/rsalabs/otps/schemas/
   2005/12/ct-kip#"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     Version="1.0" SessionID="4114">
     <EncryptedNonce>vXENc+Um/9/NvmYKiHDLaErK0gk=</EncryptedNonce>

   </ClientNonce>

B.6. Example of a <ServerFinished> Message

   <?xml version="1.0" encoding="UTF-8"?>
   <ServerFinished
     xmlns="http://www.rsasecurity.com/rsalabs/otps/schemas/
   2005/12/ct-kip#"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     Version="1.0" SessionID="4114" Status="Success">
     <TokenID>12345678</TokenID>
     <KeyExpiryDate>2009-09-16T03:02:00Z</KeyExpiryDate>
     <KeyID>43212093</KeyID>
     <ServiceID>Example Enterprise Name</ServiceID>
     <UserID>exampleLoginName</UserID>
     <Extensions>
       <Extension xsi:type="OTPKeyConfigurationDataType">
         <OTPFormat>Decimal</OTPFormat>
         <OTPLength>6</OTPLength>
         <OTPMode><Time/></OTPMode>
       </Extension>
     </Extensions>
     <Mac>miidfasde312asder394jw==</Mac>
   </ServerFinished>

Appendix C. Integration with PKCS #11 ๐ŸŽ€

okay so a CT-KIP client that needs to talk to a connected cryptographic token to run a CT-KIP exchange may use PKCS #11 [3] as its programming interface ๐Ÿงš When you do CT-KIP with a cryptographic token through the PKCS #11 programming interface, the procedure in [2], Appendix B, is recommended ๐Ÿ’œ

Appendix D. Example CT-KIP-PRF Realizations ๐ŸŒˆ

D.1. Introduction

this example appendix defines CT-KIP-PRF in terms of AES [8] and HMAC [9] ๐Ÿ“

D.2. CT-KIP-PRF-AES

D.2.1. Identification

for tokens supporting this realization of CT-KIP-PRF, the following URI may be used to identify this algorithm in CT-KIP:

   http://www.rsasecurity.com/rsalabs/otps/schemas/2005/12/
   ct-kip#ct-kip-prf-aes

when this URI is used to identify the encryption algorithm to use, the method for encryption of R_C values described in Section 3.6 shall be used โœจ

D.2.2. Definition

here's the big one, the CT-KIP-PRF-AES definition ๐Ÿ‘‘

   CT-KIP-PRF-AES (k, s, dsLen)

   Input:

   k     encryption key to use

   s     octet string consisting of randomizing material.  The length of
         the string s is sLen.

   dsLen desired length of the output

   Output:

   DS    a pseudorandom string, dsLen-octets long

   Steps:

   1.  Let bLen be the output block size of AES in octets:

       bLen = (AES output block length in octets)

       (normally, bLen = 16)

   2.  If dsLen > (2**32 - 1) * bLen, output "derived data too long" and
       stop

   3.  Let n be the number of bLen-octet blocks in the output data,
       rounding up, and let j be the number of octets in the last block:

       n = ROUND( dsLen / bLen )

       j = dsLen - (n - 1) * bLen

   4.  For each block of the pseudorandom string DS, apply the function
       F defined below to the key k, the string s and the block index to
       compute the block:

       B1 = F (k, s, 1) ,

       B2 = F (k, s, 2) ,
       ...

       Bn = F (k, s, n)

   The function F is defined in terms of the OMAC1 construction from
   [10], using AES as the block cipher:

   F (k, s, i) = OMAC1-AES (k, INT (i) || s)

   where INT (i) is a four-octet encoding of the integer i, most
   significant octet first, and the output length of OMAC1 is set to
   bLen.

   Concatenate the blocks and extract the first dsLen octets to produce
   the desired data string DS:

   DS = B1 || B2 || ... || Bn<0..j-1>

   Output the derived data DS.

D.2.3. Example

let's say dsLen = 16, then the math goes like this ๐Ÿงฎ

   n = 16 / 16 = 1

   j = 16 - (1 - 1) * 16 = 16

   DS = B1 = F (k, s, 1) = OMAC1-AES (k, INT (1) || S)

D.3. CT-KIP-PRF-SHA256

D.3.1. Identification

for tokens supporting this realization of CT-KIP-PRF, the following URI may be used to identify this algorithm in CT-KIP:

   http://www.rsasecurity.com/rsalabs/otps/schemas/2005/12/
   ct-kip#ct-kip-prf-sha256

when this URI is used to identify the encryption algorithm to use, the method for encryption of R_C values described in Section 3.6 shall be used ๐Ÿ’–

D.3.2. Definition ๐Ÿ’…

Okay bestie, here's the actual recipe for CT-KIP-PRF-SHA256 โœจ

CT-KIP-PRF-SHA256 (k, s, dsLen)

Inputs: ๐ŸŽ€

  • k is the encryption key to use
  • s is an octet string made of randomizing material. Its length is sLen
  • dsLen is the desired length of the output

Output: ๐Ÿฆ‹

  • DS is a pseudorandom string that is dsLen-octets long

Steps: ๐Ÿ”ฅ

  1. Let bLen be the output size in octets of SHA-256 [11]. No truncation happens to the HMAC output:
bLen = 32
  1. If dsLen > (2**32 - 1) bLen, output "derived data too long" and stop.
  2. Let n be the number of bLen-octet blocks in the output data, rounding up. Let j be the number of octets in the last block:
n = ROUND ( dsLen / bLen )

j = dsLen - (n - 1) * bLen
  1. For each block of the pseudorandom string DS, apply the function F (defined below) to the key k, the string s, and the block index to compute that block:
B1 = F (k, s, 1) ,

B2 = F (k, s, 2) ,

...

Bn = F (k, s, n)

The function F is built on the HMAC construction from [9], with SHA-256 as the digest algorithm:

F (k, s, i) = HMAC-SHA256 (k, INT (i) || s)

Here, INT (i) is a four-octet encoding of the integer i, most significant octet first, and the output length of HMAC is set to bLen.

  1. Concatenate the blocks and grab the first dsLen octets to make the final data string DS:
DS = B1 || B2 || ... || Bn<0..j-1>
  1. Output the derived data DS. Slay โœจ

D.3.3. Example ๐ŸŒธ

Let's say sLen = 256 (that's two 128-octet long values) and dsLen = 16. Then:

n = ROUND ( 16 / 32 ) = 1

j = 16 - (1 - 1) * 32 = 16

B1 = F (k, s, 1) = HMAC-SHA256 (k, INT (1) || s )

DS = B1<0 ... 15>

Basically, the result is just the first 16 octets of the HMAC output ๐Ÿฅน๐Ÿ’–


Appendix E. About OTPS ๐Ÿงš

The One-Time Password Specifications are documents produced by RSA Laboratories, working together with secure systems developers. The goal is to make it easier to integrate and manage strong authentication technology in secure applications, and to make the user experience of that technology better ๐ŸŒˆ

Further development of the OTPS series will happen through mailing list discussions and the occasional workshop. Suggestions for improvement are welcome ๐Ÿ’œ Just like our PKCS documents, results may also get submitted to standards forums. For more info, contact:

OTPS Editor
RSA Laboratories
174 Middlesex Turnpike
Bedford, MA  01730 USA
otps-editor@rsasecurity.com
http://www.rsasecurity.com/rsalabs/

Author's Address ๐Ÿ–‹๏ธ

Magnus Nystroem
RSA Security

EMail: magnus@rsasecurity.com

Copyright (C) The IETF Trust (2006).

This document is subject to the rights, licenses and restrictions contained in BCP 78. Except as set forth there, the authors retain all their rights.

This document and the information contained herein are provided on an "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY, THE IETF TRUST, AND THE INTERNET ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.

Intellectual Property ๐Ÿ”

The IETF doesn't take a position on whether any Intellectual Property Rights or other rights claimed to cover the technology in this document are valid or in scope. It also doesn't say whether a license for those rights is or isn't available. And it hasn't independently tried to find any such rights ๐Ÿ™ˆ For info on how rights work for RFC documents, check out BCP 78 and BCP 79.

Copies of IPR disclosures made to the IETF Secretariat, plus any assurances of licenses that will be available, or the results of an attempt to get a general license or permission to use those proprietary rights for implementers or users of this spec, can be found in the IETF's online IPR repository at:

http://www.ietf.org/ipr

The IETF invites anyone interested to bring to its attention any copyrights, patents, patent applications, or other proprietary rights that might cover technology required to implement this standard. Send that info to the IETF at:

ietf-ipr@ietf.org

Acknowledgement ๐Ÿซถ

Funding for the RFC Editor function is currently provided by the Internet Society. Thank you, Internet Society ๐Ÿ’

๐Ÿ“ฆ where this page comes from