RFC 6063

Dynamic Symmetric Key Provisioning Protocol (DSKPP)

๐Ÿ“… published December 2010, from ietf

RFC 6063: Dynamic Symmetric Key Provisioning Protocol (DSKPP) โœจ

Part 1 of 23 ๐ŸŽ€

Okay bestie, this RFC is the spec for DSKPP (Dynamic Symmetric Key Provisioning Protocol), and it's giving serious networking glow-up ๐Ÿ’…. It's a Standards Track document from the IETF (Internet Engineering Task Force), dated December 2010, with ISSN 2070-1721 ๐Ÿฆ‹.

The four authors are A. Doherty (RSA, The Security Division of EMC), M. Pei (VeriSign, Inc.), S. Machani (Diversinet Corp.), and M. Nystrom (Microsoft Corp.) ๐Ÿซถ. There's no Obsoletes or Updates line in this header, so it doesn't replace or change any earlier RFC ๐ŸŒธ.

Abstract ๐Ÿ’œ

So DSKPP is a client-server protocol for setting up (and configuring) symmetric keys on cryptographic modules, whether those modules are right next to you or somewhere far away ๐Ÿงš. It works with or without private key capabilities in the module, and with or without a public key infrastructure already in place. Iconic flexibility ๐Ÿ‘‘.

It comes in two flavours for different use cases โœจ. The four-pass variant is the mutual-generation one: the provisioning server and the cryptographic module generate the keys together, and the provisioned keys never travel over-the-wire or over-the-air ๐Ÿ”ฅ. The two-pass variant is the speedy download-and-install one, where pre-generated symmetric keys get delivered to a cryptographic module securely and efficiently ๐Ÿš€.

Status of This Memo ๐ŸŒˆ

This is an Internet Standards Track document ๐Ÿ’–.

It's a product of the Internet Engineering Task Force (IETF), so it represents the consensus of the IETF community ๐Ÿซถ. It got public review and was approved for publication by the Internet Engineering Steering Group (IESG) โญ. For more on Internet Standards, check out Section 2 of RFC 5741 ๐Ÿ“š.

Info about this document's current status, any errata, and how to send feedback lives at http://www.rfc-editor.org/info/rfc6063 ๐Ÿ“.

Copyright (c) 2010 IETF Trust and the persons identified as the document authors. All rights reserved ๐ŸŽ€.

This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (http://trustee.ietf.org/license-info) as they stand on the date this document was published. Please read these carefully, because they spell out your rights and restrictions for this document ๐Ÿ™ˆ. Code Components pulled out of this document must include Simplified BSD License text, as described in Section 4.e of the Trust Legal Provisions, and they come without warranty, as described in the Simplified BSD License โš–๏ธ.

Heads up, this part is legal stuff but it matters: this document may contain material from IETF Documents or IETF Contributions published or made publicly available before November 10, 2008. The people who control the copyright in some of that material may not have given the IETF Trust permission to allow modifications outside the IETF Standards Process. Unless you get an adequate license from those copyright holders, this document may not be modified outside the IETF Standards Process, and derivative works of it may not be created outside the IETF Standards Process. The only exceptions are formatting it for publication as an RFC or translating it into languages other than English ๐Ÿ’….

Table of Contents ๐ŸŽ€

   1. Introduction ....................................................6
      1.1. Key Words ..................................................6
      1.2. Version Support ............................................6
      1.3. Namespace Identifiers ......................................7
           1.3.1. Defined Identifiers .................................7
           1.3.2. Identifiers Defined in Related Specifications .......7
           1.3.3. Referenced Identifiers ..............................8
   2. Terminology .....................................................8
      2.1. Definitions ................................................8
      2.2. Notation ..................................................10
      2.3. Abbreviations .............................................11
   3. DSKPP Overview .................................................11
      3.1. Protocol Entities .........................................12
      3.2. Basic DSKPP Exchange ......................................12
           3.2.1. User Authentication ................................12
           3.2.2. Protocol Initiated by the DSKPP Client .............14
           3.2.3. Protocol Triggered by the DSKPP Server .............16
           3.2.4. Variants ...........................................17
                  3.2.4.1. Criteria for Using the Four-Pass Variant ..17
                  3.2.4.2. Criteria for Using the Two-Pass Variant ...18
      3.3. Status Codes ..............................................18
      3.4. Basic Constructs ..........................................20
           3.4.1. User Authentication Data (AD) ......................20
                  3.4.1.1. Authentication Code Format ................20
                  3.4.1.2. User Authentication Data Calculation ......23
           3.4.2. The DSKPP One-Way Pseudorandom Function,
                  DSKPP-PRF ..........................................24
           3.4.3. The DSKPP Message Hash Algorithm ...................24
   4. Four-Pass Protocol Usage .......................................25
      4.1. The Key Agreement Mechanism ...............................25
           4.1.1. Data Flow ..........................................25
           4.1.2. Computation ........................................27
      4.2. Message Flow ..............................................28
           4.2.1. KeyProvTrigger .....................................28
           4.2.2. KeyProvClientHello .................................29
           4.2.3. KeyProvServerHello .................................30
           4.2.4. KeyProvClientNonce .................................32
           4.2.5. KeyProvServerFinished ..............................34
   5. Two-Pass Protocol Usage ........................................35
      5.1. Key Protection Methods ....................................36
           5.1.1. Key Transport ......................................36
           5.1.2. Key Wrap ...........................................37
           5.1.3. Passphrase-Based Key Wrap ..........................37
      5.2. Message Flow ..............................................38
           5.2.1. KeyProvTrigger .....................................38
           5.2.2. KeyProvClientHello .................................39
           5.2.3. KeyProvServerFinished ..............................43
   6. Protocol Extensions ............................................44
      6.1. The ClientInfoType Extension ..............................45
      6.2. The ServerInfoType Extension ..............................45
   7. Protocol Bindings ..............................................45
      7.1. General Requirements ......................................45
      7.2. HTTP/1.1 Binding for DSKPP ................................46
           7.2.1. Identification of DSKPP Messages ...................46
           7.2.2. HTTP Headers .......................................46
           7.2.3. HTTP Operations ....................................47
           7.2.4. HTTP Status Codes ..................................47
           7.2.5. HTTP Authentication ................................47
           7.2.6. Initialization of DSKPP ............................47
           7.2.7. Example Messages ...................................48
   8. DSKPP XML Schema ...............................................49
      8.1. General Processing Requirements ...........................49
      8.2. Schema ....................................................49
   9. Conformance Requirements .......................................58
   10. Security Considerations .......................................59
      10.1. General ..................................................59
      10.2. Active Attacks ...........................................60
           10.2.1. Introduction ......................................60
           10.2.2. Message Modifications .............................60
           10.2.3. Message Deletion ..................................61
           10.2.4. Message Insertion .................................62
           10.2.5. Message Replay ....................................62
           10.2.6. Message Reordering ................................62
           10.2.7. Man in the Middle .................................63
      10.3. Passive Attacks ..........................................63
      10.4. Cryptographic Attacks ....................................63
      10.5. Attacks on the Interaction between DSKPP and User
            Authentication ...........................................64
      10.6. Miscellaneous Considerations .............................65
           10.6.1. Client Contributions to K_TOKEN Entropy ...........65
           10.6.2. Key Confirmation ..................................65
           10.6.3. Server Authentication .............................65
           10.6.4. User Authentication ...............................66
           10.6.5. Key Protection in Two-Pass DSKPP ..................66
           10.6.6. Algorithm Agility .................................67
   11. Internationalization Considerations ...........................68
   12. IANA Considerations ...........................................68
      12.1. URN Sub-Namespace Registration ...........................68
      12.2. XML Schema Registration ..................................69
      12.3. MIME Media Type Registration .............................69
      12.4. Status Code Registration .................................70
      12.5. DSKPP Version Registration ...............................70
      12.6. PRF Algorithm ID Sub-Registry ............................70
           12.6.1. DSKPP-PRF-AES .....................................71
           12.6.2. DSKPP-PRF-SHA256 ..................................71
      12.7. Key Container Registration ...............................72
   13. Intellectual Property Considerations ..........................73
   14. Contributors ..................................................73
   15. Acknowledgements ..............................................73
   16. References ....................................................74
      16.1. Normative References .....................................74
      16.2. Informative References ...................................76
   Appendix A.  Usage Scenarios ......................................78
     A.1.  Single Key Request ........................................78
     A.2.  Multiple Key Requests .....................................78
     A.3.  User Authentication .......................................78
     A.4.  Provisioning Time-Out Policy ............................78
     A.5.  Key Renewal ...............................................79
     A.6.  Pre-Loaded Key Replacement ..............................79
     A.7.  Pre-Shared Manufacturing Key ............................79
     A.8.  End-to-End Protection of Key Material ...................80
   Appendix B.  Examples .............................................80
     B.1.  Trigger Message ...........................................80
     B.2.  Four-Pass Protocol ......................................81
       B.2.1.  <KeyProvClientHello> without a Preceding Trigger ......81
       B.2.2.  <KeyProvClientHello> Assuming a Preceding Trigger .....82
       B.2.3.  <KeyProvServerHello> Without a Preceding Trigger ......83
       B.2.4.  <KeyProvServerHello> Assuming Key Renewal .............84
       B.2.5.  <KeyProvClientNonce> Using Default Encryption .........85
       B.2.6.  <KeyProvServerFinished> Using Default Encryption ......85
     B.3.  Two-Pass Protocol .......................................86
       B.3.1.  Example Using the Key Transport Method ................86
       B.3.2.  Example Using the Key Wrap Method .....................90
       B.3.3.  Example Using the Passphrase-Based Key Wrap Method ..94
   Appendix C.  Integration with PKCS #11 ............................98
     C.1.  The Four-Pass Variant ...................................98
     C.2.  The Two-Pass Variant ....................................98
   Appendix D.  Example of DSKPP-PRF Realizations .................101
     D.1.  Introduction .............................................101
     D.2.  DSKPP-PRF-AES ..........................................101
       D.2.1.  Identification .......................................101
       D.2.2.  Definition ...........................................101
       D.2.3.  Example ..............................................102
     D.3.  DSKPP-PRF-SHA256 .......................................103
       D.3.1.  Identification .......................................103
       D.3.2.  Definition ...........................................103
       D.3.3.  Example ..............................................104

1. Introduction ๐Ÿ’–

Symmetric-key-based crypto systems (think one-time passwords and challenge-response, e.g.) give you real performance and operational perks over public key schemes โœจ. But using them needs a way to provision symmetric keys that does the same job that the Certificate Management Protocol (CMP) [RFC4210] and Certificate Management over CMS (CMC) [RFC5272] do inside a Public Key Infrastructure. Lowkey essential ๐Ÿซถ.

Traditionally, cryptographic modules got their keys during device manufacturing, and those keys were imported into the crypto server using, for example, a CD-ROM disc shipped with the devices ๐Ÿ’€. Some vendors also have proprietary provisioning protocols that often never got publicly documented. The Cryptographic Token Key Initialization Protocol (CT-KIP) is one exception [RFC4758] ๐ŸŒธ.

This document describes the Dynamic Symmetric Key Provisioning Protocol (DSKPP) ๐Ÿฆ‹. It's a client-server protocol for provisioning symmetric keys between a cryptographic module (that's the DSKPP Client) and a key provisioning server (that's the DSKPP Server). Main character energy ๐Ÿ‘‘.

DSKPP gives you an open and interoperable way to initialize and configure symmetric keys on cryptographic modules that are reachable over the Internet ๐ŸŒˆ. It's based on the information in [RFC4758], but adds specific enhancements, like user authentication and support for the [RFC6030] format for transmitting keying material. Iconic glow-up ๐Ÿ”ฅ.

DSKPP has two principal protocol variants, and they're giving different vibes ๐Ÿงš. The four-pass variant lets you establish a symmetric key that includes randomness contributed by both the client and the server ๐Ÿ’œ. The two-pass variant only needs one round trip instead of two, and it lets you establish a key that the server specifies ๐Ÿ“.

1.1. Key Words ๐Ÿ”‘

okay so these are the BCP 14 key words, the little magic words that tell you how strict to be ๐Ÿ’… in this doc, "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" are to be read as described in [RFC2119] ๐Ÿ“–


1.2. Version Support ๐ŸŽ€

there's a spot in the syntax for an explicit version number โœจ right now, only version "1.0" is specified, so that's the only one you'll see ๐Ÿฆ‹

why bother versioning at all? it's giving future-proofing ๐Ÿ”ฎ it lets changes to required cryptographic algorithms (e.g., SHA-256) and attributes (e.g., key size) roll out without breaking existing implementations. and outdated implementations can be retired without wrecking operations that use the newer versions ๐Ÿซถ

the numbering scheme is "<major>.<minor>" ๐ŸŒˆ the major and minor numbers MUST be treated as separate integers, and each number MAY be incremented higher than a single digit. so "DSKPP 2.4" is lower than "DSKPP 2.13", which is lower than "DSKPP 12.3" ๐Ÿ˜ญ leading zeros (e.g., "DSKPP 6.01") MUST be ignored by recipients and MUST NOT be sent ๐Ÿ™ˆ

the major number should only go up if the data formats or security algorithms changed so dramatically that an older version can't interoperate with a newer one ๐Ÿ’€ (e.g., removing support for a previously mandatory-to-implement algorithm that's now found to be insecure) ๐Ÿ”ฅ

the minor number is for new capabilities (e.g., introducing a new algorithm option) โœจ it MUST be ignored by an entity with a smaller minor version number, but the entity with the larger minor version number uses it for informational purposes ๐Ÿ‘‘


1.3. Namespace Identifiers ๐ŸŒธ

this document uses Uniform Resource Identifiers (URIs) [RFC3986] to identify resources, algorithms, and semantics ๐Ÿงš

1.3.1. Defined Identifiers ๐Ÿ’œ

the XML namespace [XMLNS] URI for Version 1.0 of DSKPP is "urn:ietf:params:xml:ns:keyprov:dskpp" ๐Ÿ“

references to qualified elements in the DSKPP schema defined here use the prefix "dskpp", but any prefix is allowed ๐ŸŽ€

this document relies on qualified elements already defined in the Portable Symmetric Key Container [RFC6030] namespace. it's represented by the prefix "pskc" and declared as:

xmlns:pskc="urn:ietf:params:xml:ns:keyprov:pskc"

1.3.3. Referenced Identifiers ๐ŸŒท

finally, the DSKPP syntax in this document relies on algorithm identifiers defined in the XML Signature [XMLDSIG] namespace ๐Ÿง

xmlns:ds="http://www.w3.org/2000/09/xmldsig#"

references to algorithm identifiers in the XML Signature namespace are represented by the prefix "ds" ๐Ÿ’–


2. Terminology ๐Ÿ“š

2.1. Definitions ๐Ÿ’…

the terms below are defined as they're used in this document ๐Ÿ“ the same terms might be defined differently in other documents, so don't be surprised if you see them somewhere else ๐Ÿ‘€

  • Authentication Code (AC): the User Authentication Code ๐Ÿ” a string of hexadecimal characters that both the device and the server know, containing at a minimum a client identifier and a password. this ClientID/password combo is used only once, may have a time limit, and then gets discarded ๐Ÿ’จ
  • Authentication Data (AD): the User Authentication Data that's derived from the Authentication Code (AC) ๐Ÿ—๏ธ
  • Client ID: an identifier the DSKPP Server uses to locate the real username or account identifier on the server ๐Ÿ•ต๏ธ it can be a short random identifier that's unrelated to any real usernames ๐ŸŽฒ
  • Cryptographic Module: a component of an application that enables symmetric key cryptographic functionality ๐Ÿงฉ
  • Device: a physical piece of hardware, or a software framework, that hosts symmetric key cryptographic modules ๐Ÿ“ฑ
  • Device ID (DeviceID): a unique identifier for the device that houses the cryptographic module, e.g., a mobile phone ๐Ÿ“ฒ
  • DSKPP Client: manages communication between the symmetric key cryptographic module and the DSKPP Server ๐Ÿค
  • DSKPP Server: the symmetric key provisioning server that participates in the DSKPP run ๐Ÿ–ฅ๏ธ
  • DSKPP Server ID (ServerID): the unique identifier of a DSKPP Server ๐Ÿชช
  • Key Agreement: a key establishment protocol where two or more parties can agree on a key in such a way that both influence the outcome ๐Ÿค
  • Key Confirmation: the assurance, for the rightful participants in a key-establishment protocol, that the intended recipient of the shared key actually possesses the shared key โœ…
  • Key Issuer: an organization that issues symmetric keys to end-users ๐Ÿข
  • Key Package (KP): an object that encapsulates a symmetric key and its configuration data ๐Ÿ“ฆ
  • Key ID (KeyID): a unique identifier for the symmetric key ๐Ÿ”‘
  • Key Protection Method (KPM): the key transport method used during two-pass DSKPP ๐Ÿ›ก๏ธ
  • Key Protection Method List (KPML): the list of key protection methods a cryptographic module supports ๐Ÿ“‹
  • Key Provisioning Server: a lifecycle management system that gives a key issuer the ability to provision keys to cryptographic modules hosted on end-users' devices ๐Ÿš€
  • Key Transport: a key establishment procedure where the DSKPP Server selects and encrypts the keying material, then sends the material to the DSKPP Client [NIST-SP800-57] ๐Ÿšš
  • Key Transport Key: the private key that resides on the cryptographic module ๐Ÿ”’ it's paired with the DSKPP Client's public key, which the DSKPP Server uses to encrypt keying material during key transport [NIST-SP800-57] ๐Ÿ—๏ธ
  • Key Type: the type of symmetric key cryptographic method the key will be used for (e.g., Open AUTHentication HMAC-Based One-Time Password (OATH HOTP) or RSA SecurID authentication, AES encryption, etc.) ๐ŸŽฏ
  • Key Wrapping: a method of encrypting keys for key transport [NIST-SP800-57] ๐ŸŽ
  • Key Wrapping Key: a symmetric key encrypting key used for key wrapping [NIST-SP800-57] ๐ŸŽ€
  • Keying Material: the data necessary (e.g., keys and key configuration data) necessary to establish and maintain cryptographic keying relationships [NIST-SP800-57] ๐Ÿง 
  • Manufacturer's Key: a unique master key pre-issued to a hardware device, e.g., a smart card, during the manufacturing process ๐Ÿญ if it's present, a cryptographic module may use this key to derive secret keys ๐Ÿช„
  • Protocol Run: a complete execution of the DSKPP, involving one exchange (two-pass) or two exchanges (four-pass) ๐Ÿƒโ€โ™€๏ธ
  • Security Attribute List (SAL): a payload that contains the DSKPP version, DSKPP variant (four- or two-pass), key package formats, key types, and the cryptographic algorithms the cryptographic module is capable of supporting ๐Ÿงพ

2.2. Notation ๐Ÿงฎ

here's the notation table, kept exactly as-is ๐Ÿ’–

||                    String concatenation
[x]                   Optional element x
A ^ B                 Exclusive-OR operation on strings A and B
                      (where A and B are of equal length)
<XMLElement>          A typographical convention used in the body of
                      the text
DSKPP-PRF(k,s,dsLen)  A keyed pseudorandom function
E(k,m)                Encryption of m with the key k
K                     Key used to encrypt R_C (either K_SERVER or
                      K_SHARED), or in MAC or DSKPP_PRF computations
K_AC                  Secret key that is derived from the
                      Authentication Code and used for user
                      authentication purposes
K_MAC                 Secret key derived during a DSKPP exchange for
                      use with key confirmation
K_MAC'                A second secret key used for server
                      authentication
K_PROV                A provisioning master key from which two keys
                      are derived: K_TOKEN and K_MAC
K_SERVER              Public key of the DSKPP Server; used for
                      encrypting R_C in the four-pass protocol
                      variant

K_SHARED              Secret key that is pre-shared between the DSKPP
                      Client and the DSKPP Server; used for
                      encrypting R_C in the four-pass protocol
                      variant
K_TOKEN               Secret key that is established in a
                      cryptographic module using DSKPP
R                     Pseudorandom value chosen by the DSKPP Client
                      and used for MAC computations
R_C                   Pseudorandom value chosen by the DSKPP Client
                      and used as input to the generation of K_TOKEN
R_S                   Pseudorandom value chosen by the DSKPP Server
                      and used as input to the generation of K_TOKEN
URL_S                 DSKPP Server address, as a URL

2.3. Abbreviations ๐Ÿ”ค

AC      Authentication Code
AD      Authentication Data
DSKPP   Dynamic Symmetric Key Provisioning Protocol
HTTP    Hypertext Transfer Protocol
KP      Key Package
KPM     Key Protection Method
KPML    Key Protection Method List
MAC     Message Authentication Code
PC      Personal Computer
PDU     Protocol Data Unit
PKCS    Public Key Cryptography Standards
PRF     Pseudorandom Function
PSKC    Portable Symmetric Key Container
SAL     Security Attribute List (see Section 2.1)
TLS     Transport Layer Security
URL     Uniform Resource Locator
USB     Universal Serial Bus
XML     eXtensible Markup Language

3. DSKPP Overview ๐ŸŽ€

the next sub-sections give a high-level look at the protocol's internals and how they interact with external provisioning applications โœจ usage scenarios are in Appendix A ๐Ÿฆ‹

3.1. Protocol Entities ๐Ÿ‘ฏ

a DSKPP provisioning transaction has three entities ๐Ÿซถ

  • Server: the DSKPP provisioning server.
  • Cryptographic Module: the cryptographic module the symmetric keys are being provisioned to, e.g., an authentication token ๐Ÿ”
  • Client: the DSKPP Client, which manages communication between the cryptographic module and the key provisioning server ๐Ÿ“ก

the principal syntax is XML [XML], and it's layered on a transport mechanism such as HTTP [RFC2616] and HTTP Over TLS [RFC2818] ๐ŸŒ it's highly desirable for the entire communication between the DSKPP Client and server to be protected by a transport that provides confidentiality and integrity protection, such as HTTP over Transport Layer Security (TLS) ๐Ÿ”’ but that protection isn't enough to protect the exchange of symmetric key data between the server and the cryptographic module, so DSKPP is designed to permit implementations that satisfy this requirement ๐Ÿ’…

the server only talks to the client. as far as the server is concerned, the client and cryptographic module may be considered a single entity ๐Ÿคทโ€โ™€๏ธ

from a client-side security perspective, though, the client and the cryptographic module are separate logical entities ๐Ÿง  and in some implementations they may be separate physical entities too ๐Ÿ”ง

it's assumed that a device will host an application layered above the cryptographic module, and this application will manage communication between the DSKPP Client and the cryptographic module ๐Ÿ“ฒ how that application moves DSKPP elements to and from the cryptographic module is transparent to the DSKPP Server ๐Ÿ•ถ๏ธ one method for this transfer is described in [CT-KIP-P11] ๐Ÿ“–

3.2. Basic DSKPP Exchange ๐Ÿงšโ€โ™€๏ธ

3.2.1. User Authentication ๐Ÿ”

Okay so picture this: a user just got a shiny new hardware or software device with a cryptographic module tucked inside ๐ŸŽ€. DSKPP's whole job is to get the same symmetric key and related info onto that module AND onto the key management server, and then link the key to the right username (or other account identifier) on the server ๐Ÿ’–. Before any of that counts, the DSKPP Server MUST authenticate the user, to be sure they're actually authorized for the new key ๐Ÿซถ.

User authentication happens inside the protocol itself after the DSKPP Client starts the first message. In this case, the DSKPP Client MUST have access to the DSKPP Server URL ๐Ÿฆ‹.

Or, a DSKPP web service (or any other web app) can authenticate the user before the first message is sent. Then the DSKPP Server MUST trigger the DSKPP Client to start the first message in the protocol transaction โœจ.


3.2.2. Protocol Initiated by the DSKPP Client ๐ŸŒธ

In this example, the DSKPP Client kicks things off first, and then the user gets authenticated with a Client ID and an Authentication Code ๐Ÿ’….

Crypto       DSKPP                          DSKPP    Key Provisioning
Module       Client                         Server        Server
 |             |                              |             |
 |             |                              |     +---------------+
 |             |                              |     |Server creates |
 |             |                              |     |and stores     |
 |             |                              |     |Client ID and  |
 |             |                              |     |Auth. Code and |
 |             |                              |     |delivers them  |
 |             |                              |     |to user out-of-|
 |             |                              |     |band.          |
 |             |                              |     +---------------+
 |             |                              |             |
 |  +----------------------+                  |             |
 |  |User enters Client ID,|                  |             |
 |  |Auth. Code, and URL   |                  |             |
 |  +----------------------+                  |             |
 |             |                              |             |
 |             |<-- 1. TLS handshake with --->|             |
 |             |        server auth.          |             |
 |             |                              |             |
 |             | 2. <KeyProvClientHello> ---->|     User -->|
 |             |                              |     Auth.   |
 |             |<-- [3. <KeyProvServerHello>] |             |
 |             |                              |             |
 |             | [4. <KeyProvClientNonce>] -->|             |
 |             |                              |             |
 |             |<- 5. <KeyProvServerFinished> |             |
 |             |                              |             |
 |             |                              |             |
 |<-- Key      |                              |      Key -->|
 |    Package  |                              |   Package   |

Figure 1: Basic DSKPP Exchange

Before DSKPP even begins, a few things need to be true ๐Ÿ“:

  • The Authentication Code is generated by the DSKPP Server, and gets delivered to the user through an out-of-band trustworthy channel (think a paper slip handed over by IT department staff ๐Ÿ“„).
  • The user usually types the Client ID and Authentication Code in by hand, maybe on a device with nothing but a numeric keypad ๐Ÿ”ข. That's why they're often short numeric values (for example, 8 decimal digits). BUT the DSKPP Server is totally free to generate them in any way it wants ๐Ÿ‘‘.
  • The DSKPP Client needs the URL [RFC3986] of the DSKPP Server (which isn't user specific or secret, and may be pre-configured somehow ๐Ÿคซ), plus a set of trust anchors for checking the server certificate.
  • There must be an account for the user, with an identifier and long-term username (or other account identifier) that the token will be tied to. The DSKPP Server uses the Client ID to find the matching Authentication Code for user authentication ๐Ÿงš.

In Step 1, the client sets up a TLS connection and authenticates the server. That means it validates the certificate and compares the host name in the URL with the certificate, as described in Section 3.1 of [RFC2818] ๐Ÿ”.

Next, the DSKPP Client and DSKPP Server swap DSKPP messages (which travel over HTTPS). In these messages:

  • The client and server negotiate which cryptographic algorithms they want to use, which algorithms are supported for protecting DSKPP messages, and other DSKPP details ๐Ÿค“.
  • The client sends the Client ID to the server, and proves that it knows the matching Authentication Code ๐Ÿ™Œ.
  • The client and server agree on a secret key (token key, or K_TOKEN). Depending on the negotiated protocol variant, this is either a fresh key derived during the DSKPP run (called "four-pass variant", since it involves four DSKPP messages) or is generated by (or already exists on) the server and gets transported to the client (called "two-pass variant" in the rest of this document, since it involves two DSKPP messages) ๐Ÿ”‘.
  • The server sends a "key package" to the client. In the "two-pass variant", the package only includes the key itself. With either variant, the key package holds attributes that influence how the provisioned key gets used later by the cryptographic module and the cryptographic server ๐Ÿ’œ. The exact contents depend on the cryptographic algorithm. For example, a one-time password algorithm that supports variable-length OTP values would have the length of the OTP value as one attribute in the key package ๐Ÿ”ข.

Once the protocol run finishes successfully, the cryptographic module stores the contents of the key package โœจ. The DSKPP provisioning server also stores the key package contents with the cryptographic server, and ties them to the correct username ๐ŸŽ€. Now the user can use their device to do symmetric-key based operations ๐Ÿฅณ.

Who does what between the cryptographic module and the DSKPP Client (and between the key provisioning server and the DSKPP Server) isn't specified in this document. The figure above shows one possible setup, but it's just there for illustration ๐Ÿฆ‹.


3.2.3. Protocol Triggered by the DSKPP Server ๐ŸŒˆ

In the first message flow (the previous section), the Client ID and Authentication Code got to the client through some out-of-band method, like paper handed to the user ๐Ÿ“œ.

Web           DSKPP                          DSKPP            Web
Browser       Client                         Server          Server
  |              |                              |               |
  |<-------- HTTPS browsing + some kind of user auth. --------->|
  |              |                              |               |
  | some HTTP request ----------------------------------------->|
  |              |                              |
  |              |                              |<------------->|
  |              |                              |               |
  |<----------------------- HTTP response with <KeyProvTrigger> |
  |              |                              |               |
  | Trigger ---->|                              |               |
  |              |                              |               |
  |              |<-- 1. TLS handshake with --->|               |
  |              |        server auth.          |               |
  |              |                              |               |
  |              |     ... continues...         |               |

Figure 2: DSKPP Exchange with Web-Based Authentication

In the second message flow, the user signs in to a web server first (say, an IT department's "self-service" Intranet page) using a regular web browser and some existing credentials ๐Ÿ’ป.

Then the user asks for a new key to be provisioned to the cryptographic module, by clicking a link or submitting a form ๐Ÿ–ฑ๏ธ. The web server replies with a <KeyProvTrigger> message that contains the Client ID, Authentication Code, and URL of the DSKPP Server. The DSKPP Server needs this info too. How the web server and DSKPP Server talk to each other is out of scope for this document ๐Ÿ™ˆ.

The <KeyProvTrigger> message rides along in an HTTP response, and it's marked with the MIME type application/dskpp+xml. The web browser is assumed to be set up to recognize this MIME type. It'll start the DSKPP Client and hand it the <KeyProvTrigger> message ๐Ÿš€.

From there, the DSKPP Client contacts the DSKPP Server and uses the Client ID and Authentication Code (from the <KeyProvTrigger> message) in the same way as the first message flow ๐Ÿ’….


3.2.4. Variants ๐Ÿฆ„

As we mentioned in the last section, once the protocol has started, the client and server MAY do either a two-pass or a four-pass message exchange ๐Ÿ’œ. The two protocols suit different deployment scenarios. The biggest difference is that the two-pass protocol supports transporting an existing key to a cryptographic module, while the four-pass one generates the key on the fly through key agreement ๐Ÿ”‘. Either way, both variants support algorithm agility, since the encryption mechanisms and key types get negotiated at the start of each protocol run ๐ŸŒŸ.

3.2.4.1. Criteria for Using the Four-Pass Variant ๐ŸŽฏ

The four-pass protocol is needed under one or more of the following conditions:

  • Policy requires that both parties engaged in the protocol jointly contribute entropy to the key. Enforcing this policy reduces the risk of exposing a key during provisioning, because the key is generated through mutual agreement and never gets transferred over-the-air or over-the-wire ๐Ÿ”’. It also reduces the risk of exposure after provisioning, since the key won't be vulnerable to a single point of attack in the system ๐Ÿ›ก๏ธ.
  • A cryptographic module does not have private key capabilities ๐Ÿ™….
  • The cryptographic module is hosted by a device that was neither pre-issued with a manufacturer's key or other form of pre-shared key (as might be the case with a smart card or Subscriber Identity Module (SIM) card), nor has a keypad for entering a passphrase (like the ones on a mobile phone) ๐Ÿ“ฑ.

3.2.4.2. Criteria for Using the Two-Pass Variant ๐ŸŽ€

The two-pass protocol is needed under one or more of the following conditions:

  • Pre-existing (i.e., legacy) keys must be provisioned via transport to the cryptographic module ๐Ÿ—๏ธ.
  • The cryptographic module is hosted on a device that was pre-issued with a manufacturer's key (like one that may exist on a smart card), or some other form of pre-shared key (like one that may exist on a SIM card), and it's capable of performing private key operations ๐Ÿ’ช.
  • The cryptographic module is hosted by a device with a built-in keypad where a user can type in a passphrase. That's useful for deriving a key wrapping key for distributing keying material ๐Ÿง.

3.3. Status Codes โœจ

okay so this part is all about the status codes, and bestie, they decide whether a DSKPP run lives or dies ๐Ÿ’€. if the Status attribute is anything other than "Success" or "Continue", the default is that both the DSKPP Server and the DSKPP Client MUST immediately terminate the DSKPP run, unless it's explicitly said otherwise below ๐Ÿšซ. and the cleanup is serious: DSKPP Servers and DSKPP Clients MUST delete any secret values generated during failed runs ๐Ÿ”. session identifiers MAY be kept from successful or failed runs for replay detection purposes ๐Ÿ•ต๏ธโ€โ™€๏ธ, but those kept identifiers MUST NOT be reused for later runs. no recycling, periodt ๐Ÿ™…โ€โ™€๏ธ.

when it's possible, the DSKPP Client SHOULD show the user an appropriate error message ๐Ÿ’ฌ. be kind to your users, babe ๐Ÿซถ.

these status codes are valid in all DSKPP Response messages, unless explicitly stated otherwise ๐Ÿ“ฌ:

  • Continue: the DSKPP Server is ready for the next request from the DSKPP Client. it can't be sent in the server's final message ๐Ÿ”.
  • Success: the DSKPP session finished successfully. it can only be sent in the server's final message ๐ŸŽ‰.
  • Abort: the DSKPP Server turned down the DSKPP Client's request for unspecified reasons ๐Ÿ™ˆ.
  • AccessDenied: the DSKPP Client isn't authorized to contact this DSKPP Server ๐Ÿšช.
  • MalformedRequest: the DSKPP Server couldn't parse the DSKPP Client's request ๐Ÿงฉ.
  • UnknownRequest: the DSKPP Client made a request the DSKPP Server doesn't know ๐Ÿคทโ€โ™€๏ธ.
  • UnknownCriticalExtension: a DSKPP extension marked as "Critical" couldn't be interpreted by the receiving party ๐Ÿšจ.
  • UnsupportedVersion: the DSKPP Client used a DSKPP version the DSKPP Server doesn't support. this one is only valid in the DSKPP Server's first response message ๐Ÿ”ข.
  • NoSupportedKeyTypes: "NoSupportedKeyTypes" means the DSKPP Client only suggested key types the DSKPP Server doesn't support. only valid in the DSKPP Server's first response message ๐Ÿ”‘.
  • NoSupportedEncryptionAlgorithms: the DSKPP Client only suggested encryption algorithms the DSKPP Server doesn't support. only valid in the DSKPP Server's first response message ๐Ÿ”’.
  • NoSupportedMacAlgorithms: the DSKPP Client only suggested MAC algorithms the DSKPP Server doesn't support. only valid in the DSKPP Server's first response message ๐Ÿงพ.
  • NoProtocolVariants: the DSKPP Client didn't suggest a required protocol variant (either two-pass or four-pass). only valid in the DSKPP Server's first response message ๐Ÿ”€.
  • NoSupportedKeyPackages: the DSKPP Client only suggested key package formats the DSKPP Server doesn't support. only valid in the DSKPP Server's first response message ๐Ÿ“ฆ.
  • AuthenticationDataMissing: the DSKPP Client didn't provide Authentication Data the DSKPP Server required ๐Ÿซฅ.
  • AuthenticationDataInvalid: the DSKPP Client gave User Authentication Data the DSKPP Server couldn't validate โŒ.
  • InitializationFailed: the DSKPP Server couldn't generate a valid key from the data it was given. when this comes through, the DSKPP Client SHOULD try to restart DSKPP, since a new run might totally work ๐Ÿ”„โœจ.
  • ProvisioningPeriodExpired: the provisioning period set by the DSKPP Server has run out โฐ. when this comes through, the DSKPP Client SHOULD report the reason for the key initialization failure to the user, and the user MUST register with the DSKPP Server to initialize a new key ๐Ÿ“. main character energy, but make it a re-registration arc ๐Ÿ’€.

3.4. Basic Constructs ๐Ÿงฑ

the following calculations get used in both DSKPP variants, so they're the building blocks ๐Ÿงš.

3.4.1. User Authentication Data (AD) ๐Ÿ”

User Authentication Data (AD) is derived from a Client ID and Authentication Code that the user enters before the first DSKPP message is sent ๐Ÿ‘€.

Note: The user will typically enter the Client ID and Authentication Code manually, possibly on a device with only numeric keypad. Thus, they are often short numeric values (for example, 8 decimal digits). However, the DSKPP Server is free to generate them in any way it wishes.

ngl this is so relatable. nobody wants to type a novel on a numeric keypad ๐Ÿ“ฑ๐Ÿ™„. the server can make them however it likes though ๐ŸŽจ.

3.4.1.1. Authentication Code Format ๐Ÿงฎ

AC is encoded in Type-Length-Value (TLV) format. it's a minimum of two TLVs plus a variable number of extra TLVs, depending on the implementation ๐Ÿงƒ.

the TLV fields are defined like this ๐Ÿ‘‡:

Type (1 character)        A hexadecimal character identifying the
                          type of information contained in the Value
                          field.

Length (2 characters)     Two hexadecimal characters indicating the
                          length of the Value field to follow.  The
                          field value MAY be up to 255 characters.
                          The Length value 00 MAY be used to specify
                          custom tags without any field values.

Value (variable length)   A variable-length string of hexadecimal
                          characters containing the instance-specific
                          information for this TLV.

the TLVs defined in this document are summarized in the table below ๐Ÿ“Š. optional TLVs are allowed for vendor-specific extensions, but the high bit MUST be set to show it's a vendor-specific type ๐Ÿท๏ธ. everything else is saved for later revisions of the protocol ๐Ÿ”ฎ.

   +------+------------+-------------------------------------------+
   | Type | TLV Name   | Conformance | Example Usage               |
   +------+------------+-------------------------------------------+
   |  1   | Client ID  | Mandatory   | { "AC00000A" }              |
   +------+------------+-------------+-----------------------------+
   |  2   | Password   | Mandatory   | { "3582AF0C3E" }            |
   +------+------------+-------------+-----------------------------+
   |  3   | Checksum   | Optional    | { "4D5" }                   |
   +------+------------+-------------+-----------------------------+

the Client ID is a mandatory TLV that holds the requester's identifier, max length 255 ๐Ÿชช. the value is a string of hexadecimal characters that identifies the key request. for example, if the Client ID is "AC00000A", the Client ID TLV in the AC is written as "108AC00000A" ๐Ÿ’….

the Password is a mandatory TLV that holds a one-time-use shared secret known by the user and the Provisioning Server ๐Ÿคซ. the Password value is unique, and it SHOULD be a random string so the AC is harder to guess ๐ŸŽฒ. the string MUST contain hexadecimal characters only ๐Ÿ”ข. for example, if the password is "3582AF0C3E", the Password TLV would be "20A3582AF0C3E" ๐Ÿซง.

the Checksum is an OPTIONAL TLV that the issuing server generates and sends to the user as part of the AC โœ…. if the TLV is provided, the checksum value MUST be computed using the CRC16 algorithm [ISO3309]. when the user types in the AC, the typed string gets checked against the checksum to make sure it was entered correctly ๐Ÿง. for example, if the AC with the combined Client ID tag and Password tag is "108AC00000A20A3582AF0C3E", the CRC16 calculation generates a checksum of 0x356, so the Checksum TLV is "334D5". the full AC string in this example is "108AC00000A20A3582AF0C3E3034D5" ๐ŸŽ€.

this spec recommends using hexadecimal characters only for the AC at the application's user interface layer, and keeping the TLV triples non-transparent to the user like in the example above ๐Ÿ™ˆ. implementations MAY additionally choose to use other printable Unicode characters [UNICODE] at the application's user interface layer to meet local, context, or usability needs ๐ŸŒ. when non-hexadecimal characters are wanted at the UI layer, like other printable US-ASCII characters or international characters, SASLprep [RFC4013] MUST be used to normalize the user input before it's converted into a string of hexadecimal characters โš ๏ธ.

here's an example of that ๐Ÿง. say an app lets you use any printable US-ASCII characters and extended ASCII characters for the Client ID and Password fields. the Client ID is "myclient!D" and the Password is "mYpas&#rD". the user types a Client ID of "myclient!D" and a Password of "mYpas&#rD" into separate form fields, or as the provider instructs. the application's layer that processes user input MUST then convert those values into the following string for use in the protocol: "1146D79636C69656E7421442126D5970617326237244". (note that in this example, the Checksum TLV isn't added ๐Ÿ™ƒ.)

here's the example broken down step by step ๐Ÿ”:

Assume that the raw Client ID value, or the value entered by the use, is: myclient!ID

The Client ID value as character names is:

U+006D LATIN SMALL LETTER M character
U+0079 LATIN SMALL LETTER Y character
U+0063 LATIN SMALL LETTER C character
U+006C LATIN SMALL LETTER L character
U+0069 LATIN SMALL LETTER I character
U+0065 LATIN SMALL LETTER E character
U+006E LATIN SMALL LETTER N character
U+0074 LATIN SMALL LETTER T character
U+0021 EXCLAMATION MARK character (!)
U+0044 LATIN CAPITAL LETTER D character

The UTF-8 conversion of the Client ID value is: 6D 79 63 6C 69 65 6E 74 21 44

The length of the Client ID value in hexadecimal characters is: 14

The TLV presentation of the Client ID field is: 1146D79636C69656E742144

The raw Password value, or the value entered by the user, is: mYpas&#rD

The Password value as character names is:

U+006D LATIN SMALL LETTER M character
U+0059 LATIN LARGE LETTER Y character
U+0070 LATIN SMALL LETTER P character
U+0061 LATIN SMALL LETTER A character
U+0073 LATIN SMALL LETTER S character
U+0026 AMPERSAND character (&)
U+0023 POUND SIGN character (#)
U+0072 LATIN SMALL LETTER R character
U+0044 LATIN LARGE LETTER D character

The UTF-8 conversion of the password value is: 6D 59 70 61 73 26 23 72 44

The length of the password value in hexadecimal characters is: 12

The TLV presentation of the password field is: 2126D5970617326237244

The combined Client ID and password fields value, or the AC value, is: 1146D79636C69656E7421442126D5970617326237244 ๐ŸŽ‰

3.4.1.2. User Authentication Data Calculation โœจ

Okay, bestie, the Authentication Data (AD) is basically a pair: a Client ID that gets pulled out of the AC, plus a value cooked up from the AC. ๐ŸŽ€ For the deep dive on DSKPP-PRF, check Section 3.4.2, and for the AES flavour, see Appendix D. ๐Ÿ’…

MAC = DSKPP-PRF(K_AC, AC->ClientID||URL_S||R_C||[R_S], 16)

In four-pass DSKPP, the cryptographic module mixes R_C, R_S, and URL_S to make the MAC. URL_S is just the URL the DSKPP Client uses to reach the DSKPP Server. ๐ŸŒธ In two-pass DSKPP, the module can't see R_S, so it only uses R_C together with URL_S. Either way, K_AC MUST be derived from AC->password like this [PKCS-5]:

K_AC = PBKDF2(AC->password, R_C || K, iter_count, 16)

Now, K has to be one of these, and one of them MUST be used:

  • a. In four-pass:
    • The public key of the DSKPP Server (K_SERVER), or (in the pre-shared key variant) the pre-shared key between the client and the server (K_SHARED).
  • b. In two-pass:
    • The public key of the DSKPP Client, or the public key of the device when a device certificate is available.
    • The pre-shared key between the client and the server (K_SHARED).
    • A passphrase-derived key.

The iteration count, iter_count, MUST be set to at least 100,000, except in the last two two-pass cases (where K is K_SHARED or a passphrase-derived key). In those cases, iter_count MUST be set to 1. ๐Ÿ™ˆ


3.4.2. The DSKPP One-Way Pseudorandom Function, DSKPP-PRF ๐Ÿฆ‹

Whatever protocol variant you're running, you need a cryptographic primitive that takes a secret key k and a varying-length octet string s and deterministically spits out a bit string of a specific length, dsLen. ๐Ÿงš

This primitive must meet the same requirements as a keyed hash function: it MUST take an arbitrary-length input and generate an output that is one way and collision free (for definitions of those terms, see, e.g., [FAQ]). On top of that, its output MUST be unpredictable even if other outputs for the same key are known. ๐Ÿ”ฅ

From this spec's point of view, DSKPP-PRF is a "black-box" function. You give it the inputs and it gives you a pseudorandom value. It MAY be realized by any appropriate and competent cryptographic technique. Appendix D has two example realizations. ๐Ÿ’œ

DSKPP-PRF(k, s, dsLen)

Input:

k     secret key in octet string format
s     octet string of varying length consisting of variable data
      distinguishing the particular string being derived
dsLen desired length of the output

Output:

DS    pseudorandom string, dsLen octets long

For the purposes of this document, the secret key k MUST be at least 16 octets long. ๐Ÿ‘‘


3.4.3. The DSKPP Message Hash Algorithm ๐Ÿ“

When the DSKPP Server sends its last message in a protocol run, it generates a MAC that the client uses for key confirmation. That MAC MUST include a hash of all DSKPP messages sent by the client and server during the transaction. ๐Ÿ˜ญ To compute a message hash for the MAC from a sequence of DSKPP messages msg_1, ..., msg_n, you MUST carry out these steps:

  • a. The sequence of messages contains all DSKPP Request and Response messages up to but not including this message.
  • b. Re-transmitted messages are removed from the sequence of messages.
    • Note: The resulting sequence of messages MUST be an alternating sequence of DSKPP Request and DSKPP Response messages.
  • c. The contents of each message are concatenated together.
  • d. The resultant string is hashed using SHA-256 in accordance with [FIPS180-SHA].

4. Four-Pass Protocol Usage ๐ŸŒˆ

This section covers the methods and message flow that make up the four-pass protocol variant. Four-pass DSKPP leans on a client-server key agreement mechanism. ๐Ÿ’–

4.1. The Key Agreement Mechanism ๐Ÿฆ‹

With four-pass DSKPP, the symmetric key being provisioned is generated on the fly and never actually gets transferred between the DSKPP Client and the DSKPP Server. Here's how the data flow and computation go. โœจ

4.1.1. Data Flow

Figure 3 shows a sample data flow for key generation during the four-pass protocol. ๐ŸŽ€

+----------------------+                  +----------------------+
|    +------------+    |                  |                      |
|    | Server key |    |                  |                      |
| +<-|  Public    |------>------------->-------------+---------+ |
| |  |  Private   |    |                  |          |         | |
| |  +------------+    |                  |          |         | |
| |        |           |                  |          |         | |
| V        V           |                  |          V         V |
| |   +---------+      |                  |        +---------+ | |
| |   | Decrypt |<-------<-------------<-----------| Encrypt | | |
| |   +---------+      |                  |        +---------+ | |
| |      |  +--------+ |                  |            ^       | |
| |      |  | Server | |                  |            |       | |
| |      |  | Random |--->------------->------+  +----------+  | |
| |      |  +--------+ |                  |   |  | Client   |  | |
| |      |      |      |                  |   |  | Random   |  | |
| |      |      |      |                  |   |  +----------+  | |
| |      |      |      |                  |   |        |       | |
| |      V      V      |                  |   V        V       | |
| |   +------------+   |                  | +------------+     | |
| +-->|  DSKPP PRF |   |                  | |  DSKPP PRF |<----+ |
|     +------------+   |                  | +------------+       |
|           |          |                  |       |              |
|           V          |                  |       V              |
|       +-------+      |                  |   +-------+          |
|       |  Key  |      |                  |   |  Key  |          |
|       +-------+      |                  |   +-------+          |
|       +-------+      |                  |   +-------+          |
|       |Key Id |-------->------------->------|Key Id |          |
|       +-------+      |                  |   +-------+          |
+----------------------+                  +----------------------+
      DSKPP Server                              DSKPP Client

 Figure 3: Principal Data Flow for DSKPP Key Generation Using Public
                             Server Key

Both random nonces (R_S and R_C) feed into key generation. That gives both sides (the cryptographic module and the DSKPP Server) proof that they each added to the key's randomness, and that the key is unique. ๐Ÿซถ The encryption key (K) is there to make sure no man in the middle is hanging around. If one is, the cryptographic module ends up with a key that's different from the one the legit DSKPP Server stored. ๐Ÿ’€

Conceptually, R_C is one pseudorandom string, but you can think of it as two parts, R_C1 and R_C2. R_C1 gets generated during the protocol run. R_C2 can be pre-generated and loaded onto the cryptographic module before the device is handed to the user. In that case, R_C2 SHOULD be unique for each cryptographic module. ๐Ÿ”ฅ

Now, the drama: a man in the middle (in the form of corrupt client software or a server you mistakenly contacted) may present their own public key to the cryptographic module. That lets the attacker learn the client's version of K_TOKEN. ๐Ÿ˜ฑ But they can't convince the legit server to derive the same K_TOKEN, because K_TOKEN depends on the public key involved, and the attacker's public key has to be different from the correct server's (otherwise the attacker couldn't decrypt what the client sent). So once the attacker stops being "in the middle," the client and server will notice they're "out of sync" when they try to use their keys. ๐Ÿ™ˆ When it comes to encrypting R_C with K_SERVER, it's super important to verify that K_SERVER really is the legit server's key. One way to do that is to independently validate a newly generated K_TOKEN against some validation service at the server (for example, over a connection separate from the one used for key generation). ๐Ÿ›ก๏ธ

4.1.2. Computation

In four-pass DSKPP, the client and server both generate K_TOKEN and K_MAC by deriving them from a provisioning key (K_PROV), using DSKPP-PRF (see Section 3.4.2). It goes like this: ๐Ÿงฎ

K_PROV = DSKPP-PRF(k,s,dsLen), where

    k = R_C (i.e., the secret random value chosen by the DSKPP
    Client)
    s = "Key generation" || K || R_S (where K is the key used to
    encrypt R_C and R_S is the random value chosen by the DSKPP
    Server)
    dsLen = (desired length of K_PROV whose first half constitutes
    K_MAC and second half constitutes K_TOKEN)

Then, K_TOKEN and K_MAC are derived from K_PROV, where

    K_PROV = K_MAC || K_TOKEN

When computing K_PROV, the derived keys (K_MAC and K_TOKEN) MAY be put through an algorithm-dependent transform before being adopted as a key of the selected type. One example is the parity needed for DES keys. ๐ŸŽ€

Heads up: this computation applies to four-pass DSKPP only. ๐Ÿ’…

4.2. Message Flow ๐Ÿฆ‹

The four-pass protocol flow has two message exchanges, lowkey like a little duet: ๐ŸŽถ

1:  Pass 1 = <KeyProvClientHello>, Pass 2 = <KeyProvServerHello>
2:  Pass 3 = <KeyProvClientNonce>, Pass 4 = <KeyProvServerFinished>

The first pair of messages negotiates the cryptographic algorithms and exchanges nonces. The second pair establishes a symmetric key using mutually authenticated key agreement. โœจ

Each message's purpose and content are described below. For the XML format and examples, see Section 8 and Appendix B. ๐ŸŒธ

4.2.1. KeyProvTrigger โœจ

Okay bestie, this is the "hey, go start a session" ping ๐Ÿ“ฃ. The DSKPP Server sends it, and it's the moment the key provisioning system hands the client its marching orders ๐Ÿ’…

           DSKPP Client                         DSKPP Server
           ------------                         ------------
                                [<---]       AD, [DeviceID],
                                            [KeyID], [URL_S]

When this message is sent: The "trigger" message is optional ๐ŸŒธ. The DSKPP Server sends it after these out-of-band steps happen:

  1. A user opens their browser to a key provisioning web app and signs in (aka authenticates) ๐Ÿ”
  2. The user requests a key ๐Ÿ—๏ธ
  3. The web app processes that request and returns an Authentication Code to the user, e.g., in response to an enrollment request over a secure web session ๐Ÿ’Œ
  4. The web app grabs the Authentication Code from the user (maybe they type it into a web form, or they tap a URL that has the code embedded) ๐Ÿ‘†
  5. The web app derives Authentication Data (AD) from the Authentication Code, as described in Section 3.4.1 ๐Ÿงฎ
  6. The web app passes AD, plus possibly a DeviceID (which identifies the particular device the key should be provisioned to) and/or a KeyID (which identifies a key that's about to get replaced) to the DSKPP Server ๐ŸŽ€

Purpose of this message: Okay this one's giving multitasking ๐Ÿฆ‹. It starts a DSKPP session, because the DSKPP Server uses it to trigger the client-side app to send the first DSKPP message. It also gets the DSKPP Server URL over to the DSKPP Client, so the key provisioning system can point the client at a specific cryptographic module that was pre-configured in the DSKPP provisioning server ๐Ÿงš. And for key renewal, it's how you identify the key being replaced ๐Ÿ”„.

What is contained in this message: AD MUST be provided so the DSKPP Server can authenticate the user before the protocol run finishes ๐Ÿ”ฅ. A DeviceID MAY be included so the key provisioning app can bind the provisioned key to a specific device ๐Ÿ“ฑ. A KeyID MAY be included so the app can tell which key to replace, like during key renewal ๐Ÿ”. The Server URL MAY be included so the app can tell the DSKPP Client which server to contact ๐ŸŒˆ.

4.2.2. KeyProvClientHello โœจ

This is the client's big intro, the "hi, here's everything I can do" message ๐Ÿ’–.

           DSKPP Client                         DSKPP Server
           ------------                         ------------
           SAL, [AD],
           [DeviceID], [KeyID]     --->

When this message is sent: When a DSKPP Client first connects to a DSKPP Server, it is required to send the <KeyProvClientHello> as its first message ๐Ÿฅ‡. The client can also send a <KeyProvClientHello> in response to a <KeyProvTrigger> โœจ.

What is contained in this message: The Security Attribute List (SAL) is the client's wishlist. It lists the combinations of DSKPP versions, variants, key package formats, key types, and cryptographic algorithms the client supports, ordered by the client's preference (favorite choice first) ๐Ÿ’…๐Ÿ“.

If <KeyProvClientHello> came after a <KeyProvTrigger>, then this message MUST also include the Authentication Data (AD), DeviceID, and/or KeyID that came with the trigger ๐Ÿซถ.

If <KeyProvClientHello> did not come after a <KeyProvTrigger>, then this message MAY contain a DeviceID that was pre-shared with the DSKPP Server, and a key ID tied to a key that the DSKPP provisioning server provisioned earlier ๐ŸŒธ.

Application note: If a <KeyProvTrigger> came first, the app already has AD on hand (see Section 4.2.1) ๐Ÿ™Œ. But if there was no trigger, the app MUST retrieve the User Authentication Code, possibly by prompting the user to type it in manually, like on a device that only has a numeric keypad ๐Ÿ”ข. That's giving real main character energy for the keypad-only device ๐Ÿ˜ญ.

The application MUST also derive Authentication Data (AD) from the Authentication Code, as described in Section 3.4.1, and save it for its next message, <KeyProvClientNonce> ๐Ÿ’พ.

How the DSKPP Server uses this message: The DSKPP Server hunts for an acceptable combination of DSKPP version, variant (in this case, four-pass), key package format, key type, and cryptographic algorithms ๐Ÿ•ต๏ธโ€โ™€๏ธ. If the client's SAL doesn't match what the server can do, or it breaks key provisioning policy, the server sets the Status attribute to something other than "Continue" ๐Ÿ™…โ€โ™€๏ธ. Otherwise, the Status attribute gets set to "Continue" โœ….

If it's included in <KeyProvClientHello>, the DSKPP Server will validate the Authentication Data (AD), DeviceID, and KeyID ๐Ÿ”. The DSKPP Server MUST NOT accept the DeviceID unless the server sent that DeviceID in a preceding trigger message ๐Ÿšซ. Also, it's totally legit for a DSKPP Client to start the DSKPP run without ever getting a <KeyProvTrigger> from a server, but in that case any provided DeviceID MUST NOT be accepted by the DSKPP Server unless the server has access to a unique key for the identified device and that key gets used in the protocol ๐Ÿ”๐Ÿ’€.

4.2.3. KeyProvServerHello โœจ

This is the server's reply, and honestly it's where the whole context for the run gets locked in ๐Ÿ”’.

           DSKPP Client                         DSKPP Server
           ------------                         ------------
                                 <---    SAL, R_S, [K], [MAC]

When this message is sent: The DSKPP Server sends this in response to a <KeyProvClientHello> after it hunts for an acceptable combination of DSKPP version, variant (in this case, four-pass), key package format, key type, and set of cryptographic algorithms ๐Ÿ”Ž. If it can't find one, it still sends the message, just with a failure status ๐Ÿ˜ฌ.

Purpose of this message: The context for the protocol run gets set here โœจ. The DSKPP Server also uses this message to send a random nonce, which is required so both sides can agree on the same symmetric key (K_TOKEN) ๐Ÿค.

What is contained in this message: There's a status attribute that matches the server's return code to <KeyProvClientHello> ๐Ÿ“‹. If the server found an acceptable set of attributes in the client's SAL, it sets status to Continue and sends back an SAL (picked from the one it got in <KeyProvClientHello>) ๐ŸŽฏ. That server SAL spells out the DSKPP version and variant (in this case, four-pass), key type, cryptographic algorithms, and key package format the DSKPP Client MUST use for the rest of the protocol run ๐Ÿ‘‘.

There's also a random nonce (R_S) for generating a symmetric key through key agreement, and its length may depend on the selected key type ๐ŸŽฒ.

Then there's a key (K) for the DSKPP Client to use when encrypting the client nonce that goes with <KeyProvClientNonce> ๐Ÿ”‘. K represents either the server's public key (K_SERVER) or a pre-shared secret key (K_SHARED) ๐Ÿ—๏ธ.

A MAC MUST be present if a key is being renewed, so the DSKPP Client can confirm the replacement key came from a trusted server ๐Ÿ›ก๏ธ. This MAC MUST be computed using DSKPP-PRF (see Section 3.4.2), where the input parameter k MUST be set to the existing MAC key K_MAC' (in other words, the value of the MAC key that existed before this protocol run). The implementation MAY specify K_MAC' to be the value of the K_TOKEN that's being replaced ๐Ÿงฉ. And the input parameter dsLen MUST be set to the length of R_S ๐Ÿ“.

How the DSKPP Client uses this message: If the Status attribute isn't set to "Continue", that means failure, and the DSKPP Client MUST abort the protocol ๐Ÿ›‘.

If a successful run will replace an existing key with a newly generated one, the DSKPP Client MUST verify the MAC in <KeyProvServerHello> ๐Ÿ”. If the MAC doesn't verify, the DSKPP Client MUST terminate the DSKPP session and MUST delete any nonces, keys, and/or secrets tied to the failed run ๐Ÿ—‘๏ธ๐Ÿ’”.

If the Status attribute is set to "Continue", the cryptographic module generates a random nonce (R_C) using the cryptographic algorithm in the SAL ๐ŸŽฐ. The length of R_C depends on the selected key type ๐Ÿ“.

Then R_C gets encrypted using K and the encryption algorithm in the SAL ๐Ÿ”.

Encrypting R_C, the rules:

The method the DSKPP Client MUST use to encrypt R_C: If K is equivalent to K_SERVER (the public key of the DSKPP Server), then an RSA encryption scheme from PKCS #1 [PKCS-1] MAY be used ๐Ÿ”. If K is equivalent to K_SERVER, the cryptographic module SHOULD verify the server's certificate before using it to encrypt R_C, as described in [RFC2818], Section 3.1, and [RFC5280] ๐Ÿ“œ.

If K is equivalent to K_SHARED, the DSKPP Client MAY use the DSKPP-PRF to avoid depending on other algorithms โœŒ๏ธ. In this case, the client uses K_SHARED as input parameter k (and K_SHARED SHOULD be used solely for this purpose) like so:

dsLen = len(R_C), where "len" is the length of R_C
DS = DSKPP-PRF(K_SHARED, "Encryption" || R_S, dsLen)

That produces a pseudorandom string DS whose length equals R_C ๐ŸŽ€. Then encryption of R_C MAY be achieved by XOR-ing DS with R_C:

E(DS, R_C) = DS ^ R_C

The DSKPP Server then does the reverse operation to pull R_C back out of E(DS, R_C) ๐Ÿ”„๐Ÿ’œ.

4.2.4. KeyProvClientNonce ๐ŸŽ€

DSKPP Client                         DSKPP Server
------------                         ------------
E(K,R_C), AD          --->

When this message is sent: okay so the DSKPP Client sends this right after a <KeyProvServerHello> whose status was set to "Continue" ๐Ÿ’… It's the next move in the dance!

Purpose of this message: this is where the client sends its User Authentication Data (AD) plus a random nonce, and it encrypts the nonce with the DSKPP Server's key (K) ๐Ÿ” The client's random nonce is required so both sides end up agreeing on the same symmetric key (K_TOKEN). Main character energy, honestly โœจ

What is contained in this message: two things. First, the Authentication Data (AD), which was derived from an Authentication Code the user typed in before <KeyProvClientHello> was sent (refer to Section 3.2). Second, the DSKPP Client's random nonce (R_C), encrypted the way Section 4.2.3 describes ๐Ÿฆ‹

How the DSKPP Server uses this message: the server MUST use AD to authenticate the user ๐Ÿ™ˆ If authentication fails, the server MUST set the return code to a failure status. No vibes, just rules.

If the user passes authentication, the server decrypts R_C with its key (K). Which decryption method it uses depends on whether the K that was sent to the client in <KeyProvServerHello> was equal to the server's public key (K_SERVER) or a pre-shared key (K_SHARED). (Refer to Section 4.2.3 for how the DSKPP Client encrypts R_C.) ๐Ÿงฉ

Once R_C is extracted, the server computes K_TOKEN using a combination of the two random nonces, R_S and R_C, plus its encryption key K, as described in Section 4.1.2 ๐Ÿ”ฅ The particular realization of DSKPP-PRF (for example, the ones defined in Appendix D) depends on the MAC algorithm contained in the <KeyProvServerHello> message. Then the server generates a key package holding key usage attributes like expiry date and length ๐Ÿ“ฆ The key package MUST NOT include K_TOKEN, because in the four-pass variant K_TOKEN is never transmitted between the DSKPP Server and Client. Keep it secret, keep it safe ๐Ÿคซ The server stores K_TOKEN and the key package with the user's account on the cryptographic server.

Last step: the server generates a key confirmation MAC. The client uses this to avoid a false "Commit" message, which would leave the cryptographic module in a state where the server doesn't recognize the stored key ๐Ÿ˜ญ Not on my watch!

The MAC used for key confirmation MUST be calculated as follows:

msg_hash = SHA-256(msg_1, ..., msg_n)

dsLen = len(msg_hash)

MAC = DSKPP-PRF (K_MAC, "MAC 1 computation" || msg_hash, dsLen)

where:

  • MAC: the DSKPP Pseudorandom Function defined in Section 3.4.2 is used to compute the MAC. The particular realization of DSKPP-PRF (for example, those defined in Appendix D) depends on the MAC algorithm contained in the <KeyProvServerHello> message. The MAC MUST be computed using the existing MAC key (K_MAC), and a string formed by concatenating the (ASCII) string "MAC 1 computation" and a msg_hash. ๐ŸŒธ
  • K_MAC: the key derived from K_PROV, as described in Section 4.1.2.
  • msg_hash: the message hash (defined in Section 3.4.3) of messages msg_1, ..., msg_n.

4.2.5. KeyProvServerFinished ๐Ÿ’œ

DSKPP Client                         DSKPP Server
------------                         ------------
                      <---               KP, MAC

When this message is sent: the server sends this after it has authenticated the user and, if authentication passed, generated K_TOKEN and a key package and associated them with the user's account on the cryptographic server ๐ŸŽ‰

Purpose of this message: the server confirms that the key (K_TOKEN) was generated, and it sends the associated identifier and application-specific attributes in a key package for protocol completion. It does NOT send the key itself ๐Ÿค (Obviously, the vibe is "keep it hidden.")

What is contained in this message: a Status attribute, which is basically the same as the server's return code to <KeyProvClientNonce>. If user authentication passed, and the server successfully computed K_TOKEN, generated a key package, and associated them with the user's account, then it sets the Status attribute to "Success" โœ…

If the Status attribute is "Success", this message acts as a "Commit" message, telling the cryptographic module to store the generated key (K_TOKEN) and associate the given key identifier with it. So a key package (KP) MUST be included in this message. It holds an identifier for the generated key (but not the key itself) plus extra config, like the identity of the DSKPP Server, key usage attributes, and so on ๐Ÿง The default symmetric key package format MUST be based on the Portable Symmetric Key Container (PSKC) defined in [RFC6030]. Alternative formats MAY include [RFC6031], PKCS #12 [PKCS-12], or PKCS #5 XML [PKCS-5-XML] format.

With KP, the server also includes a key confirmation MAC that the client uses to avoid a false "Commit" message. The MAC algorithm is the same DSKPP-PRF that was sent in the <KeyProvServerHello> message ๐Ÿ”

How the DSKPP Client uses this message: when the Status attribute is not "Success", that means failure, and the DSKPP Client MUST abort the protocol ๐Ÿšซ

After receiving a <KeyProvServerFinished> message with Status = "Success", the DSKPP Client MUST verify the key confirmation MAC that came with it. If the MAC does not verify, the DSKPP Client MUST terminate the DSKPP session, and MUST, in this case, also delete any nonces, keys, and/or secrets associated with the failed run of the protocol ๐Ÿ’€

If <KeyProvServerFinished> has Status = "Success" and the MAC was verified, then the DSKPP Client MUST calculate K_TOKEN from the combination of the two random nonces (R_S and R_C) and the server's encryption key K, as described in Section 4.1.2. The DSKPP-PRF is the same one used for MAC computation. The DSKPP Client associates the key package contained in <KeyProvServerFinished> with the generated key K_TOKEN and stores this data permanently on the cryptographic module ๐ŸŒˆ

After this operation, it MUST NOT be possible to overwrite the key, unless knowledge of an authorizing key is proven through a MAC on a later <KeyProvServerHello> (and <KeyProvServerFinished>) message. Locked in, bestie ๐Ÿ”’


5. Two-Pass Protocol Usage ๐Ÿฆ‹

This section describes the methods and message flow that make up the two-pass protocol variant. Two-pass DSKPP is basically just a transport of keying material from the DSKPP Server to the DSKPP Client ๐Ÿšš The DSKPP Server sends the keying material in a key package formatted according to [RFC6030], [RFC6031], PKCS #12 [PKCS-12], or PKCS #5 XML [PKCS-5-XML].

The keying material includes a provisioning master key, K_PROV. From it, the DSKPP Client derives two keys: the symmetric key to be established in the cryptographic module (K_TOKEN), and a key used for key confirmation (K_MAC). The keying material also includes key usage attributes, such as expiry date and length ๐ŸŒŸ

The DSKPP Server encrypts K_PROV so that it isn't exposed to any entity other than the DSKPP Server and the cryptographic module itself ๐Ÿ” To do that, it uses any of three key protection methods: Key Transport, Key Wrap, and Passphrase-Based Key Wrap Key Protection methods.

The DSKPP Client and server may negotiate which key protection method to use, but the actual key protection happens inside the KeyPackage. The format of a KeyPackage specifies how a key should be protected using the three key protection methods. These KeyPackage formats are defined for DSKPP:

  • PSKC Key Container [RFC6030] at urn:ietf:params:xml:ns:keyprov:dskpp:pskc-key-container
  • SKPC Key Container [RFC6031] at urn:ietf:params:xml:ns:keyprov:dskpp:skpc-key-container
  • PKCS12 Key Container [PKCS-12] at urn:ietf:params:xml:ns:keyprov:dskpp:pkcs12-key-container
  • PKCS5-XML Key Container [PKCS-5-XML] at urn:ietf:params:xml:ns:keyprov:dskpp:pkcs5-xml-key-container

Each of the key protection methods is described below ๐Ÿ’–

5.1. Key Protection Methods ๐Ÿงš

This section introduces three key protection methods for the two-pass variant. Additional methods MAY be defined by external entities or through the IETF process โœจ

5.1.1. Key Transport ๐Ÿ”ฅ

Purpose of this method: this one is for PKI-capable devices. The DSKPP Server encrypts the keying material and transports it to the DSKPP Client. The server encrypts it using the public key of the DSKPP Client, whose private key part lives inside the cryptographic module ๐Ÿ”‘ The DSKPP Client decrypts the keying material and uses it to derive the symmetric key, K_TOKEN.

This method is identified with the following URN: urn:ietf:params:xml:schema:keyprov:dskpp:transport

The DSKPP Server and Client MUST support the following mechanism: http://www.w3.org/2001/04/xmlenc#rsa-1_5 encryption mechanism defined in [XMLENC] ๐Ÿ’…

5.1.2. Key Wrap ๐Ÿ“

Purpose of this method: this is ideal for pre-keyed devices, like SIM cards ๐Ÿ“ฑ The DSKPP Server encrypts the keying material using a pre-shared key wrapping key and transports it to the DSKPP Client. The DSKPP Client decrypts the keying material and uses it to derive the symmetric key, K_TOKEN.

This method is identified with the following URN: urn:ietf:params:xml:schema:keyprov:dskpp:wrap

The DSKPP Server and Client MUST support all of the following key wrapping mechanisms:

5.1.3. Passphrase-Based Key Wrap โœจ

okay so this one is a variation of the Key Wrap Method ๐Ÿ” and it's built for tiny devices with keypads, like mobile phones ๐Ÿ“ฑ. The DSKPP Server encrypts the keying material using a wrapping key that's derived from a passphrase the user types in. Then it sends the encrypted blob to the DSKPP Client. The Client decrypts the keying material and uses it to derive the symmetric key, K_TOKEN ๐Ÿฆ‹.

bestie, the big vibe here is privacy ๐Ÿซถ. This method keeps K_TOKEN away from everyone except the DSKPP Server and the cryptographic module itself. To keep that promise, the method SHOULD be used only when the device has a way to type the passphrase straight in, like a keypad โŒจ๏ธ.

This method is identified with the following URN:

urn:ietf:params:xml:schema:keyprov:dskpp:passphrase-wrap ๐ŸŽ€

The DSKPP Server and Client MUST support all of these:


5.2. Message Flow ๐Ÿฆ‹

okay, so the two-pass protocol flow is just one exchange ๐Ÿ’–:

1: Pass 1 = <KeyProvClientHello>, Pass 2 = <KeyProvServerFinished>

no <ServerHello> and no <ClientNonce> get exchanged here ๐Ÿ™ˆ, but the DSKPP Client can still spill its algorithm preferences and supported key types in the <KeyProvClientHello> message ๐Ÿ’….

Each message's purpose and content are explained below. The XML format and examples live in Section 8 and Appendix B ๐Ÿ“š.

5.2.1. KeyProvTrigger ๐Ÿ’Œ

the trigger message works exactly the same way in the two-pass variant as it does in the four-pass variant, so just peek at Section 4.2.1 ๐Ÿซถโœจ.

5.2.2. KeyProvClientHello โœจ

        DSKPP Client                         DSKPP Server
        ------------                         ------------
        SAL, AD, R_C,
        [DeviceID], [KeyID],
        KPML                   --->

When this message is sent: Okay bestie, this is the very first thing the client says ๐Ÿซถ When a DSKPP Client first connects to a DSKPP Server, it is required to send the <KeyProvClientHello> as its first message. The client can also send <KeyProvClientHello> in response to a <KeyProvTrigger> message. Main character entrance, every time ๐Ÿ’…

Purpose of this message: With this message, the DSKPP Client shows off its algorithm preferences and supported key types, plus which DSKPP versions, protocol variants (in this case "two-pass"), key package formats, and key protection methods it can handle ๐Ÿ’– It also helps with user authentication by sending the Authentication Data (AD) that the user provided before the first DSKPP message went out. No cap, this is the moment the client gets the server ready for the whole vibe โœจ

Application note: This message MUST send User Authentication Data (AD) to the DSKPP Server. If this message is preceded by trigger message <KeyProvTrigger>, then the application will already have AD available (see Section 4.2.1). However, if this message was not preceded by <KeyProvTrigger>, then the application MUST retrieve the User Authentication Code, possibly by prompting the user to manually enter their Authentication Code, e.g., on a device with only a numeric keypad. The application MUST also derive Authentication Data (AD) from the Authentication Code, as described in Section 3.4.1, and save it for use in its next message, <KeyProvClientNonce>. Lowkey the most important bit, so don't skip it ๐Ÿ”ฅ

What is contained in this message:

The Security Attribute List (SAL) included with <KeyProvClientHello> contains the combinations of DSKPP versions, variants, key package formats, key types, and cryptographic algorithms that the DSKPP Client supports, ordered by the client's preference (favorite choice first) ๐ŸŒธ

Authentication Data (AD) that was either included with <KeyProvTrigger>, or generated as described in the "Application Note" above ๐ŸŽ€

The DSKPP Client's random nonce (R_C), which was used by the client when generating AD. By inserting R_C into the DSKPP session, the DSKPP Client is able to ensure the DSKPP Server is live before committing the key. That's the "are you actually there?" check, and it's giving security ๐Ÿ‘‘

If <KeyProvClientHello> was preceded by a <KeyProvTrigger>, then this message MUST also include the DeviceID and/or KeyID that was provided with the trigger. Otherwise, if a trigger message did not precede <KeyProvClientHello>, then this message MAY include a DeviceID that was pre-shared with the DSKPP Server, and MAY contain a key ID associated with a key previously provisioned by the DSKPP provisioning server ๐Ÿฆ‹

The list of key protection methods (KPML) that the DSKPP Client supports. Each item in the list MAY include an encryption key "payload" for the DSKPP Server to use to protect keying material that it sends back to the client. The payload MUST be of type <ds:KeyInfoType> ([XMLDSIG]). For each key protection method, the allowable choices for <ds:KeyInfoType> are:

  • Key Transport: Only those choices of <ds:KeyInfoType> that identify a public key (i.e., <ds:KeyName>, <ds:KeyValue>, <ds:X509Data>, or <ds:PGPData>). The <ds:X509Certificate> option of the <ds:X509Data> alternative is RECOMMENDED when the public key corresponding to the private key on the cryptographic module has been certified. ๐Ÿ“
  • Key Wrap: Only those choices of <ds:KeyInfoType> that identify a symmetric key (i.e., <ds:KeyName> and <ds:KeyValue>). The <ds:KeyName> alternative is RECOMMENDED. ๐Ÿงš
  • Passphrase-Based Key Wrap: The <ds:KeyName> option MUST be used and the key name MUST identify the passphrase that will be used by the server to generate the key wrapping key. The identifier and passphrase components of <ds:KeyName> MUST be set to the Client ID and Authentication Code components of AD (same AD as contained in this message). ๐Ÿ”

How the DSKPP Server uses this message: The DSKPP Server will look for an acceptable combination of DSKPP version, variant (in this case, two-pass), key package format, key type, and cryptographic algorithms. If the DSKPP Client's SAL does not match the capabilities of the DSKPP Server, or does not comply with key provisioning policy, then the DSKPP Server will set the Status attribute to something other than "Success". Otherwise, the Status attribute will be set to "Success". Vibe check passed or failed, bestie ๐Ÿ’€

The DSKPP Server will validate the DeviceID and KeyID if included in <KeyProvClientHello>. The DSKPP Server MUST NOT accept the DeviceID unless the server sent the DeviceID in a preceding trigger message. Note that it is also legitimate for a DSKPP Client to initiate the DSKPP run without having received a <KeyProvTrigger> message from a server, but in this case any provided DeviceID MUST NOT be accepted by the DSKPP Server unless the server has access to a unique key for the identified device and that key will be used in the protocol. Not me being strict, but the server has to be careful here ๐Ÿ™ˆ

The DSKPP Server MUST use AD to authenticate the user. If authentication fails, then the DSKPP Server MUST set the return code to a failure status, and MUST, in this case, also delete any nonces, keys, and/or secrets associated with the failed run of the protocol. Clean up after yourself, it's the only way ๐Ÿงน

If user authentication passes, the DSKPP Server generates a key K_PROV. In the two-pass case, wherein the client does not have access to R_S, K_PROV is randomly generated solely by the DSKPP Server wherein K_PROV MUST consist of two parts of equal length, i.e.,

K_PROV = K_MAC || K_TOKEN

The length of K_TOKEN (and hence also the length of K_MAC) is determined by the type of K_TOKEN, which MUST be one of the key types supported by the DSKPP Client. In cases where the desired key length for K_TOKEN is different from the length of K_MAC for the underlying MAC algorithm, the greater length of the two MUST be chosen to generate K_PROV. The actual MAC key is truncated from the resulting K_MAC when it is used in the MAC algorithm when K_MAC is longer than necessary in order to match the desired K_TOKEN length. If K_TOKEN is longer than needed in order to match the K_MAC length, the provisioning server and the receiving client must determine the actual secret key length from the target key algorithm and store only the truncated portion of the K_TOKEN. The truncation MUST take the beginning bytes of the desired length from K_TOKEN or K_MAC for the actual key. For example, when a provisioning server provisions an event based HOTP secret key with length 20 and MAC algorithm DSKPP-PRF-SHA256 (Appendix D), K_PROV length will be 64. The derived K_TOKEN and K_MAC will each consist of 32 bytes. The actual HOTP key should be the first 20 bytes of the K_TOKEN. Math is mathing here, and it's giving precise ๐Ÿงฎ

Once K_PROV is computed, the DSKPP Server selects one of the key protection methods from the DSKPP Client's KPML, and uses that method and corresponding payload to encrypt K_PROV. The DSKPP Server generates a key package to transport the key encryption method information and the encrypted provisioning key (K_PROV). The encrypted data format is subject to the choice supported by the selected key package. The key package MUST specify and use the selected key protection method and the key information that was received in <KeyProvClientHello>. The key package also includes key usage attributes such as expiry date and length. The server stores the key package and K_TOKEN with a user account on the cryptographic server. ๐Ÿ“ฆ

The server generates a MAC for key confirmation, which the client will use to avoid a false "Commit" message that would cause the cryptographic module to end up in state in which the server does not recognize the stored key. In addition, if an existing key is being renewed, the server generates a second MAC that it will return to the client as server Authentication Data (AD) so that the DSKPP Client can confirm that the replacement key came from a trusted server. Trust, but verify, periodt ๐Ÿซก

The method the DSKPP Server MUST use to calculate the key confirmation MAC:

msg_hash = SHA-256(msg_1, ..., msg_n)

dsLen = len(msg_hash)

MAC = DSKPP-PRF (K_MAC, "MAC 1 computation" || msg_hash ||
ServerID, dsLen)

where

  • MAC: The MAC MUST be calculated using the already established MAC algorithm and MUST be computed on the (ASCII) string "MAC 1 computation", msg_hash, and ServerID using the existing MAC key K_MAC.
  • K_MAC: The key that is derived from K_PROV, which the DSKPP Server MUST provide to the cryptographic module.
  • msg_hash: The message hash, defined in Section 3.4.3, of messages msg_1, ..., msg_n.
  • ServerID: The identifier that the DSKPP Server MUST include in the <KeyPackage> element of <KeyProvServerFinished>.

If DSKPP-PRF (defined in Section 3.4.2) is used as the MAC algorithm, then the input parameter s MUST consist of the concatenation of the (ASCII) string "MAC 1 computation", msg_hash, and ServerID, and the parameter dsLen MUST be set to the length of msg_hash. ๐ŸŒˆ

The method the DSKPP Server MUST use to calculate the server authentication MAC: The MAC MUST be computed on the (ASCII) string "MAC 2 computation", the server identifier ServerID, and R, using a pre-existing MAC key K_MAC' (the MAC key that existed before this protocol run). Note that the implementation may specify K_MAC' to be the value of the K_TOKEN that is being replaced.

If DSKPP-PRF is used as the MAC algorithm, then the input parameter s MUST consist of the concatenation of the (ASCII) string "MAC 2 computation" ServerID, and R. The parameter dsLen MUST be set to at least 16 (i.e., the length of the MAC MUST be at least 16 octets):

dsLen >= 16

MAC = DSKPP-PRF (K_MAC', "MAC 2 computation" || ServerID || R,
dsLen)

The MAC algorithm MUST be the same as the algorithm used by the DSKPP Server to calculate the key confirmation MAC. ๐Ÿฆ‹


5.2.3. KeyProvServerFinished โœจ

          DSKPP Client                         DSKPP Server
           ------------                         ------------
                                  <---           KP, MAC, AD

When this message is sent: okay so the DSKPP Server sends this one after it has authenticated the user and, if that passed, generated K_TOKEN and a key package and linked them to the user's account on the cryptographic server ๐Ÿ” it's giving main character energy ๐Ÿ’…

Purpose of this message: bestie, this is the message that carries the key package with the encrypted provisioning key (K_PROV) and the key usage attributes ๐ŸŽ€

What is contained in this message: there's a Status attribute that mirrors the server's return code to <KeyProvClientHello>. If the server found an acceptable set of attributes in the client's SAL, then Status is set to "Success" โœจ

The confirmation message MUST include the Key Package (KP) ๐Ÿ“ฆ, which holds the DSKPP Server's ID, key ID, key type, encrypted provisioning key (K_PROV), encryption method, and additional configuration information. The default symmetric key package format MUST be based on the Portable Symmetric Key Container (PSKC) defined in [RFC6030]. Alternative formats MAY include [RFC6031], PKCS #12 [PKCS-12], or PKCS #5 XML [PKCS-5-XML] ๐ŸŒˆ

This message MUST include a MAC that the DSKPP Client will use for key confirmation. This key confirmation MAC is calculated using the "MAC 1 computation" as described in the previous section ๐Ÿ”ฅ

Finally, if an existing key is being replaced, then this message MUST also include a server authentication MAC (calculated using the "MAC 2 computation" as described in the previous section), which is passed as AD to the DSKPP Client ๐Ÿฆ‹

How the DSKPP Client uses this message: after receiving a <KeyProvServerFinished> message with Status = "Success", the DSKPP Client MUST verify both MACs (MAC and AD). If either MAC does not verify, the DSKPP Client MUST terminate the DSKPP run, and MUST, in this case, also delete any nonces, keys, and/or secrets associated with the failed run of the protocol ๐Ÿ’€

If <KeyProvServerFinished> has Status = "Success" and the MACs were verified, then the DSKPP Client MUST extract K_PROV from the provided key package and derive K_TOKEN. Finally, the DSKPP Client initializes the cryptographic module with K_TOKEN and the corresponding key usage attributes. After this operation, it MUST NOT be possible to overwrite the key unless knowledge of an authorizing key is proven through a MAC on a later <KeyProvServerFinished> message ๐Ÿ”’โœจ


6. Protocol Extensions ๐Ÿงš

DSKPP has been designed to be extensible ๐ŸŒธ The sub-sections below define two extensions that are included with the DSKPP schema. Since it is possible that the use of extensions will harm interoperability, protocol designers are advised to carefully consider the use of extensions. For example, if a particular implementation relies on the presence of a proprietary extension, then it may not be able to interoperate with independent implementations that have no knowledge of this extension ๐Ÿ™ˆ

Extensions may be sent with any DSKPP message using the ExtensionsType. The ExtensionsType type is a list of Extensions containing type-value pairs that define optional features supported by a DSKPP Client or server. Each extension MAY be marked as Critical by setting the Critical attribute of the Extension to "true". Unless an extension is marked as Critical, a receiving party need not be able to interpret it, and a receiving party is always free to disregard any (non-critical) extensions ๐Ÿ’œ

6.1. The ClientInfoType Extension

The ClientInfoType extension MAY contain any client-specific data required of an application. This extension MAY be present in a <KeyProvClientHello> or <KeyProvClientNonce> message. When present, this extension MUST NOT be marked as Critical ๐ŸŽ€

DSKPP Servers MUST support this extension. DSKPP 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. DSKPP Servers need not retain the ClientInfoType data ๐Ÿซถ

6.2. The ServerInfoType Extension

The ServerInfoType extension MAY contain any server-specific data required of an application, e.g., state information. This extension is only valid in <KeyProvServerHello> messages for which the Status attribute is set to "Continue". When present, this extension MUST NOT be marked as Critical ๐ŸŒˆ

DSKPP Clients MUST support this extension. DSKPP 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 <KeyProvClientNonce> message). DSKPP Clients need not retain the ServerInfoType data ๐Ÿฆ‹


7. Protocol Bindings ๐Ÿ”—

7.1. General Requirements

DSKPP assumes a reliable transport ๐Ÿ’–

7.2. HTTP/1.1 Binding for DSKPP

This section presents a binding of the previous messages to HTTP/1.1 [RFC2616]. This HTTP binding is mandatory to implement, although newer versions of the specification might define additional bindings in the future โœจ Note that the HTTP client will normally be different from the DSKPP Client (i.e., the HTTP client will "proxy" DSKPP messages from the DSKPP Client to the DSKPP Server). Likewise, on the HTTP server side, the DSKPP Server MAY receive DSKPP message from a "front-end" HTTP server. The DSKPP Server will be identified by a specific URL, which may be pre-configured, or provided to the client during initialization ๐ŸŒธ

7.2.1. Identification of DSKPP Messages

The MIME type for all DSKPP messages MUST be:

application/dskpp+xml

7.2.2. HTTP Headers

In order to avoid caching of responses carrying DSKPP messages by proxies, 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.

To handle content negotiation, HTTP requests MAY include an HTTP Accept header field. This header field SHOULD should be identified using the MIME type specified in Section 7.2.1. The Accept header MAY include additional content types defined by future versions of this protocol ๐Ÿ“

There are no other restrictions on HTTP headers, besides the requirement to set the Content-Type header value to the MIME type specified in Section 7.2.1 ๐Ÿ’…

7.2.3. HTTP Operations

Persistent connections as defined in HTTP/1.1 are OPTIONAL. DSKPP requests are mapped to HTTP requests with the POST method. DSKPP responses are mapped to HTTP responses ๐Ÿฆ‹

For the four-pass DSKPP, messages within the protocol run are bound together. In particular, <KeyProvServerHello> is bound to the preceding <KeyProvClientHello> by being transmitted in the corresponding HTTP response. <KeyProvServerHello> MUST have a SessionID attribute, and the SessionID attribute of the subsequent <KeyProvClientNonce> message MUST be identical. <KeyProvServerFinished> is then once again bound to the rest through HTTP (and possibly through a SessionID) ๐Ÿ”—โœจ

7.2.4. HTTP Status Codes

A DSKPP HTTP responder that refuses to perform a message exchange with a DSKPP HTTP requester SHOULD return a 403 (Forbidden) response. In this case, the content of the HTTP body is not significant. In the case of an HTTP error while processing a DSKPP request, the HTTP server MUST return a 500 (Internal Server Error) response. This type of error SHOULD be returned for HTTP-related errors detected before control is passed to the DSKPP processor, or when the DSKPP processor reports an internal error (for example, the DSKPP XML namespace is incorrect, or the DSKPP schema cannot be located). If a request is received that is not a DSKPP Client message, the DSKPP responder MUST return a 400 (Bad request) response ๐Ÿ’€

In these cases (i.e., when the HTTP response code is 4xx or 5xx), the content of the HTTP body is not significant.

Redirection status codes (3xx) apply as usual ๐ŸŒˆ

Whenever the HTTP POST is successfully invoked, the DSKPP HTTP responder MUST use the 200 status code and provide a suitable DSKPP message (possibly with DSKPP error information included) in the HTTP body ๐ŸŽ€

7.2.5. HTTP Authentication

No support for HTTP/1.1 authentication is assumed ๐Ÿ™ˆ

7.2.6. Initialization of DSKPP

If a user requests key initialization in a browsing session, and if that request has an appropriate Accept header (e.g., to a specific DSKPP Server URL), the DSKPP Server MAY respond by sending a DSKPP initialization message in an HTTP response with Content-Type set according to Section 7.2.1 and response code set to 200 (OK). The initialization message MAY carry data in its body, such as the URL for the DSKPP Client to use when contacting the DSKPP Server. If the message does carry data, the data MUST be a valid instance of a <KeyProvTrigger> element ๐Ÿงš

Note that if the user's request was directed to some other resource, the DSKPP Server MUST NOT respond by combining the DSKPP content type with response code 200. In that case, the DSKPP Server SHOULD respond by sending a DSKPP initialization message in an HTTP response with Content-Type set according to Section 7.2.1 and response code set to 406 (Not Acceptable) ๐Ÿ‘‘

7.2.7. Example Messages

a. Initialization from DSKPP Server:

HTTP/1.1 200 OK

Cache-Control: no-store
Content-Type: application/dskpp+xml
Content-Length: <some value>

DSKPP initialization data in XML form...

b. Initial request from DSKPP Client:

POST http://example.com/cgi-bin/DSKPP-server HTTP/1.1

Cache-Control: no-cache, no-store
Pragma: no-cache
Host: www.example.com
Content-Type: application/dskpp+xml
Content-Length: <some value>

DSKPP data in XML form (supported version, supported
algorithms...)

c. Initial response from DSKPP Server:

HTTP/1.1 200 OK

Cache-Control: no-cache, no-must-revalidate, private
Pragma: no-cache
Content-Type: application/dskpp+xml
Content-Length: <some value>

DSKPP data in XML form (server random nonce, server public key,
...)

8. DSKPP XML Schema ๐Ÿ“œ

8.1. General Processing Requirements

Some DSKPP elements rely on the parties being able to compare received values with stored values ๐Ÿ” Unless otherwise noted, all elements that have the XML schema "xs:string" type, or a type derived from it, MUST be compared using an exact binary comparison. In particular, DSKPP implementations MUST NOT depend on case-insensitive string comparisons, normalization or trimming of white space, or conversion of locale-specific formats such as numbers ๐Ÿ’…

Implementations that compare values that are represented using different character encodings MUST use a comparison method that returns the same result as converting both values to the Unicode character encoding [UNICODE] and then performing an exact binary comparison ๐ŸŒธ

No collation or sorting order for attributes or element values is defined. Therefore, DSKPP implementations MUST NOT depend on specific sorting orders for values ๐Ÿฆ‹

8.2. Schema

Okay bestie, the schema is where the magic happens ๐Ÿงšโœจ Every type, enum and element is exactly as the spec defines it, so this is the part implementers actually build against ๐Ÿ’…

    <?xml version="1.0" encoding="utf-8"?>
    <xs:schema
       xmlns:xs="http://www.w3.org/2001/XMLSchema"
       xmlns:dskpp="urn:ietf:params:xml:ns:keyprov:dskpp"
       xmlns:pskc="urn:ietf:params:xml:ns:keyprov:pskc"
       xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
       targetNamespace="urn:ietf:params:xml:ns:keyprov:dskpp"
       elementFormDefault="qualified" attributeFormDefault="unqualified"
          version="1.0">
       <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"/>
       <xs:import namespace="urn:ietf:params:xml:ns:keyprov:pskc"
          schemaLocation="keyprov-pskc-1.0.xsd"/>
       <xs:complexType name="AbstractRequestType" abstract="true">
          <xs:annotation>
             <xs:documentation> Basic types </xs:documentation>
          </xs:annotation>
          <xs:attribute name="Version" type="dskpp:VersionType"
             use="required"/>
       </xs:complexType>
       <xs:complexType name="AbstractResponseType" abstract="true">
          <xs:annotation>
             <xs:documentation> Basic types </xs:documentation>
          </xs:annotation>
          <xs:attribute name="Version" type="dskpp:VersionType"
             use="required"/>
          <xs:attribute name="SessionID" type="dskpp:IdentifierType" />
          <xs:attribute name="Status" type="dskpp:StatusCode"
             use="required"/>
       </xs:complexType>

       <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="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="NoProtocolVariants" />
             <xs:enumeration value="NoSupportedKeyPackages" />
             <xs:enumeration value="AuthenticationDataMissing" />
             <xs:enumeration value="AuthenticationDataInvalid" />
             <xs:enumeration value="InitializationFailed" />
             <xs:enumeration value="ProvisioningPeriodExpired" />
          </xs:restriction>
       </xs:simpleType>
       <xs:complexType name="DeviceIdentifierDataType">
          <xs:choice>
             <xs:element name="DeviceId" type="pskc:DeviceInfoType" />
             <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:attribute name="KeyLocation"
             type="dskpp:PlatformType"/>
          <xs:attribute name="AlgorithmLocation"
             type="dskpp:PlatformType"/>
       </xs:complexType>

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

       <xs:complexType name="AlgorithmsType">
          <xs:sequence maxOccurs="unbounded">
             <xs:element name="Algorithm" type="dskpp:AlgorithmType"/>
          </xs:sequence>
       </xs:complexType>

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

       <xs:complexType name="ProtocolVariantsType">
          <xs:sequence>
             <xs:element name="FourPass" minOccurs="0" />
             <xs:element name="TwoPass"
                type="dskpp:KeyProtectionDataType" minOccurs="0"/>
          </xs:sequence>
       </xs:complexType>
       <xs:complexType name="KeyProtectionDataType">
          <xs:annotation>
             <xs:documentation xml:lang="en">
                This element is only valid for two-pass DSKPP.
             </xs:documentation>
          </xs:annotation>
          <xs:sequence maxOccurs="unbounded">
            <xs:element name="SupportedKeyProtectionMethod"
               type="xs:anyURI"/>
            <xs:element name="Payload"
               type="dskpp:PayloadType" minOccurs="0"/>
          </xs:sequence>
       </xs:complexType>

       <xs:complexType name="PayloadType">
          <xs:choice>
             <xs:element name="Nonce" type="dskpp:NonceType" />
             <xs:any namespace="##other" processContents="strict"/>
          </xs:choice>
       </xs:complexType>

       <xs:complexType name="KeyPackagesFormatType">
          <xs:sequence maxOccurs="unbounded">
             <xs:element name="KeyPackageFormat"
                type="dskpp:KeyPackageFormatType"/>
          </xs:sequence>
       </xs:complexType>

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

       <xs:complexType name="AuthenticationDataType">
          <xs:annotation>
             <xs:documentation xml:lang="en">
                Authentication Data contains a MAC.
             </xs:documentation>
          </xs:annotation>
          <xs:sequence>
             <xs:element name="ClientID"
                type="dskpp:IdentifierType" minOccurs="0"/>
             <xs:choice>
                <xs:element name="AuthenticationCodeMac"
                   type="dskpp:AuthenticationMacType"/>
                <xs:any namespace="##other" processContents="strict" />
             </xs:choice>
          </xs:sequence>
       </xs:complexType>
       <xs:complexType name="AuthenticationMacType">
          <xs:sequence>
             <xs:element minOccurs="0" name="Nonce"
                type="dskpp:NonceType"/>
             <xs:element minOccurs="0" name="IterationCount"
                type="xs:int"/>
             <xs:element name="Mac" type="dskpp:MacType" />
          </xs:sequence>
       </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>

       <xs:complexType name="KeyPackageType">
          <xs:sequence>
             <xs:element minOccurs="0" name="ServerID"
                type="xs:anyURI"/>
             <xs:element minOccurs="0" name="KeyProtectionMethod"
                type="xs:anyURI" />
             <xs:choice>
                <xs:element name="KeyContainer"
                   type="pskc:KeyContainerType"/>
                <xs:any namespace="##other" processContents="strict"/>
             </xs:choice>
          </xs:sequence>
       </xs:complexType>

       <xs:complexType name="InitializationTriggerType">
          <xs:sequence>
             <xs:element minOccurs="0" name="DeviceIdentifierData"
                type="dskpp:DeviceIdentifierDataType" />
             <xs:element minOccurs="0" name="KeyID"
                type="xs:base64Binary"/>
             <xs:element minOccurs="0" name="TokenPlatformInfo"
                type="dskpp:TokenPlatformInfoType" />
             <xs:element name="AuthenticationData"
                type="dskpp:AuthenticationDataType" />
             <xs:element minOccurs="0" name="ServerUrl"
                type="xs:anyURI"/>
             <xs:any minOccurs="0" namespace="##other"
                processContents="strict" />
          </xs:sequence>
       </xs:complexType>
       <xs:complexType name="ExtensionsType">
          <xs:annotation>
             <xs:documentation> Extension types </xs:documentation>
          </xs:annotation>
          <xs:sequence maxOccurs="unbounded">
             <xs:element name="Extension"
                type="dskpp: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 mixed="false">
             <xs:extension base="dskpp:AbstractExtensionType">
                <xs:sequence>
                   <xs:element name="Data" type="xs:base64Binary"/>
                </xs:sequence>
             </xs:extension>
          </xs:complexContent>
       </xs:complexType>

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

       <xs:element name="KeyProvTrigger"
          type="dskpp:KeyProvTriggerType">
          <xs:annotation>
             <xs:documentation> DSKPP PDUs </xs:documentation>
          </xs:annotation>
       </xs:element>
       <xs:complexType name="KeyProvTriggerType">
          <xs:annotation>
          <xs:documentation xml:lang="en">
             Message used to trigger the device to initiate a
             DSKPP run.
          </xs:documentation>
          </xs:annotation>
          <xs:sequence>
             <xs:choice>
                <xs:element name="InitializationTrigger"
                   type="dskpp:InitializationTriggerType" />
                <xs:any namespace="##other" processContents="strict"/>
             </xs:choice>
          </xs:sequence>
          <xs:attribute name="Version" type="dskpp:VersionType"/>
       </xs:complexType>
       <xs:element name="KeyProvClientHello"
          type="dskpp:KeyProvClientHelloPDU">
          <xs:annotation>
             <xs:documentation>KeyProvClientHello PDU</xs:documentation>
          </xs:annotation>
       </xs:element>
       <xs:complexType name="KeyProvClientHelloPDU">
          <xs:annotation>
             <xs:documentation xml:lang="en">
                Message sent from DSKPP Client to DSKPP Server to
                initiate a DSKPP session.
             </xs:documentation>
          </xs:annotation>
          <xs:complexContent mixed="false">
             <xs:extension base="dskpp:AbstractRequestType">
                <xs:sequence>
                   <xs:element minOccurs="0" name="DeviceIdentifierData"
                      type="dskpp:DeviceIdentifierDataType" />
                   <xs:element minOccurs="0" name="KeyID"
                      type="xs:base64Binary" />
                   <xs:element minOccurs="0" name="ClientNonce"
                      type="dskpp:NonceType" />
                   <xs:element name="SupportedKeyTypes"
                      type="dskpp:AlgorithmsType" />
                   <xs:element name="SupportedEncryptionAlgorithms"
                      type="dskpp:AlgorithmsType" />
                   <xs:element name="SupportedMacAlgorithms"
                      type="dskpp:AlgorithmsType" />
                   <xs:element minOccurs="0"
                      name="SupportedProtocolVariants"
                      type="dskpp:ProtocolVariantsType" />

                   <xs:element minOccurs="0" name="SupportedKeyPackages"
                      type="dskpp:KeyPackagesFormatType" />
                   <xs:element minOccurs="0" name="AuthenticationData"
                      type="dskpp:AuthenticationDataType" />
                   <xs:element minOccurs="0" name="Extensions"
                      type="dskpp:ExtensionsType" />
                </xs:sequence>
             </xs:extension>
          </xs:complexContent>
       </xs:complexType>

       <xs:element name="KeyProvServerHello"
          type="dskpp:KeyProvServerHelloPDU">
          <xs:annotation>
             <xs:documentation>KeyProvServerHello PDU</xs:documentation>
          </xs:annotation>
       </xs:element>
       <xs:complexType name="KeyProvServerHelloPDU">
          <xs:annotation>
             <xs:documentation xml:lang="en">
                Response message sent from DSKPP Server to DSKPP Client
                in four-pass DSKPP.
             </xs:documentation>
          </xs:annotation>
          <xs:complexContent mixed="false">
             <xs:extension base="dskpp:AbstractResponseType">
                <xs:sequence minOccurs="0">
                   <xs:element name="KeyType"
                      type="dskpp:AlgorithmType"/>
                   <xs:element name="EncryptionAlgorithm"
                      type="dskpp:AlgorithmType" />
                   <xs:element name="MacAlgorithm"
                      type="dskpp:AlgorithmType"/>
                   <xs:element name="EncryptionKey"
                      type="ds:KeyInfoType"/>
                   <xs:element name="KeyPackageFormat"
                      type="dskpp:KeyPackageFormatType" />
                   <xs:element name="Payload" type="dskpp:PayloadType"/>
                   <xs:element minOccurs="0" name="Extensions"
                      type="dskpp:ExtensionsType" />
                   <xs:element minOccurs="0" name="Mac"
                      type="dskpp:MacType"/>
                </xs:sequence>
             </xs:extension>
          </xs:complexContent>
       </xs:complexType>
       <xs:element name="KeyProvClientNonce"
          type="dskpp:KeyProvClientNoncePDU">
          <xs:annotation>
             <xs:documentation>KeyProvClientNonce PDU</xs:documentation>
          </xs:annotation>
       </xs:element>
       <xs:complexType name="KeyProvClientNoncePDU">
          <xs:annotation>
             <xs:documentation xml:lang="en">
                Response message sent from DSKPP Client to
                DSKPP Server in a four-pass DSKPP session.
             </xs:documentation>
          </xs:annotation>
          <xs:complexContent mixed="false">
             <xs:extension base="dskpp:AbstractRequestType">
                <xs:sequence>
                   <xs:element name="EncryptedNonce"
                      type="xs:base64Binary"/>
                   <xs:element minOccurs="0" name="AuthenticationData"
                      type="dskpp:AuthenticationDataType" />
                   <xs:element minOccurs="0" name="Extensions"
                      type="dskpp:ExtensionsType" />
                </xs:sequence>
                <xs:attribute name="SessionID"
                   type="dskpp:IdentifierType" use="required"/>
             </xs:extension>
          </xs:complexContent>
       </xs:complexType>

       <xs:element name="KeyProvServerFinished"
          type="dskpp:KeyProvServerFinishedPDU">
          <xs:annotation>
             <xs:documentation>
                KeyProvServerFinished PDU
             </xs:documentation>
          </xs:annotation>
       </xs:element>
       <xs:complexType name="KeyProvServerFinishedPDU">
          <xs:annotation>
             <xs:documentation xml:lang="en">
                Final message sent from DSKPP Server to DSKPP Client in
                a DSKPP session.  A MAC value serves for key
                confirmation, and optional AuthenticationData serves for
                server authentication.
             </xs:documentation>
          </xs:annotation>
          <xs:complexContent mixed="false">
             <xs:extension base="dskpp:AbstractResponseType">

                <xs:sequence minOccurs="0">
                   <xs:element name="KeyPackage"
                      type="dskpp:KeyPackageType" />
                   <xs:element minOccurs="0" name="Extensions"
                      type="dskpp:ExtensionsType" />
                   <xs:element name="Mac" type="dskpp:MacType" />
                   <xs:element minOccurs="0" name="AuthenticationData"
                      type="dskpp:AuthenticationMacType" />
                </xs:sequence>
             </xs:extension>
          </xs:complexContent>
       </xs:complexType>
     </xs:schema>

9. Conformance Requirements โœจ

Okay, so the big goal here is making sure every DSKPP implementation can actually talk to every other one ๐Ÿซถ To get there, the DSKPP Server:

  • (a) MUST implement the four-pass variation of the protocol (Section 4)
  • (b) MUST implement the two-pass variation of the protocol (Section 5)
  • (c) MUST support user authentication (Section 3.2.1)
  • (d) MUST support the following key derivation functions:
    • DSKPP-PRF-AES DSKPP-PRF realization (Appendix D)
    • DSKPP-PRF-SHA256 DSKPP-PRF realization (Appendix D)
  • (e) MUST support the following encryption mechanisms for protection of the client nonce in the four-pass protocol:
    • Mechanism described in Section 4.2.4
  • (f) MUST support one of the following encryption algorithms for symmetric key operations, e.g., key wrap:
  • (g) MUST support the following encryption algorithms for asymmetric key operations, e.g., key transport:
    • RSA Encryption Scheme [PKCS-1]
  • (h) MUST support the following integrity/KDF MAC functions:
    • DSKPP-PRF-AES (Appendix D)
    • DSKPP-PRF-SHA256 (Appendix D)
  • (i) MUST support the PSKC key package [RFC6030]; all three PSKC key protection methods (Key Transport, Key Wrap, and Passphrase-Based Key Wrap) MUST be implemented
  • (j) MAY support the ASN.1 key package as defined in [RFC6031]

DSKPP Clients have their own checklist too ๐Ÿ’– They MUST support either the two-pass or the four-pass variant of the protocol, and they MUST fulfill all requirements listed in item (c) - (j).

Finally, implementations of DSKPP MUST bind DSKPP messages to HTTP/1.1 as described in Section 7.2. ๐ŸŽ€

Of course, DSKPP is a security protocol, and one of its major functions is to allow only authorized parties to successfully initialize a cryptographic module with a new symmetric key. ๐Ÿ” Therefore, a particular implementation may be configured with any of a number of restrictions concerning algorithms and trusted authorities that will prevent universal interoperability. It's giving "locked down on purpose" energy, ngl ๐Ÿ’…

10. Security Considerations ๐Ÿ”ฅ

10.1. General

Main character security moment ๐Ÿ˜ญ DSKPP is designed to protect generated keying material from exposure. No entities other than the DSKPP Server and the cryptographic module will have access to a generated K_TOKEN if the cryptographic algorithms used are of sufficient strength and, on the DSKPP Client side, generation and encryption of R_C and generation of K_TOKEN take place as specified in the cryptographic module. This applies even if malicious software is present in the DSKPP Client. ๐Ÿ’€

However, as discussed in the following sub-sections, DSKPP does not protect against certain other threats resulting from man-in-the-middle attacks and other forms of attacks. DSKPP MUST, therefore, be run over a transport providing confidentiality and integrity, such as HTTP over Transport Layer Security (TLS) with a suitable ciphersuite [RFC2818], when such threats are a concern. Note that TLS ciphersuites with anonymous key exchanges are not suitable in those situations [RFC5246]. ๐Ÿ™ˆ

10.2. Active Attacks

10.2.1. Introduction

Okay, the attacker energy here is villain-coded ๐Ÿ‘‘ An active attacker MAY attempt to modify, delete, insert, replay, or reorder messages for a variety of purposes, including service denial and compromise of generated keying material. ๐Ÿฆ‹

10.2.2. Message Modifications ๐ŸŽ€

okay so modifying a <KeyProvTrigger> message can go two ways ๐Ÿ˜ญ. Either it causes denial of service (if someone messes with any of the identifiers or the Authentication Code), or it makes the DSKPP Client contact the wrong DSKPP Server. That second one is basically a man-in-the-middle attack, and we dig into it more in Section 10.2.7 ๐Ÿ’….

Next up, an attacker can modify a <KeyProvClientHello> message ๐Ÿ‘€. So they could point at a different key or device than the one the DSKPP Client meant, and they could also suggest cryptographic algorithms that aren't the ones the client prefers, like weaker ones. They could even suggest earlier DSKPP versions, in case those have known vulnerabilities ๐Ÿ’€. All of this could let an attacker initialize or modify a different cryptographic module than the intended one (so the server assigns the generated key to the wrong module), or get access to a generated key by exploiting weak algorithms or protocol versions. To guard against the second kind, DSKPP implementations MAY have strict policies about which versions and algorithms they support and accept ๐Ÿ›ก๏ธ. The first threat, assigning a generated key to the wrong module, isn't possible when the shared-key variant of DSKPP is used (assuming existing shared keys are unique per cryptographic module). It is possible in the public key variation, though ๐Ÿ˜ฌ. So DSKPP Servers MUST NOT accept unilaterally provided device identifiers in the public key variation. The protocol description says this too ๐Ÿซถ. In the shared-key variation, an attacker might still provide the wrong identifier (which could also end up associating the wrong user with the generated key), but only if they have real-time access to the cryptographic module holding the identified key. The result could be that the generated key is tied to the right cryptographic module, but that module is tied to the wrong user ๐Ÿ˜ฑ. Check out Section 10.5 for more on this threat and how to counter it โœจ.

An attacker may also modify a <KeyProvServerHello> message ๐Ÿง. That means they could point to different key types, algorithms, or protocol versions than the legit server would, like weaker ones. They might also give a different nonce than the one the legitimate server sent. Clients MAY protect against the first by strictly sticking to their policies on permissible algorithms and protocol versions ๐ŸŒธ. The second one (the wrong nonce) isn't a security problem, since a generated key won't match the key generated on the legitimate server ๐Ÿ™Œ. Also, whenever a DSKPP run would replace an existing key, the <Mac> element protects against modifications of R_S ๐Ÿ”’.

Modifying <KeyProvClientNonce> messages is also on the table ๐Ÿ‘€. 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. Even so, the attacker still can't learn a generated K_TOKEN, because R_C was wrapped for the legitimate server ๐Ÿ”. Changing the <EncryptedNonce> element, like swapping in a value where the attacker knows the underlying R'C, won't make the client change its pre-DSKPP state. The reason is the server won't be able to provide a valid MAC in its final message to the client ๐Ÿ™…โ€โ™€๏ธ. The server MAY, however, end up storing K'TOKEN instead of K_TOKEN. If the cryptographic module has been tied to a particular user, that could be a real security problem ๐Ÿ˜ฌ. Check Section 10.5 below for more on this threat and a possible countermeasure. Also, heads up: using TLS doesn't protect against this attack if the attacker has access to the DSKPP Client (for example through malicious software, "Trojans") [RFC5246] ๐Ÿ’€.

Last but not least, attackers may also modify the <KeyProvServerFinished> message ๐Ÿ‘ป. Replacing the <Mac> element only leads to denial of service. Replacing any other element may make the DSKPP Client associate, for instance, the wrong service with the generated key ๐Ÿ˜ญ. DSKPP SHOULD be run over a transport providing confidentiality and integrity when this is a concern ๐Ÿซถ.

10.2.3. Message Deletion ๐Ÿ—‘๏ธ

deleting messages only causes denial of service, no other harm ๐Ÿ™Œ. That's because a cryptographic module MUST NOT change its state (aka "commit" to a generated key) until it gets the final message from the DSKPP Server and has successfully processed it, including validating its MAC โœจ. A deleted <KeyProvServerFinished> message won't leave the server in an inconsistent state with respect to the cryptographic module, as long as the server follows the suggestions in Section 10.5 ๐ŸŽ€.

10.2.4. Message Insertion ๐Ÿ’Œ

an active attacker can start a DSKPP run whenever they want and suggest any device identifier ๐Ÿ‘€. DSKPP Server implementations MAY get some protection against accidentally initializing a key, accidentally replacing an existing key, or assigning a key to a cryptographic module, by starting the DSKPP run with the <KeyProvTrigger> ๐Ÿ›ก๏ธ. The <AuthenticationData> element lets the server tie a DSKPP run to, for example, an earlier user-authenticated session ๐Ÿงฉ. So how secure this is depends on being able to protect the <AuthenticationData> element in the DSKPP initialization message ๐Ÿ”’. If an eavesdropper can capture that message, they might race the legit user for a key initialization ๐Ÿƒโ€โ™€๏ธ๐Ÿ’จ. DSKPP over a transport providing confidentiality and integrity, plus the recommendations in Section 10.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 ๐Ÿค“.

10.2.5. Message Replay ๐Ÿ”

during four-pass DSKPP, attempts to replay a previously recorded DSKPP message get detected ๐Ÿ•ต๏ธโ€โ™€๏ธ. That's because the nonces make sure both parties are live. For example, a DSKPP Client knows the server it's talking to is "live" since the server MUST create a MAC on information sent by the client ๐Ÿ’–.

The same goes for two-pass DSKPP, thanks to the requirement that the client sends R in the <KeyProvClientHello> message and the server includes R in the MAC computation ๐Ÿฆ‹.

10.2.6. Message Reordering ๐Ÿ”€

an attacker might try to reorder four-pass DSKPP messages, but that gets detected because each message is of a unique type ๐Ÿ™Œ. Note: message re-ordering attacks can't happen in two-pass DSKPP, since each party sends at most one message each ๐Ÿงš.

10.2.7. Man in the Middle ๐Ÿ•ด๏ธ

on top of other active attacks, an attacker posing as a man in the middle might be able to give their own public key to the DSKPP Client ๐Ÿ˜ฑ. This threat and its countermeasures are discussed in Section 4.1.1. An attacker posing as a man in the middle could also act as a proxy, so they might not interfere with DSKPP runs at all, but still learn valuable info. See Section 10.3 for that ๐Ÿ‘€.

10.3. Passive Attacks ๐Ÿ‘‚

passive attackers can eavesdrop on DSKPP runs to learn info that could later be used to impersonate users, mount active attacks, and so on ๐Ÿ•ต๏ธ.

If DSKPP isn't run over a transport providing confidentiality, a passive attacker may learn:

  • What cryptographic modules a particular user possesses
  • The identifiers of keys on those cryptographic modules and other attributes pertaining to those keys, e.g., the lifetime of the keys
  • DSKPP versions and cryptographic algorithms supported by a particular DSKPP Client or server
  • Any value present in an <extension> that is part of <KeyProvClientHello>

Whenever the above is a concern, DSKPP MUST be run over a transport providing confidentiality ๐Ÿ”. If man-in-the-middle attacks for the purposes described above are a concern, the transport MUST also offer server-side authentication ๐Ÿซถ.

10.4. Cryptographic Attacks ๐Ÿงช

an attacker with unlimited access to an initialized cryptographic module may use the module as an "oracle" to pre-compute values that could later be used to impersonate the DSKPP Server ๐Ÿ˜ณ. Section 4.1.1 talks about this threat and the steps RECOMMENDED to protect against it.

Implementers are advised that cryptographic algorithms get weaker over time ๐Ÿ“‰. As new cryptographic techniques are developed and computing performance improves, the work factor to break a particular algorithm goes down. So cryptographic algorithm implementations SHOULD be modular, so new algorithms can be easily swapped in ๐Ÿงฉ. In other words, implementers SHOULD be prepared to regularly update the algorithms in their implementations ๐Ÿ’….

10.5. Attacks on the Interaction between DSKPP and User Authentication ๐Ÿ”

if keys generated in DSKPP will be tied to a particular user at the DSKPP Server (or a server trusted by, and communicating with, the DSKPP Server), then here's the deal ๐Ÿง . To protect against threats where an attacker swaps a client-provided encrypted R_C for their own R'C (whether the public key variation or the shared-secret variation of DSKPP is used to encrypt the client nonce), the server SHOULD NOT commit to associating a generated K_TOKEN with the given cryptographic module until the user has simultaneously proven two things: possession of the device hosting the cryptographic module containing K_TOKEN, and some out-of-band provided authenticating info (e.g., an Authentication Code) ๐Ÿ”‘. For example, if the cryptographic module is a one-time password token, the user could be required to authenticate with both a one-time password generated by the module and an out-of-band provided Authentication Code. Only then does the server "commit" to the generated OTP value for the given user ๐ŸŽŸ๏ธ. Preferably, the user SHOULD do this from a different host than the one used to initialize keys on the cryptographic module, to minimize the risk of malicious software on the client interfering with the process ๐Ÿ›ก๏ธ.

Note: this scenario, where the attacker replaces a client-provided R_C with their own R'C, doesn't apply to two-pass DSKPP, since the client doesn't provide any entropy to K_TOKEN ๐Ÿ™ˆ. The attack itself (and its countermeasures) still applies to two-pass DSKPP, though, because it's essentially a man-in-the-middle attack ๐ŸŒธ.

another threat happens when an attacker tricks a user into authenticating to them instead of the legit service before the DSKPP run ๐Ÿ˜ˆ. If that works, the attacker can impersonate the user toward the legit service and then get a valid DSKPP trigger. If the public key variant of DSKPP is used, the attacker might be able to impersonate the user even after a successful DSKPP run ๐Ÿ˜ฑ. So ordinary precautions MUST be in place to make sure users authenticate only to legitimate services ๐Ÿซถ.

10.6. Miscellaneous Considerations โœจ

10.6.1. Client Contributions to K_TOKEN Entropy ๐ŸŽ€

okay so in four-pass DSKPP, the client AND the server both throw randomizing material into K_TOKEN, and each side can check that their bit actually made it in ๐Ÿ’…. In the two-pass version we're defining here, only the server contributes entropy to K_TOKEN ๐Ÿ˜ญ. That means a broken or compromised (pseudo)random number generator in the server can do more damage than it would in the four-pass variant. Server implementations SHOULD therefore take extreme care to ensure that this situation does not occur. ๐Ÿซถ

10.6.2. Key Confirmation ๐Ÿฆ‹

in four-pass DSKPP, Servers give key confirmation through the MAC on R_C inside the <KeyProvServerFinished> message. In the two-pass variant we're describing, key confirmation comes from the MAC that includes R, using K_MAC. โœจ

10.6.3. Server Authentication ๐Ÿ”

DSKPP Servers MUST authenticate themselves whenever a successful DSKPP two-pass protocol run would swap an existing K_TOKEN out for a K_TOKEN'. Otherwise an unauthorized DSKPP Server could replace a K_TOKEN with some other key, which is a denial-of-service attack, and that is NOT it, bestie ๐Ÿ’€. In two-pass DSKPP, servers prove who they are by including the AuthenticationDataType extension, which carries a MAC as described in Section 5 for two-pass DSKPP.

Whenever a successful DSKPP two-pass protocol run would replace an existing K_TOKEN with a K_TOKEN', the DSKPP Client and Server MUST do the following to stop an unauthorized DSKPP Server from swapping in another key:

  • The DSKPP Server MUST use the AuthenticationDataType extension to transmit a second MAC, calculated as described in Section 5.2.2.
  • The DSKPP Client MUST authenticate the server using the MAC contained in the AuthenticationDataType extension received from the DSKPP Server to which it is connected.

10.6.4. User Authentication ๐Ÿงš

a DSKPP Server MUST authenticate a client so K_TOKEN only lands on the intended device. These measures SHOULD be considered:

  • When an Authentication Code is used for client authentication, a password dictionary attack on the Authentication Data is possible. ๐Ÿ™ˆ
  • The length of the Authentication Code when used over a non-secure channel SHOULD be longer than what is used over a secure channel. If a device (think some mobile phones with small screens) can't handle a long Authentication Code in a user-friendly way, DSKPP SHOULD rely on a secure channel for communication.
  • If a non-secure channel has to be used, the Authentication Code SHOULD be sent to the server MAC'd as specified in Section 3.4.1. The Authentication Code and nonce value MUST be strong enough to prevent offline brute-force recovery of the Authentication Code from the Hashed MAC (HMAC) data. The nonce value goes over the wire in plaintext on a non-secure transport, so the cryptographic strength of the Authentication Data depends more on the quality of the Authentication Code. ๐Ÿ”
  • When the Authentication Code is sent from the DSKPP Server to the device in a DSKPP initialization trigger message, an eavesdropper may be able to capture this message and race the legitimate user for a key initialization. To prevent this, the transport layer used to send the DSKPP trigger MUST provide confidentiality and integrity, e.g. a secure browser session. ๐Ÿ”’

10.6.5. Key Protection in Two-Pass DSKPP ๐Ÿ‘‘

three key protection methods are defined for the different usages of two-pass DSKPP, and they MUST be supported by a key package format, such as [RFC6030] and [RFC6031]. So key protection in two-pass DSKPP is only as strong as the key package format picked for a protocol run. Here are some considerations for the Passphrase-Based Key Wrap method ๐ŸŒธ.

The Passphrase-Based Key Wrap method SHOULD depend upon the PBKDF2 function from [PKCS-5] to generate an encryption key from a passphrase and salt string. Real talk though: passphrase-based encryption is generally limited in the security it provides, even with the salt and iteration count in PBKDF2 raising the complexity of an attack. Implementations SHOULD therefore take additional measures to strengthen the security of the Passphrase-Based Key Wrap method. These measures SHOULD be considered where applicable:

  • The passphrase is the same as the one-time password component of the Authentication Code (see Section 3.4.1) for a description of the AC format). The passphrase SHOULD be selected well, and usage guidelines such as the ones in [NIST-PWD] SHOULD be taken into account. ๐Ÿง 
  • A different passphrase SHOULD be used for every key initialization wherever possible (a global passphrase shared across a batch of cryptographic modules SHOULD be avoided, for example). One way to get there is to use randomly generated passphrases. ๐ŸŽฒ
  • The passphrase SHOULD be protected well if it's stored on the server and/or on the cryptographic module, and SHOULD be delivered to the device's user using secure methods. ๐Ÿ—๏ธ
  • User pre-authentication SHOULD be implemented so K_TOKEN is not delivered to a rogue recipient. ๐Ÿšซ
  • The iteration count in PBKDF2 SHOULD be high to impose more work for an attacker using brute-force methods (see [PKCS-5] for recommendations). However, it MUST be noted that the higher the count, the more work is required on the legitimate cryptographic module to decrypt the newly delivered K_TOKEN. Servers MAY use relatively low iteration counts to accommodate devices with limited processing power, such as some PDA and cell phones, when other security measures are implemented and the security of the Passphrase-Based Key Wrap method is not weakened. ๐Ÿ”‹
  • TLS [RFC5246] SHOULD be used where possible to protect a two-pass protocol run. Transport level security gives K_TOKEN a second layer of protection. ๐Ÿ›ก๏ธ

10.6.6. Algorithm Agility ๐Ÿ”„

many protocols need to be algorithm agile. Back in the day, lots of protocols had fixed-size fields for things like hash outputs and keys, and DSKPP doesn't do that, except for the key size in the computation of DSKPP-PRF. Another reason was that protocols didn't support algorithm negotiation, and DSKPP does, except for the use of SHA-256 in the MAC confirmation message. Updating the key size for DSKPP-PRF, or the MAC confirmation message algorithm, will require a new version of the protocol, which is supported with the Version attribute. ๐Ÿ’œ

11. Internationalization Considerations ๐ŸŒˆ

DSKPP is built for machine-to-machine communication, so its elements are tokens that aren't meant for direct human consumption ๐Ÿค–. DSKPP exchanges information using XML. All XML processors are required to understand UTF-8 [RFC3629] encoding, so all DSKPP Clients and servers MUST understand UTF-8 encoded XML. On top of that, DSKPP Servers and clients MUST NOT encode XML with encodings other than UTF-8. ๐Ÿ“

12. IANA Considerations ๐Ÿ“

this document needs several IANA registrations, detailed below โœจ.

12.1. URN Sub-Namespace Registration ๐ŸŽ€

this section registers a new XML namespace, "urn:ietf:params:xml:ns:keyprov:dskpp", per the guidelines in [RFC3688]:

URI:  urn:ietf:params:xml:ns:keyprov:dskpp
Registrant Contact:
   IETF, KEYPROV Working Group (keyprov@ietf.org), Andrea Doherty
   (andrea.doherty@rsa.com)

XML:
   BEGIN
      <?xml version="1.0"?>
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
      <head>
         <title>DSKPP Messages</title>
      </head>
      <body>
         <h1>Namespace for DSKPP Messages</h1>
         <h2>urn:ietf:params:xml:ns:keyprov:dskpp</h2>
         <p>See RFC 6063</p>
      </body>
      </html>
   END

12.2. XML Schema Registration ๐Ÿง

this section registers an XML schema per the guidelines in [RFC3688]:

URI:  urn:ietf:params:xml:ns:keyprov:dskpp
Registrant Contact:
   IETF, KEYPROV Working Group (keyprov@ietf.org), Andrea Doherty
   (andrea.doherty@rsa.com)
Schema:
   The XML for this schema can be found as the entirety of Section 8
   of this document.

12.3. MIME Media Type Registration ๐Ÿ’–

this section registers the "application/dskpp+xml" MIME type:

To:  ietf-types@iana.org
Subject:  Registration of MIME media type application/dskpp+xml
MIME media type name:  application
MIME subtype name:  dskpp+xml
Required parameters:  (none)
Optional parameters:  charset
   Indicates the character encoding of enclosed XML.
Encoding considerations:  Uses XML, which can employ 8-bit
   characters, depending on the character encoding used.  See
   [RFC3023], Section 3.2.  Implementations need to support UTF-8
   [RFC3629].
Security considerations:  This content type is designed to carry
   protocol data related to key management.  Security mechanisms are
   built into the protocol to ensure that various threats are dealt
   with.  Refer to Section 10 of RFC 6063 for more details
Interoperability considerations:  None
Published specification:  RFC 6063.
Applications that use this media type:  Protocol for key exchange.
Additional information:
   Magic Number(s): (none)
   File extension(s): .xmls
   Macintosh File Type Code(s): (none)
Person & email address to contact for further information:
   Andrea Doherty (andrea.doherty@rsa.com)
Intended usage:  LIMITED USE
Author/Change controller:  The IETF
Other information:  This media type is a specialization of
   application/xml [RFC3023], and many of the considerations
   described there also apply to application/dskpp+xml.

12.4. Status Code Registration ๐Ÿšฆ

this section registers the status codes included in each DSKPP response message. The status codes are defined in the schema in the <StatusCode> type definition contained in the XML schema in Section 8. Here's the registry summary:

Related Registry:
   KEYPROV DSKPP Registries, Status codes for DSKPP

Defining RFC:
   RFC 6063.

Following the policies outlined in [RFC3575], new values for the DSKPP status codes MUST be assigned under the "Specification Required" policy, and their meanings MUST be documented in an RFC or in some other permanent and readily available reference, in enough detail that interoperability between independent implementations is possible. There's no mechanism to mark entries as "deprecated" (that's not envisioned), but entries can be updated from the registry. ๐Ÿงพ

Registrant Contact:
   IETF, KEYPROV working group (keyprov@ietf.org),
   Andrea Doherty (andrea.doherty@rsa.com)

12.5. DSKPP Version Registration ๐Ÿฆ‹

this section registers DSKPP version numbers. The registry has this structure:

+-------------------------------------------+
|  DSKPP Version    | Specification         |
+-------------------------------------------+
|  1.0              | This document         |
+-------------------------------------------+

Standards action is required to define new versions of DSKPP. Nobody's planning to deprecate, delete, or modify existing DSKPP versions ๐ŸŒˆ.

12.6. PRF Algorithm ID Sub-Registry ๐Ÿ”ฎ

okay bestie, so this spec leans on a crypto primitive called "DSKPP-PRF" ๐Ÿ’… It's a deterministic transformation: you feed it a secret key k and a varying-length octet string s, and it spits out a bit string of the specified length dsLen โœจ From the point of view of this spec, DSKPP-PRF is a "black-box" function. Given the inputs, it generates a pseudorandom value that can be realized by any appropriate and competent cryptographic technique ๐Ÿง  Section 3.4.2 gives us two realizations, DSKPP-PRF-AES and DSKPP-PRF-SHA256.

This section registers the identifiers for those realizations ๐ŸŽ€ PRF Algorithm ID Sub-registries are subject to "Specification Required" as per RFC 5226 [RFC5226]. Updates MUST be documented in an RFC or in some other permanent and readily available reference, in enough detail that independent implementations can actually interoperate ๐Ÿซถ

Expert approval is required to deprecate a sub-registry ๐Ÿ‘‘ Once it's deprecated, the PRF Algorithm ID SHOULD NOT be used in any new implementations. Bye bye ๐Ÿ‘‹

12.6.1. DSKPP-PRF-AES ๐Ÿฆ‹

This bit registers the following in the IETF XML namespace registry:

Common Name:
   DSKPP-PRF-AES

URI:
   urn:ietf:params:xml:ns:keyprov:dskpp:prf-aes-128

Identifier Definition:
   The DSKPP-PRF-AES algorithm realization is defined in
   Appendix D.2.2 of this document.

Registrant Contact:
   IETF, KEYPROV working group (keyprov@ietf.org),
   Andrea Doherty (andrea.doherty@rsa.com)

12.6.2. DSKPP-PRF-SHA256 ๐ŸŒธ

Same energy here: this section registers the following in the IETF XML namespace registry ๐Ÿ’–

Common Name:
   DSKPP-PRF-SHA256

URI:
   urn:ietf:params:xml:ns:keyprov:dskpp:prf-sha256

Identifier Definition:
   The DSKPP-PRF-SHA256 algorithm realization is defined in
   Appendix D.3.2 of this document.

Registrant Contact:
   IETF, KEYPROV working group (keyprov@ietf.org),
   Andrea Doherty (andrea.doherty@rsa.com)

12.7. Key Container Registration ๐ŸŽ

this section registers the Key Container type โœจ Key Container is the registration name, and the spec describes it as a key package format that says how a key should be protected using the three key protection methods from Section 5.1. Iconic ๐Ÿ˜ญ

Registration-wise, we follow the policies in [RFC3575]. The IANA policy for assigning new status code values for DSKPP MUST be "Specification Required", and their meanings MUST be documented in an RFC or some other permanent and readily available reference, in enough detail for independent implementations to interoperate ๐Ÿ“œ

Deprecated is TRUE if, based on expert approval, the entry has been deprecated and SHOULD NOT be used in any new implementations. Otherwise it's FALSE ๐Ÿ™ˆ

The initial URIs for the Key Container, defined for this version of the document, are these:

Name:  PSKC Key Container
URI:  urn:ietf:params:xml:ns:keyprov:dskpp:pskc-key-container
Specification:  [RFC6030]
Deprecated:  FALSE

Name:  SKPC Key Container
URI:  urn:ietf:params:xml:ns:keyprov:dskpp:skpc-key-container
Specification:  [RFC6031]
Deprecated:  FALSE

Name:  PKCS12 Key Container
URI:  urn:ietf:params:xml:ns:keyprov:dskpp:pkcs12-key-container
Specification:  [PKCS-12]
Deprecated:  FALSE

Name:  PKCS5-XML Key Container
URI:  urn:ietf:params:xml:ns:keyprov:dskpp:pkcs5-xml-key-container
Specification:  [PKCS-5-XML]
Deprecated:  FALSE

Registrant Contact is the IETF, KEYPROV working group (keyprov@ietf.org), and Andrea Doherty (andrea.doherty@rsa.com) ๐Ÿ’œ

13. Intellectual Property Considerations โš–๏ธ

okay, legal but make it cute RSA and RSA Security are registered trademarks or trademarks of RSA Security, Inc. in the United States and/or other countries ๐Ÿ“ Any other products and services mentioned may be trademarks of their respective owners ๐Ÿ’…

14. Contributors ๐Ÿซถ

this work is based on information from [RFC4758], authored by Magnus Nystrom ๐ŸŒˆ It also borrows enhancements from an individual document coauthored by Mingliang Pei and Salah Machani, like user authentication and support for multiple key package formats ๐Ÿ”ฅ

big thanks to Philip Hoyer for his work aligning DSKPP and PSKC schemas ๐Ÿงš We'd also love to thank Hannes Tschofenig and Phillip Hallam-Baker for their reviews, feedback, and text contributions ๐Ÿ’–

15. Acknowledgements ๐ŸŒŸ

we're so grateful to everyone who reviewed previous DSKPP document versions ๐Ÿฅน

  • Dr. Ulrike Meyer (Review June 2007)
  • Niklas Neumann (Review June 2007)
  • Shuh Chang (Review June 2007)
  • Hannes Tschofenig (Review June 2007 and again in August 2007)
  • Sean Turner (Reviews August 2007 and again in July 2008)
  • John Linn (Review August 2007)
  • Philip Hoyer (Review September 2007)
  • Thomas Roessler (Review November 2007)
  • Lakshminath Dondeti (Comments December 2007)
  • Pasi Eronen (Comments December 2007)
  • Phillip Hallam-Baker (Review and Edits November 2008 and again in January 2009)
  • Alexey Melnikov (Review May 2010)
  • Peter Saint-Andre (Review May 2010)

And a big shoutout to these folks for their input on selected design aspects of DSKPP ๐Ÿ“ฃ

  • Anders Rundgren (Key Package Format and Client Authentication Data)
  • Thomas Roessler (HTTP Binding)
  • Hannes Tschofenig (HTTP Binding)
  • Phillip Hallam-Baker (Registry for Algorithms)
  • N. Asokan (original observation of weakness in Authentication Data)

Finally, Robert Griffin opened communication channels for us with the IEEE P1619.3 Key Management Group, and helped our groups stay informed about potential areas of collaboration (especially key provisioning and global key identifiers) ๐ŸŒˆโœจ

16. References ๐Ÿ“š

16.1. Normative References ๐Ÿฆ‹

16.2. Informative References ๐Ÿ“š๐Ÿ’–

okay bestie, these are the extra-credit reads, the stuff that's helpful to know but isn't required to follow the spec ๐Ÿง โœจ

[CT-KIP-P11]      RSA Laboratories, "PKCS #11 Mechanisms for the
                  Cryptographic Token Key Initialization Protocol",
                  PKCS #11 Version 2.20 Amd.2, December 2005,
                  <http://www.rsasecurity.com/rsalabs/pkcs/>.

[FAQ]             RSA Laboratories, "Frequently Asked Questions About
                  Today's Cryptography",  Version 4.1, 2000.

[NIST-PWD]        National Institute of Standards and Technology,
                  "Password Usage", FIPS 112, May 1985,
                  <http://www.itl.nist.gov/fipspubs/fip112.htm>.

[NIST-SP800-38B]  International Organization for Standardization,
                  "Recommendations for Block Cipher Modes of
                  Operation: The CMAC Mode for Authentication",
                  NIST SP800-38B, May 2005, <http://csrc.nist.gov/
                  publications/nistpubs/800-38B/SP_800-38B.pdf>.

[NIST-SP800-57]   National Institute of Standards and Technology,
                  "Recommendation for Key Management - Part I:
                  General (Revised)", NIST 800-57, March 2007, <http:
                  //csrc.nist.gov/publications/nistpubs/800-57/
                  sp800-57-Part1-revised2_Mar08-2007.pdf>.

[PKCS-11]         RSA Laboratories, "Cryptographic Token Interface
                  Standard", PKCS #11 Version 2.20, June 2004,
                  <http://www.rsasecurity.com/rsalabs/pkcs/>.

[PKCS-12]         "Personal Information Exchange Syntax Standard",
                  PKCS #12 Version 1.0, 2005, <ftp://
                  ftp.rsasecurity.com/pub/pkcs/pkcs-12/
                  pkcs-12v1.pdf>.

[RFC2818]         Rescorla, E., "HTTP Over TLS", RFC 2818, May 2000.

[RFC3023]         Murata, M., St. Laurent, S., and D. Kohn, "XML
                  Media Types", RFC 3023, January 2001.

[RFC3575]         Aboba, B., "IANA Considerations for RADIUS (Remote
                  Authentication Dial In User Service)", RFC 3575,
                  July 2003.

[RFC3688]         Mealling, M., "The IETF XML Registry", BCP 81,
                  RFC 3688, January 2004.

[RFC3986]         Berners-Lee, T., Fielding, R., and L. Masinter,
                  "Uniform Resource Identifier (URI): Generic
                  Syntax", STD 66, RFC 3986, January 2005.

[RFC4758]         Nystroem, M., "Cryptographic Token Key
                  Initialization Protocol (CT-KIP) Version 1.0
                  Revision 1", RFC 4758, November 2006.

[RFC5226]         Narten, T. and H. Alvestrand, "Guidelines for
                  Writing an IANA Considerations Section in RFCs",
                  BCP 26, RFC 5226, May 2008.

[RFC5246]         Dierks, T. and E. Rescorla, "The Transport Layer
                  Security (TLS) Protocol Version 1.2", RFC 5246,
                  August 2008.

[RFC6031]         Turner, S. and R. , "Cryptographic Message Syntax
                  (CMS) Symmetric Key Package Content Type",
                  RFC 6031, December 2010.

[XMLNS]           W3C, "Namespaces in XML", W3C Recommendation,
                  January 1999,
                  <http://www.w3.org/TR/2009/REC-xml-names-20091208>.

Appendix A. Usage Scenarios ๐ŸŒˆ

okay so this appendix is a tour of all the different situations where DSKPP gets used to provision symmetric keys onto cryptographic modules ๐Ÿ”‘ every scenario has its own special needs, so we're going through them one by one ๐Ÿ’… this appendix forms an informative part of the document โœจ

A.1. Single Key Request ๐ŸŽ€

the classic one: a cryptographic module asks a provisioning server for a symmetric key ๐Ÿ™‹โ€โ™€๏ธ that server can live on the local network or out on the Internet somewhere ๐ŸŒ depending on the setup, the server might whip up a brand new key on-the-fly, or it might grab a pre-generated one, like one from a legacy back-end issuance server ๐Ÿ—„๏ธ either way, the server gives the key a unique key ID and then provisions it to the module ๐Ÿ”

A.2. Multiple Key Requests ๐Ÿงš

same vibe, but now the cryptographic module is asking for several keys from the same provisioning server ๐Ÿ” and the keys don't all have to be the same type ๐Ÿ™ƒ they can be used with different symmetric key algorithms, including one-time password authentication algorithms, plus the AES encryption algorithm ๐Ÿ’œ

A.3. User Authentication ๐Ÿ”

sometimes a key issuer hands the provisioning work off to a third-party provisioning service ๐Ÿค in that case, the issuer points the module's provisioning requests over to that service ๐Ÿ“ฎ but here's the thing: it's the issuer's job to authenticate the user through some out-of-band means before giving him the rights to acquire keys ๐Ÿ‘€ once the issuer okays it, they give the user an Authentication Code and make it available to the provisioning service, so the user can prove they're allowed to get keys ๐ŸŽŸ๏ธ main character energy for the issuer, no cap ๐Ÿ‘‘

A.4. Provisioning Time-Out Policy โฐ

an issuer can give a user a time-limited Authentication Code during registration ๐Ÿ“ the user then types that code into the cryptographic module so it can authenticate itself with the provisioning server ๐Ÿ–Š๏ธ the server only lets a key get provisioned to the module on the user's device, when user authentication is needed, if the user enters a valid Authentication Code within the fixed time period the issuer set up โณ tick tock bestie ๐Ÿ˜ญ

A.5. Key Renewal ๐Ÿ”„

here the cryptographic module asks for renewal of the symmetric key material attached to a key ID ๐Ÿซถ the key ID stays the same, but the key value gets refreshed, instead of keeping the key value constant and just refreshing the metadata ๐Ÿ™…โ€โ™€๏ธ this comes up when a user wants to upgrade the device that houses the cryptographic module, or when a key has expired ๐Ÿ“… and when someone uses the same cryptographic module to do strong authentication at multiple Web login sites, keeping the same key ID means they don't have to register a brand new key ID at every single site ๐Ÿ™Œ so efficient, iykyk

A.6. Pre-Loaded Key Replacement ๐Ÿ“

this one is a special case of symmetric key renewal ๐Ÿง a local administrator can authenticate the user procedurally before the provisioning process kicks off ๐Ÿ“‹ it also lets a device issuer pre-load a key onto a cryptographic module, with the restriction that the key gets replaced with a new key before the module is used ๐Ÿšซ another variation is an organization that recycles devices โ™ป๏ธ in that case, a key issuer provisions a new symmetric key to a cryptographic module on a device that was previously owned by another user ๐Ÿงผ

note: this scenario is basically the same as the previous one, where the same key ID gets used for renewal ๐Ÿคญ

A.7. Pre-Shared Manufacturing Key ๐Ÿชช

okay this one is giving smart card ๐Ÿ’ณ a cryptographic module gets loaded onto a smart card after the card is already issued to a user ๐Ÿ“ฆ the symmetric key for that module then gets provisioned using a secure channel mechanism that's built into many smart card platforms ๐Ÿ”’ that makes a direct secure channel between the smart card chip and the provisioning server โšก for example, the card commands (aka Application Protocol Data Units, or APDUs) are encrypted with a pre-issued card manufacturer's key and sent straight to the smart card chip ๐ŸŽฏ that's how you get secure post-issuance, in-the-field provisioning โœจ and this secure flow can pass Transport Layer Security (TLS) [RFC5246] and other transport security boundaries ๐Ÿ›ธ

two pre-conditions for this usage scenario: the protocol has to be tunneled, and the provisioning server has to know the correct pre-established manufacturer's key ๐Ÿ—๏ธ

A.8. End-to-End Protection of Key Material ๐Ÿ›ก๏ธ

this is the one where TLS does NOT give you end-to-end protection of the keying material going from the provisioning server to the cryptographic module ๐Ÿ˜ฌ for example, TLS might terminate at an application on a PC instead of at the cryptographic module (the endpoint) sitting on a data storage device [RFC5246] ๐Ÿ’€ the mutually authenticated key agreement is what gives end-to-end protection, since TLS can't provide that on its own ๐Ÿซฃ


Appendix B. Examples ๐Ÿ’–

okay so Appendix B is a showcase of example messages ๐ŸŽ€ they illustrate parameters, encoding, and semantics across both the four-pass and two-pass DSKPP exchanges โœจ the examples are written in XML and they're syntactically correct โœ… BUT the MAC and cipher values are fictitious, so don't go copying them ๐Ÿ™ˆ this appendix forms an informative part of the document ๐ŸŒธ

B.1. Trigger Message ๐Ÿงš

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<dskpp:KeyProvTrigger Version="1.0"
  xmlns:dskpp="urn:ietf:params:xml:ns:keyprov:dskpp"
  xmlns:pskc="urn:ietf:params:xml:ns:keyprov:pskc">
  <dskpp:InitializationTrigger>
    <dskpp:DeviceIdentifierData>
        <dskpp:DeviceId>
            <pskc:Manufacturer>TokenVendorAcme</pskc:Manufacturer>
            <pskc:SerialNo>987654321</pskc:SerialNo>
            <pskc:StartDate>2009-09-01T00:00:00Z</pskc:StartDate>
            <pskc:ExpiryDate>2014-09-01T00:00:00Z</pskc:ExpiryDate>
        </dskpp:DeviceId>
    </dskpp:DeviceIdentifierData>
    <dskpp:KeyID>SE9UUDAwMDAwMDAx</dskpp:KeyID>
    <dskpp:TokenPlatformInfo KeyLocation="Hardware"
      AlgorithmLocation="Software"/>
    <dskpp:AuthenticationData>
      <dskpp:ClientID>31300257</dskpp:ClientID>
      <dskpp:AuthenticationCodeMac>
        <dskpp:IterationCount>512</dskpp:IterationCount>
        <dskpp:Mac>4bRJf9xXd3KchKoTenHJiw==</dskpp:Mac>
      </dskpp:AuthenticationCodeMac>
    </dskpp:AuthenticationData>
    <dskpp:ServerUrl>keyprovservice.example.com
      </dskpp:ServerUrl>
  </dskpp:InitializationTrigger>
</dskpp:KeyProvTrigger>

B.2. Four-Pass Protocol ๐Ÿ”ฅ

B.2.1. <KeyProvClientHello> without a Preceding Trigger ๐Ÿ’…

 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 <dskpp:KeyProvClientHello
     xmlns:pskc="urn:ietf:params:xml:ns:keyprov:pskc"
     xmlns:dskpp="urn:ietf:params:xml:ns:keyprov:dskpp"
     xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"
     xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
     Version="1.0">
     <dskpp:DeviceIdentifierData>
         <dskpp:DeviceId>
             <pskc:Manufacturer>TokenVendorAcme</pskc:Manufacturer>
             <pskc:SerialNo>987654321</pskc:SerialNo>
             <pskc:StartDate>2009-09-01T00:00:00Z</pskc:StartDate>
             <pskc:ExpiryDate>2014-09-01T00:00:00Z</pskc:ExpiryDate>
         </dskpp:DeviceId>
     </dskpp:DeviceIdentifierData>
     <dskpp:SupportedKeyTypes>
         <dskpp:Algorithm>
             urn:ietf:params:xml:ns:keyprov:pskc:hotp
         </dskpp:Algorithm>
         <dskpp:Algorithm>
 http://www.rsa.com/rsalabs/otps/schemas/2005/09/otps-wst#SecurID-AES
         </dskpp:Algorithm>
     </dskpp:SupportedKeyTypes>
     <dskpp:SupportedEncryptionAlgorithms>
         <dskpp:Algorithm>
             http://www.w3.org/2001/04/xmlenc#aes128-cbc
         </dskpp:Algorithm>
     </dskpp:SupportedEncryptionAlgorithms>
     <dskpp:SupportedMacAlgorithms>
         <dskpp:Algorithm>
             urn:ietf:params:xml:ns:keyprov:dskpp:prf-sha256
         </dskpp:Algorithm>
     </dskpp:SupportedMacAlgorithms>
     <dskpp:SupportedProtocolVariants>
         <dskpp:FourPass/>
     </dskpp:SupportedProtocolVariants>
     <dskpp:SupportedKeyPackages>
         <dskpp:KeyPackageFormat>
             urn:ietf:params:xml:ns:keyprov:dskpp:pskc-key-container
         </dskpp:KeyPackageFormat>
     </dskpp:SupportedKeyPackages>
 </dskpp:KeyProvClientHello>

B.2.2. <KeyProvClientHello> Assuming a Preceding Trigger โœจ

okay so this one is the client hello when a trigger came first ๐Ÿ’– same energy as before, just with the setup already done bestie ๐Ÿซถ

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<dskpp:KeyProvClientHello
    xmlns:pskc="urn:ietf:params:xml:ns:keyprov:pskc"
    xmlns:dskpp="urn:ietf:params:xml:ns:keyprov:dskpp"
    xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"
    xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
    Version="1.0">
    <dskpp:DeviceIdentifierData>
        <dskpp:DeviceId>
            <pskc:Manufacturer>TokenVendorAcme</pskc:Manufacturer>
            <pskc:SerialNo>987654321</pskc:SerialNo>
            <pskc:StartDate>2009-09-01T00:00:00Z</pskc:StartDate>
            <pskc:ExpiryDate>2014-09-01T00:00:00Z</pskc:ExpiryDate>
        </dskpp:DeviceId>
    </dskpp:DeviceIdentifierData>
    <dskpp:KeyID>SE9UUDAwMDAwMDAx</dskpp:KeyID>
    <dskpp:SupportedKeyTypes>
        <dskpp:Algorithm>
            urn:ietf:params:xml:ns:keyprov:pskc:hotp
        </dskpp:Algorithm>
        <dskpp:Algorithm>
http://www.rsa.com/rsalabs/otps/schemas/2005/09/otps-wst#SecurID-AES
        </dskpp:Algorithm>
    </dskpp:SupportedKeyTypes>
    <dskpp:SupportedEncryptionAlgorithms>
        <dskpp:Algorithm>
            http://www.w3.org/2001/04/xmlenc#aes128-cbc
        </dskpp:Algorithm>
    </dskpp:SupportedEncryptionAlgorithms>
    <dskpp:SupportedMacAlgorithms>
        <dskpp:Algorithm>
            urn:ietf:params:xml:ns:keyprov:dskpp:prf-sha256
        </dskpp:Algorithm>
    </dskpp:SupportedMacAlgorithms>
    <dskpp:SupportedProtocolVariants>
      <dskpp:FourPass/>
    </dskpp:SupportedProtocolVariants>
    <dskpp:SupportedKeyPackages>
        <dskpp:KeyPackageFormat>
            urn:ietf:params:xml:ns:keyprov:dskpp:pskc-key-container
        </dskpp:KeyPackageFormat>
    </dskpp:SupportedKeyPackages>
</dskpp:KeyProvClientHello>

B.2.3. <KeyProvServerHello> Without a Preceding Trigger

now the server answers ๐Ÿฆ‹ this is the hello with no trigger in front of it, and look at that Status="Continue" and SessionID="4114" serving ๐Ÿ”ฅ

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<dskpp:KeyProvServerHello
    xmlns:pskc="urn:ietf:params:xml:ns:keyprov:pskc"
    xmlns:dskpp="urn:ietf:params:xml:ns:keyprov:dskpp"
    xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"
    xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
    Version="1.0"
    Status="Continue"
    SessionID="4114">
    <dskpp:KeyType>
        urn:ietf:params:xml:ns:keyprov:pskc:hotp
    </dskpp:KeyType>
    <dskpp:EncryptionAlgorithm>
        http://www.w3.org/2001/04/xmlenc#aes128-cbc
    </dskpp:EncryptionAlgorithm>
    <dskpp:MacAlgorithm>
        urn:ietf:params:xml:ns:keyprov:dskpp:prf-sha256
    </dskpp:MacAlgorithm>
    <dskpp:EncryptionKey>
      <ds:KeyName>Example-Key1</ds:KeyName>
    </dskpp:EncryptionKey>
    <dskpp:KeyPackageFormat>
        urn:ietf:params:xml:ns:keyprov:dskpp:pskc-key-container
    </dskpp:KeyPackageFormat>
    <dskpp:Payload>
        <dskpp:Nonce>EjRWeJASNFZ4kBI0VniQEg==</dskpp:Nonce>
    </dskpp:Payload>
</dskpp:KeyProvServerHello>

B.2.4. <KeyProvServerHello> Assuming Key Renewal

this one is the server hello for key renewal ๐Ÿ”„โœจ spot the different KeyType value, it's giving SecurID-AES vibes ๐Ÿ’…

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<dskpp:KeyProvServerHello
  xmlns:dskpp="urn:ietf:params:xml:ns:keyprov:dskpp"
  xmlns:pskc="urn:ietf:params:xml:ns:keyprov:pskc"
  xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"
  xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
  Version="1.0"
  SessionID="4114"
  Status="Continue">
  <dskpp:KeyType>
    urn:ietf:params:xml:schema:keyprov:otpalg#SecurID-AES
  </dskpp:KeyType>
  <dskpp:EncryptionAlgorithm>
     http://www.w3.org/2001/04/xmlenc#aes128-cbc
  </dskpp:EncryptionAlgorithm>
  <dskpp:MacAlgorithm>
     urn:ietf:params:xml:ns:keyprov:dskpp:prf-sha256
  </dskpp:MacAlgorithm>
  <dskpp:EncryptionKey>
    <ds:KeyName>Example-Key1</ds:KeyName>
  </dskpp:EncryptionKey>
  <dskpp:KeyPackageFormat>
    urn:ietf:params:xml:ns:keyprov:dskpp:pskc-key-container
  </dskpp:KeyPackageFormat>
  <dskpp:Payload>
    <dskpp:Nonce>qw2ewasde312asder394jw==</dskpp:Nonce>
  </dskpp:Payload>
  <dskpp:Mac
    MacAlgorithm="urn:ietf:params:xml:ns:keyprov:dskpp:prf-aes-128">
    cXcycmFuZG9tMzEyYXNkZXIzOTRqdw==
  </dskpp:Mac>
</dskpp:KeyProvServerHello>

B.2.5. <KeyProvClientNonce> Using Default Encryption

okay so here the client sends its nonce, R_C, which is the one the cryptographic module picked ๐Ÿ” and it arrives encrypted with the specified encryption key and algorithm, so it's locked down tight ๐Ÿซถ

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<dskpp:KeyProvClientNonce
    xmlns:pskc="urn:ietf:params:xml:ns:keyprov:pskc"
    xmlns:dskpp="urn:ietf:params:xml:ns:keyprov:dskpp"
    xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"
    xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
    SessionID="4114"
    Version="1.0">
    <dskpp:EncryptedNonce>
        oTvo+S22nsmS2Z/RtcoF8CTwadRa1PVsRXkZnCihHkU1rPueggrd0NpEWVZR
        16Rg16+FHuTg33GK1wH3wffDZQ==
    </dskpp:EncryptedNonce>
</dskpp:KeyProvClientNonce>

B.2.6. <KeyProvServerFinished> Using Default Encryption

and finally the server says "finished" ๐ŸŽ€ Status="Success" plus the key package with the device info, a CM_ID_001 crypto module, and an HOTP key that's all about DECIMAL codes, 6 digits long ๐ŸŒธ๐Ÿงš

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<dskpp:KeyProvServerFinished
    xmlns:pskc="urn:ietf:params:xml:ns:keyprov:pskc"
    xmlns:dskpp="urn:ietf:params:xml:ns:keyprov:dskpp"
    xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"
    xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
    Version="1.0"
    Status="Success"
    SessionID="4114">
    <dskpp:KeyPackage>
        <dskpp:KeyContainer Version="1.0" Id="KC0001">
            <pskc:KeyPackage>
                <pskc:DeviceInfo>
                    <pskc:Manufacturer>
                       TokenVendorAcme
                    </pskc:Manufacturer>
                    <pskc:SerialNo>
                       987654321
                    </pskc:SerialNo>
                    <pskc:StartDate>
                       2009-09-01T00:00:00Z
                    </pskc:StartDate>
                    <pskc:ExpiryDate>
                       2014-09-01T00:00:00Z
                    </pskc:ExpiryDate>
                </pskc:DeviceInfo>
                <pskc:CryptoModuleInfo>
                    <pskc:Id>CM_ID_001</pskc:Id>
                </pskc:CryptoModuleInfo>
                <pskc:Key
                   Id="MBK000000001"
                   Algorithm=
                      "urn:ietf:params:xml:ns:keyprov:pskc:hotp">
                   <pskc:Issuer>Example-Issuer</pskc:Issuer>
                   <pskc:AlgorithmParameters>
                       <pskc:ResponseFormat Length="6"
                          Encoding="DECIMAL"/>
                    </pskc:AlgorithmParameters>
                    <pskc:Data>
                        <pskc:Counter>
                            <pskc:PlainValue>0</pskc:PlainValue>
                        </pskc:Counter>
                    </pskc:Data>
                    <pskc:Policy>
                        <pskc:KeyUsage>OTP</pskc:KeyUsage>
                    </pskc:Policy>
                </pskc:Key>
            </pskc:KeyPackage>
        </dskpp:KeyContainer>
    </dskpp:KeyPackage>
    <dskpp:Mac
        MacAlgorithm=
           "urn:ietf:params:xml:ns:keyprov:dskpp:prf-sha256">
        151yAR2NqU5dJzETK+SGYqN6sq6DEH5AgHohra3Jpp4=
    </dskpp:Mac>
</dskpp:KeyProvServerFinished>

B.3. Two-Pass Protocol โœจ

B.3.1. Example Using the Key Transport Method โœจ

okay bestie, the client is going full buffet mode here ๐Ÿ“ and says it can do all three key protection methods: Key Transport, Key Wrap, and Passphrase-Based Key Wrap ๐Ÿ’…

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<dskpp:KeyProvClientHello
    xmlns:pskc="urn:ietf:params:xml:ns:keyprov:pskc"
    xmlns:dskpp="urn:ietf:params:xml:ns:keyprov:dskpp"
    xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"
    xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
    Version="1.0">
    <dskpp:DeviceIdentifierData>
        <dskpp:DeviceId>
            <pskc:Manufacturer>TokenVendorAcme</pskc:Manufacturer>
            <pskc:SerialNo>987654321</pskc:SerialNo>
            <pskc:StartDate>2009-09-01T00:00:00Z</pskc:StartDate>
            <pskc:ExpiryDate>2014-09-01T00:00:00Z</pskc:ExpiryDate>
        </dskpp:DeviceId>
    </dskpp:DeviceIdentifierData>
    <dskpp:SupportedKeyTypes>
        <dskpp:Algorithm>
            urn:ietf:params:xml:ns:keyprov:pskc:hotp
        </dskpp:Algorithm>
        <dskpp:Algorithm>
http://www.rsa.com/rsalabs/otps/schemas/2005/09/otps-wst#SecurID-AES
        </dskpp:Algorithm>
    </dskpp:SupportedKeyTypes>
    <dskpp:SupportedEncryptionAlgorithms>
        <dskpp:Algorithm>
            http://www.w3.org/2001/04/xmlenc#rsa_1_5
        </dskpp:Algorithm>
    </dskpp:SupportedEncryptionAlgorithms>
    <dskpp:SupportedMacAlgorithms>
        <dskpp:Algorithm>
            urn:ietf:params:xml:ns:keyprov:dskpp:prf-sha256
        </dskpp:Algorithm>
    </dskpp:SupportedMacAlgorithms>
    <dskpp:SupportedProtocolVariants>
        <dskpp:TwoPass>
            <dskpp:SupportedKeyProtectionMethod>
                urn:ietf:params:xml:schema:keyprov:dskpp:transport
            </dskpp:SupportedKeyProtectionMethod>
            <dskpp:Payload>
                <ds:KeyInfo>
                    <ds:X509Data>
                        <ds:X509Certificate>
MIIB5zCCAVCgAwIBAgIESZp/vDANBgkqhkiG9w0BAQUFADA4MQ0wCwYDVQQKEwRJRVRGM
RMwEQYDVQQLEwpLZXlQcm92IFdHMRIwEAYDVQQDEwlQU0tDIFRlc3QwHhcNMDkwMjE3MD
kxMzMyWhcNMTEwMjE3MDkxMzMyWjA4MQ0wCwYDVQQKEwRJRVRGMRMwEQYDVQQLEwpLZXl
Qcm92IFdHMRIwEAYDVQQDEwlQU0tDIFRlc3QwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJ
AoGBALCWLDa2ItYJ6su80hd1gL4cggQYdyyKK17btt/aS6Q/eDsKjsPyFIODsxeKVV/uA
3wLT4jQJM5euKJXkDajzGGOy92+ypfzTX4zDJMkh61SZwlHNJxBKilAM5aW7C+BQ0RvCx
vdYtzx2LTdB+X/KMEBA7uIYxLfXH2Mnub3WIh1AgMBAAEwDQYJKoZIhvcNAQEFBQADgYE
Ae875m84sYUJ8qPeZ+NG7REgTvlHTmoCdoByU0LBBLotUKuqfrnRuXJRMeZXaaEGmzY1k
LonVjQGzjAkU4dJ+RPmiDlYuHLZS41Pg6VMwY+03lhk6I5A/w4rnqdkmwZX/NgXg06aln
c2pBsXWhL4O7nk0S2ZrLMsQZ6HcsXgdmHo=
                        </ds:X509Certificate>
                    </ds:X509Data>
                </ds:KeyInfo>
            </dskpp:Payload>
        </dskpp:TwoPass>
    </dskpp:SupportedProtocolVariants>
    <dskpp:SupportedKeyPackages>
        <dskpp:KeyPackageFormat>
            urn:ietf:params:xml:ns:keyprov:dskpp:pskc-key-container
        </dskpp:KeyPackageFormat>
    </dskpp:SupportedKeyPackages>
    <dskpp:AuthenticationData>
        <dskpp:ClientID>AC00000A</dskpp:ClientID>
        <dskpp:AuthenticationCodeMac>
            <dskpp:Nonce>
                ESIzRFVmd4iZqrvM3e7/ESIzRFVmd4iZqrvM3e7/ESI=
            </dskpp:Nonce>
            <dskpp:IterationCount>100000</dskpp:IterationCount>
            <dskpp:Mac
                MacAlgorithm=
                "urn:ietf:params:xml:ns:keyprov:dskpp:prf-sha256">
                3eRz51ILqiG+dJW2iLcjuA==
            </dskpp:Mac>
        </dskpp:AuthenticationCodeMac>
    </dskpp:AuthenticationData>
</dskpp:KeyProvClientHello>

Now the server replies to that request with a key package ๐Ÿ“ฆ, and this is the fun part ๐Ÿฅน The provisioning key comes back encrypted with the Key Transport key protection method. Iconic behaviour from the server, honestly ๐Ÿ‘‘

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<dskpp:KeyProvServerFinished
    xmlns:pskc="urn:ietf:params:xml:ns:keyprov:pskc"
    xmlns:dskpp="urn:ietf:params:xml:ns:keyprov:dskpp"
    xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"
    xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
    xmlns:dkey="http://www.w3.org/2009/xmlsec-derivedkey#"
    xmlns:pkcs5=
       "http://www.rsasecurity.com/rsalabs/pkcs/schemas/pkcs-5v2-0#"
    Version="1.0"
    Status="Success"
    SessionID="4114">
    <dskpp:KeyPackage>
        <dskpp:KeyContainer Version="1.0" Id="KC0001">
            <pskc:EncryptionKey>
                <ds:X509Data>
                    <ds:X509Certificate>
MIIB5zCCAVCgAwIBAgIESZp/vDANBgkqhkiG9w0BAQUFADA4MQ0wCwYDVQQKEwRJRVRGM
RMwEQYDVQQLEwpLZXlQcm92IFdHMRIwEAYDVQQDEwlQU0tDIFRlc3QwHhcNMDkwMjE3MD
kxMzMyWhcNMTEwMjE3MDkxMzMyWjA4MQ0wCwYDVQQKEwRJRVRGMRMwEQYDVQQLEwpLZXl
Qcm92IFdHMRIwEAYDVQQDEwlQU0tDIFRlc3QwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJ
AoGBALCWLDa2ItYJ6su80hd1gL4cggQYdyyKK17btt/aS6Q/eDsKjsPyFIODsxeKVV/uA
3wLT4jQJM5euKJXkDajzGGOy92+ypfzTX4zDJMkh61SZwlHNJxBKilAM5aW7C+BQ0RvCx
vdYtzx2LTdB+X/KMEBA7uIYxLfXH2Mnub3WIh1AgMBAAEwDQYJKoZIhvcNAQEFBQADgYE
Ae875m84sYUJ8qPeZ+NG7REgTvlHTmoCdoByU0LBBLotUKuqfrnRuXJRMeZXaaEGmzY1k
LonVjQGzjAkU4dJ+RPmiDlYuHLZS41Pg6VMwY+03lhk6I5A/w4rnqdkmwZX/NgXg06aln
c2pBsXWhL4O7nk0S2ZrLMsQZ6HcsXgdmHo=
                    </ds:X509Certificate>
                </ds:X509Data>
            </pskc:EncryptionKey>
            <pskc:KeyPackage>
                <pskc:DeviceInfo>
                    <pskc:Manufacturer>
                       TokenVendorAcme
                    </pskc:Manufacturer>
                    <pskc:SerialNo>
                       987654321
                    </pskc:SerialNo>
                    <pskc:StartDate>
                       2009-09-01T00:00:00Z
                    </pskc:StartDate>
                    <pskc:ExpiryDate>
                       2014-09-01T00:00:00Z
                    </pskc:ExpiryDate>
                </pskc:DeviceInfo>
                <pskc:Key
                    Id="MBK000000001"
                    Algorithm=
                       "urn:ietf:params:xml:ns:keyprov:pskc:hotp">
                    <pskc:Issuer>Example-Issuer</pskc:Issuer>
                    <pskc:AlgorithmParameters>
                        <pskc:ResponseFormat Length="6"
                           Encoding="DECIMAL"/>
                    </pskc:AlgorithmParameters>
                    <pskc:Data>
                        <pskc:Secret>
                            <pskc:EncryptedValue>
                                <xenc:EncryptionMethod
                                 Algorithm=
                         "http://www.w3.org/2001/04/xmlenc#rsa_1_5"/>
                                <xenc:CipherData>
                                    <xenc:CipherValue>
eyjr23WMy9S2UdKgGnQEbs44T1jmX1TNWEBq48xfS20PK2VWF4ZK1iSctHj/u3uk+7+y8
uKrAzHEm5mujKPAU4DCbb5mSibXMnAbbIoAi2cJW60/l8FlzwaU4EZsZ1LyQ1GcBQKACE
eylG5vK8NTo47vZTatL5UxmbmOX2HvaVQ=
                                    </xenc:CipherValue>
                                </xenc:CipherData>
                            </pskc:EncryptedValue>
                        </pskc:Secret>
                        <pskc:Counter>
                            <pskc:PlainValue>0</pskc:PlainValue>

                        </pskc:Counter>
                    </pskc:Data>
                    <pskc:Policy>
                        <pskc:KeyUsage>OTP</pskc:KeyUsage>
                    </pskc:Policy>
                </pskc:Key>
            </pskc:KeyPackage>
        </dskpp:KeyContainer>
    </dskpp:KeyPackage>
    <dskpp:Mac
        MacAlgorithm=
           "urn:ietf:params:xml:ns:keyprov:dskpp:prf-sha256">
        GHZ0H6Y+KpxdlVZ7zgcJDiDdqc8Gcmlcf+HQi4EUxYU=
    </dskpp:Mac>
</dskpp:KeyProvServerFinished>

B.3.2. Example Using the Key Wrap Method

okay so this one is giving key wrap energy ๐ŸŽ€ the client sends a request that specifies a shared key to protect the K_TOKEN, and the server responds using the Key Wrap key protection method ๐Ÿ’– authentication data in this example is based on an Authentication Code rather than a device certificate โœจ

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<dskpp:KeyProvClientHello
    xmlns:pskc="urn:ietf:params:xml:ns:keyprov:pskc"
    xmlns:dskpp="urn:ietf:params:xml:ns:keyprov:dskpp"
    xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"
    xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
    Version="1.0">
    <dskpp:DeviceIdentifierData>
        <dskpp:DeviceId>
            <pskc:Manufacturer>TokenVendorAcme</pskc:Manufacturer>
            <pskc:SerialNo>987654321</pskc:SerialNo>
            <pskc:StartDate>2009-09-01T00:00:00Z</pskc:StartDate>
            <pskc:ExpiryDate>2014-09-01T00:00:00Z</pskc:ExpiryDate>
        </dskpp:DeviceId>
    </dskpp:DeviceIdentifierData>
    <dskpp:SupportedKeyTypes>
        <dskpp:Algorithm>
            urn:ietf:params:xml:ns:keyprov:pskc:hotp
        </dskpp:Algorithm>
        <dskpp:Algorithm>
 http://www.rsa.com/rsalabs/otps/schemas/2005/09/otps-wst#SecurID-AES
        </dskpp:Algorithm>
    </dskpp:SupportedKeyTypes>
    <dskpp:SupportedEncryptionAlgorithms>
        <dskpp:Algorithm>

            http://www.w3.org/2001/04/xmlenc#aes128-cbc
        </dskpp:Algorithm>
    </dskpp:SupportedEncryptionAlgorithms>
    <dskpp:SupportedMacAlgorithms>
        <dskpp:Algorithm>
            urn:ietf:params:xml:ns:keyprov:dskpp:prf-sha256
        </dskpp:Algorithm>
    </dskpp:SupportedMacAlgorithms>
    <dskpp:SupportedProtocolVariants>
        <dskpp:TwoPass>
            <dskpp:SupportedKeyProtectionMethod>
                urn:ietf:params:xml:schema:keyprov:dskpp:wrap
            </dskpp:SupportedKeyProtectionMethod>
            <dskpp:Payload>
                <ds:KeyInfo>
                    <ds:KeyName>Pre-shared-key-1</ds:KeyName>
                </ds:KeyInfo>
            </dskpp:Payload>
        </dskpp:TwoPass>
    </dskpp:SupportedProtocolVariants>
    <dskpp:SupportedKeyPackages>
        <dskpp:KeyPackageFormat>
            urn:ietf:params:xml:ns:keyprov:dskpp:pskc-key-container
        </dskpp:KeyPackageFormat>
    </dskpp:SupportedKeyPackages>
    <dskpp:AuthenticationData>
        <dskpp:ClientID>AC00000A</dskpp:ClientID>
        <dskpp:AuthenticationCodeMac>
            <dskpp:Nonce>
                ESIzRFVmd4iZqrvM3e7/ESIzRFVmd4iZqrvM3e7/ESI=
            </dskpp:Nonce>
            <dskpp:IterationCount>1</dskpp:IterationCount>
            <dskpp:Mac
                MacAlgorithm=
                "urn:ietf:params:xml:ns:keyprov:dskpp:prf-sha256">
                3eRz51ILqiG+dJW2iLcjuA==
            </dskpp:Mac>
        </dskpp:AuthenticationCodeMac>
    </dskpp:AuthenticationData>
</dskpp:KeyProvClientHello>

In this example, the server responds to the previous request by returning a key package in which the provisioning key was encrypted using the Key Wrap key protection method ๐Ÿงš this is the part where the server basically says "here's your package, wrapped and ready" ๐ŸŽ

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<dskpp:KeyProvServerFinished
    xmlns:pskc="urn:ietf:params:xml:ns:keyprov:pskc"
    xmlns:dskpp="urn:ietf:params:xml:ns:keyprov:dskpp"
    xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"
    xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
    xmlns:dkey="http://www.w3.org/2009/xmlsec-derivedkey#"
    xmlns:pkcs5=
        "http://www.rsasecurity.com/rsalabs/pkcs/schemas/pkcs-5v2-0#"
    Version="1.0"
    Status="Success"
    SessionID="4114">
    <dskpp:KeyPackage>
         <dskpp:KeyContainer Version="1.0" Id="KC0001">
             <pskc:EncryptionKey>
                <ds:KeyName>Pre-shared-key-1</ds:KeyName>
             </pskc:EncryptionKey>
             <pskc:MACMethod
                 Algorithm=
                    "http://www.w3.org/2000/09/xmldsig#hmac-sha1">
                 <pskc:MACKey>
                     <xenc:EncryptionMethod
                         Algorithm=
                      "http://www.w3.org/2001/04/xmlenc#aes128-cbc"/>
                     <xenc:CipherData>
                         <xenc:CipherValue>
     2GTTnLwM3I4e5IO5FkufoMUBJBuAf25hARFv0Z7MFk9Ecdb04PWY/qaeCbrgz7Es
                          </xenc:CipherValue>
                     </xenc:CipherData>
                 </pskc:MACKey>
             </pskc:MACMethod>
             <pskc:KeyPackage>
                 <pskc:DeviceInfo>
                     <pskc:Manufacturer>
                        TokenVendorAcme
                     </pskc:Manufacturer>
                     <pskc:SerialNo>
                        987654321
                     </pskc:SerialNo>
                     <pskc:StartDate>
                        2009-09-01T00:00:00Z
                     </pskc:StartDate>
                     <pskc:ExpiryDate>
                        2014-09-01T00:00:00Z
                     </pskc:ExpiryDate>
                 </pskc:DeviceInfo>
                 <pskc:CryptoModuleInfo>
                     <pskc:Id>CM_ID_001</pskc:Id>
                 </pskc:CryptoModuleInfo>
                 <pskc:Key
                     Id="MBK000000001"
                     Algorithm=
                        "urn:ietf:params:xml:ns:keyprov:pskc:hotp">
                     <pskc:Issuer>Example-Issuer</pskc:Issuer>
                     <pskc:AlgorithmParameters>
                       <pskc:ResponseFormat Length="6"
                          Encoding="DECIMAL"/>
                     </pskc:AlgorithmParameters>
                     <pskc:Data>
                         <pskc:Secret>
                             <pskc:EncryptedValue>
                               <xenc:EncryptionMethod
                               Algorithm=
                      "http://www.w3.org/2001/04/xmlenc#aes128-cbc"/>
                                 <xenc:CipherData>
                                     <xenc:CipherValue>
                                         oTvo+S22nsmS2Z/RtcoF8AabC6vr
                                         09sh0QIU+E224S96sZjpV+6nFYgn
                                         6525OoepbPnL/fGuuey64WCYXoqh
                                         Tg==
                                     </xenc:CipherValue>
                                 </xenc:CipherData>
                            </pskc:EncryptedValue>
                            <pskc:ValueMAC>
                                o+e9xgMVUbYuZH9UHe0W9dIo88A=
                            </pskc:ValueMAC>
                        </pskc:Secret>
                        <pskc:Counter>
                            <pskc:PlainValue>0</pskc:PlainValue>
                        </pskc:Counter>
                    </pskc:Data>
                    <pskc:Policy>
                        <pskc:KeyUsage>OTP</pskc:KeyUsage>
                    </pskc:Policy>
                </pskc:Key>
            </pskc:KeyPackage>
        </dskpp:KeyContainer>
    </dskpp:KeyPackage>
    <dskpp:Mac
        MacAlgorithm=
           "urn:ietf:params:xml:ns:keyprov:dskpp:prf-sha256">
        l53BmSO6qUzoIgbQegimsKk2es+WRpEl0YFqaOp5PGE=
    </dskpp:Mac>
</dskpp:KeyProvServerFinished>

okay that's the whole Key Wrap example and it slays ๐Ÿ’…๐ŸŒธ the client asks for the key with a shared key protecting it, the server wraps it up, and the MAC proves the package is legit ๐Ÿ”ฅ

B.3.3. Example Using the Passphrase-Based Key Wrap Method ๐ŸŽ€

okay so bestie, the client sends a request kinda like the one in Appendix B.3.1 โœจ, but this time the Authentication Data is based on an Authentication Code ๐Ÿ”. The server responds using the Passphrase-Based Key Wrap method to lock up the provisioning key ๐Ÿ”’. Quick reminder: the encryption is derived from the password component of the Authentication Code ๐Ÿ’œ. The Authentication Data is sent in clear text, but only over a secure transport channel like TLS [RFC5246] ๐Ÿซถ.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<dskpp:KeyProvClientHello
    xmlns:pskc="urn:ietf:params:xml:ns:keyprov:pskc"
    xmlns:dskpp="urn:ietf:params:xml:ns:keyprov:dskpp"
    xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"
    xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
    Version="1.0">
    <dskpp:DeviceIdentifierData>
        <dskpp:DeviceId>
            <pskc:Manufacturer>TokenVendorAcme</pskc:Manufacturer>
            <pskc:SerialNo>987654321</pskc:SerialNo>
            <pskc:StartDate>2009-09-01T00:00:00Z</pskc:StartDate>
            <pskc:ExpiryDate>2014-09-01T00:00:00Z</pskc:ExpiryDate>
        </dskpp:DeviceId>
    </dskpp:DeviceIdentifierData>
    <dskpp:SupportedKeyTypes>
        <dskpp:Algorithm>
            urn:ietf:params:xml:ns:keyprov:pskc:hotp
        </dskpp:Algorithm>
        <dskpp:Algorithm>
 http://www.rsa.com/rsalabs/otps/schemas/2005/09/otps-wst#SecurID-AES
        </dskpp:Algorithm>
    </dskpp:SupportedKeyTypes>
    <dskpp:SupportedEncryptionAlgorithms>
        <dskpp:Algorithm>
            http://www.w3.org/2001/04/xmlenc#rsa_1_5
        </dskpp:Algorithm>
    </dskpp:SupportedEncryptionAlgorithms>
    <dskpp:SupportedMacAlgorithms>
        <dskpp:Algorithm>
            urn:ietf:params:xml:ns:keyprov:dskpp:prf-sha256
        </dskpp:Algorithm>
    </dskpp:SupportedMacAlgorithms>
    <dskpp:SupportedProtocolVariants>
        <dskpp:TwoPass>
            <dskpp:SupportedKeyProtectionMethod>
             urn:ietf:params:xml:schema:keyprov:dskpp:passphrase-wrap
            </dskpp:SupportedKeyProtectionMethod>
            <dskpp:Payload>
                <ds:KeyInfo>
                    <ds:KeyName>Passphrase-1</ds:KeyName>
                </ds:KeyInfo>
            </dskpp:Payload>
        </dskpp:TwoPass>
    </dskpp:SupportedProtocolVariants>
    <dskpp:SupportedKeyPackages>
        <dskpp:KeyPackageFormat>
            urn:ietf:params:xml:ns:keyprov:dskpp:pskc-key-container
        </dskpp:KeyPackageFormat>
    </dskpp:SupportedKeyPackages>
    <dskpp:AuthenticationData>
        <dskpp:ClientID>AC00000A</dskpp:ClientID>
        <dskpp:AuthenticationCodeMac>
            <dskpp:Nonce>
                ESIzRFVmd4iZqrvM3e7/ESIzRFVmd4iZqrvM3e7/ESI=
            </dskpp:Nonce>
            <dskpp:IterationCount>1</dskpp:IterationCount>
            <dskpp:Mac
                MacAlgorithm=
               "urn:ietf:params:xml:ns:keyprov:dskpp:prf-sha256">
               K4YvLMN6Q1DZvtShoCxQag==
            </dskpp:Mac>
        </dskpp:AuthenticationCodeMac>
    </dskpp:AuthenticationData>
</dskpp:KeyProvClientHello>

In this example, the server answers the previous request by sending back a key package in which the provisioning key was encrypted using the Passphrase-Based Key Wrap key protection method ๐Ÿ’…

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<dskpp:KeyProvServerFinished
    xmlns:pskc="urn:ietf:params:xml:ns:keyprov:pskc"
    xmlns:dskpp="urn:ietf:params:xml:ns:keyprov:dskpp"
    xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"
    xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
    xmlns:dkey="http://www.w3.org/2009/xmlsec-derivedkey#"
    xmlns:pkcs5=
       "http://www.rsasecurity.com/rsalabs/pkcs/schemas/pkcs-5v2-0#"
    Version="1.0"
    Status="Success"
    SessionID="4114">
    <dskpp:KeyPackage>
        <dskpp:KeyContainer Version="1.0" Id="KC0002">
            <pskc:EncryptionKey>
                <dkey:DerivedKey>

                    <dkey:KeyDerivationMethod
                    Algorithm=
                    "http://www.rsasecurity.com/rsalabs/pkcs/schemas/
                    pkcs-5v2-0#pbkdf2">
                        <pkcs5:PBKDF2-params>
                            <Salt>
                                <Specified>Ej7/PEpyEpw=</Specified>
                            </Salt>
                            <IterationCount>1000</IterationCount>
                            <KeyLength>16</KeyLength>
                        </pkcs5:PBKDF2-params>
                    </dkey:KeyDerivationMethod>
                    <xenc:ReferenceList>
                        <xenc:DataReference URI="#ED"/>
                    </xenc:ReferenceList>
                    <dkey:MasterKeyName>
                       Passphrase1
                    </dkey:MasterKeyName>
                </dkey:DerivedKey>
            </pskc:EncryptionKey>
            <pskc:MACMethod
                Algorithm=
                   "http://www.w3.org/2000/09/xmldsig#hmac-sha1">
                <pskc:MACKey>
                    <xenc:EncryptionMethod
                        Algorithm=
                      "http://www.w3.org/2001/04/xmlenc#aes128-cbc"/>
                    <xenc:CipherData>
                        <xenc:CipherValue>
     2GTTnLwM3I4e5IO5FkufoOEiOhNj91fhKRQBtBJYluUDsPOLTfUvoU2dStyOwYZx
                        </xenc:CipherValue>
                    </xenc:CipherData>
                </pskc:MACKey>
            </pskc:MACMethod>
            <pskc:KeyPackage>
                <pskc:DeviceInfo>
                    <pskc:Manufacturer>
                       TokenVendorAcme
                    </pskc:Manufacturer>
                    <pskc:SerialNo>
                       987654321
                    </pskc:SerialNo>
                    <pskc:StartDate>
                       2009-09-01T00:00:00Z
                    </pskc:StartDate>
                    <pskc:ExpiryDate>
                       2014-09-01T00:00:00Z
                    </pskc:ExpiryDate>

                </pskc:DeviceInfo>
                <pskc:CryptoModuleInfo>
                    <pskc:Id>CM_ID_001</pskc:Id>
                </pskc:CryptoModuleInfo>
                <pskc:Key
                    Id="MBK000000001"
                    Algorithm=
                       "urn:ietf:params:xml:ns:keyprov:pskc:hotp">
                    <pskc:Issuer>Example-Issuer</pskc:Issuer>
                    <pskc:AlgorithmParameters>
                       <pskc:ResponseFormat Length="6"
                          Encoding="DECIMAL"/>
                    </pskc:AlgorithmParameters>
                    <pskc:Data>
                        <pskc:Secret>
                            <pskc:EncryptedValue>
                                <xenc:EncryptionMethod
                                    Algorithm=
                                    "http://www.w3.org/2001/04/
                                    xmlenc#aes128-cbc"/>
                                <xenc:CipherData>
                                    <xenc:CipherValue>
                                      oTvo+S22nsmS2Z/RtcoF8HX385uMWgJ
                                      myIFMESBmcvtHQXp/6T1TgCS9CsgKtm
                                      cOrF8VoK254tZKnrAjiD5cdw==
                                    </xenc:CipherValue>
                                </xenc:CipherData>
                            </pskc:EncryptedValue>
                            <pskc:ValueMAC>
                                pbgEbVYxoYs0x41wdeC7eDRbUEk=
                            </pskc:ValueMAC>
                        </pskc:Secret>
                        <pskc:Counter>
                            <pskc:PlainValue>0</pskc:PlainValue>
                        </pskc:Counter>
                    </pskc:Data>
                    <pskc:Policy>
                        <pskc:KeyUsage>OTP</pskc:KeyUsage>
                    </pskc:Policy>
                </pskc:Key>
            </pskc:KeyPackage>
        </dskpp:KeyContainer>
    </dskpp:KeyPackage>
    <dskpp:Mac MacAlgorithm=
        "urn:ietf:params:xml:ns:keyprov:dskpp:prf-sha256">
        Jc4VsNODYXgfbDmTn9qQZgcL3cKoa//j/NRT7sTpKOM=
    </dskpp:Mac>
</dskpp:KeyProvServerFinished>

Appendix C. Integration with PKCS #11 ๐Ÿงš

A DSKPP Client that needs to talk to a connected cryptographic module to run a DSKPP exchange MAY use PKCS #11 [PKCS-11] as a programming interface, as described here. This appendix forms an informative part of the document ๐ŸŒˆ

C.1. The Four-Pass Variant ๐Ÿ’–

When doing four-pass DSKPP with a cryptographic module through the PKCS #11 programming interface, the procedure in [CT-KIP-P11], Appendix B, is RECOMMENDED ๐Ÿ‘‘

C.2. The Two-Pass Variant

okay so this is the suggested recipe for running two-pass DSKPP with a crypto module through the PKCS #11 interface, using the mechanisms from [CT-KIP-P11] ๐Ÿ”โœจ

  • a. On the client side,
    • 1. The client selects a suitable slot and token (e.g., through use of the <DeviceIdentifier> or the <PlatformInfo> element of the DSKPP trigger message). ๐ŸŽ€
    • 2. A nonce R gets generated, e.g., by calling C_SeedRandom and C_GenerateRandom. ๐ŸŒธ
    • 3. The client sends its first message to the server, including the nonce R. ๐Ÿ’Œ
  • b. On the server side,
    • 1. A generic key K_PROV = K_TOKEN | K_MAC (where '|' denotes concatenation) is generated, e.g., by calling C_GenerateKey (using key type CKK_GENERIC_SECRET). The template for K_PROV MUST allow it to be exported (but only in wrapped form, i.e., CKA_SENSITIVE MUST be set to CK_TRUE and CKA_EXTRACTABLE MUST also be set to CK_TRUE), and also to be used for further key derivation. From K, a token key K_TOKEN of suitable type is derived by calling C_DeriveKey using the PKCS #11 mechanism CKM_EXTRACT_KEY_FROM_KEY and setting the CK_EXTRACT_PARAMS to the first bit of the generic secret key (i.e., set to 0). Likewise, a MAC key K_MAC is derived from K_PROV by calling C_DeriveKey using the CKM_EXTRACT_KEY_FROM_KEY mechanism, this time setting CK_EXTRACT_PARAMS to the length of K_PROV (in bits) divided by two. ๐Ÿ”‘โœจ
    • 2. The server wraps K_PROV with either the public key of the DSKPP Client or device, the pre-shared secret key, or the derived shared secret key by using C_WrapKey. If use of the DSKPP key wrap algorithm has been negotiated, then the CKM_KIP_WRAP mechanism MUST be used to wrap K. When calling C_WrapKey, the hKey handle in the CK_KIP_PARAMS structure MUST be set to NULL_PTR. The pSeed parameter in the CK_KIP_PARAMS structure MUST point to the nonce R provided by the DSKPP Client, and the ulSeedLen parameter MUST indicate the length of R. The hWrappingKey parameter in the call to C_WrapKey MUST be set to refer to the key wrapping key. ๐ŸŽ
    • 3. Next, the server needs to calculate a MAC using K_MAC. If use of the DSKPP MAC algorithm has been negotiated, then the MAC is calculated by calling C_SignInit with the CKM_KIP_MAC mechanism followed by a call to C_Sign. In the call to C_SignInit, K_MAC MUST be the signature key, the hKey parameter in the CK_KIP_PARAMS structure MUST be set to NULL_PTR, the pSeed parameter of the CT_KIP_PARAMS structure MUST be set to NULL_PTR, and the ulSeedLen parameter MUST be set to zero. In the call to C_Sign, the pData parameter MUST be set to the concatenation of the string ServerID and the nonce R, and the ulDataLen parameter MUST be set to the length of the concatenated string. The desired length of the MAC MUST be specified through the pulSignatureLen parameter and MUST be set to the length of R. ๐Ÿงฎ
    • 4. If the server also needs to authenticate its message (due to an existing K_TOKEN being replaced), the server MUST calculate a second MAC. Again, if use of the DSKPP MAC algorithm has been negotiated, then the MAC is calculated by calling C_SignInit with the CKM_KIP_MAC mechanism followed by a call to C_Sign. In this call to C_SignInit, the K_MAC' existing before this DSKPP run MUST be the signature key (the implementation may specify K_MAC' to be the value of the K_TOKEN that is being replaced, or a version of K_MAC from the previous protocol run), the hKey parameter in the CK_KIP_PARAMS structure MUST be set to NULL, the pSeed parameter of the CT_KIP_PARAMS structure MUST be set to NULL_PTR, and the ulSeedLen parameter MUST be set to zero. In the call to C_Sign, the pData parameter MUST be set to the concatenation of the string ServerID and the nonce R, and the ulDataLen parameter MUST be set to the length of concatenated string. The desired length of the MAC MUST be specified through the pulSignatureLen parameter and MUST be set to the length of R. ๐Ÿ”
    • 5. The server sends its message to the client, including the wrapped key K_TOKEN, the MAC and possibly also the authenticating MAC. ๐Ÿ“จ
  • c. On the client side,
    • 1. The client calls C_UnwrapKey to receive a handle to K. After this, the client calls C_DeriveKey twice: once to derive K_TOKEN and once to derive K_MAC. The client MUST use the same mechanism (CKM_EXTRACT_KEY_FROM_KEY) and the same mechanism parameters as used by the server above. When calling C_UnwrapKey and C_DeriveKey, the pTemplate parameter MUST be used to set additional key attributes in accordance with local policy and as negotiated and expressed in the protocol. In particular, the value of the <KeyID> element in the server's response message MAY be used as CKA_ID for K_TOKEN. The key K_PROV MUST be destroyed after deriving K_TOKEN and K_MAC. ๐Ÿงน
    • 2. The MAC is verified in a reciprocal fashion as it was generated by the server. If use of the CKM_KIP_MAC mechanism has been negotiated, then in the call to C_VerifyInit, the hKey parameter in the CK_KIP_PARAMS structure MUST be set to NULL_PTR, the pSeed parameter MUST be set to NULL_PTR, and ulSeedLen MUST be set to 0. The hKey parameter of C_VerifyInit MUST refer to K_MAC. In the call to C_Verify, pData MUST be set to the concatenation of the string ServerID and the nonce R, and the ulDataLen parameter MUST be set to the length of the concatenated string, pSignature to the MAC value received from the server, and ulSignatureLen to the length of the MAC. If the MAC does not verify the protocol session ends with a failure. The token MUST be constructed to not "commit" to the new K_TOKEN or the new K_MAC unless the MAC verifies. ๐Ÿ›ก๏ธ
    • 3. If an authenticating MAC was received (REQUIRED if the new K_TOKEN will replace an existing key on the token), then it is verified in a similar vein but using the K_MAC' associated with this server and existing before the protocol run (the implementation may specify K_MAC' to be the value of the K_TOKEN that is being replaced, or a version of K_MAC from the previous protocol run). Again, if the MAC does not verify the protocol session ends with a failure, and the token MUST be constructed not to "commit" to the new K_TOKEN or the new K_MAC unless the MAC verifies. ๐Ÿ‘‘

Appendix D. Example of DSKPP-PRF Realizations โœจ

D.1. Introduction

this appendix is an example that defines DSKPP-PRF in terms of AES [FIPS197-AES] and HMAC [RFC2104]. ๐Ÿ“š This appendix forms a normative part of the document, so it's not just a nice-to-have. ๐Ÿ’…

D.2. DSKPP-PRF-AES

D.2.1. Identification

For cryptographic modules supporting this realization of DSKPP-PRF, the following URN MUST be used to identify this algorithm in DSKPP:

urn:ietf:params:xml:ns:keyprov:dskpp:prf-aes-128

When this URN is used to identify the encryption algorithm, the method for encryption of R_C values described in Section 4.2.4 MUST be used. ๐Ÿ”

D.2.2. Definition

DSKPP-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 = CEILING( 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 CMAC construction from [NIST-SP800-38B], using AES as the block cipher:

F (k, s, i) = CMAC-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 CMAC 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

If we assume that dsLen = 16, then:

n = 16 / 16 = 1

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

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

D.3. DSKPP-PRF-SHA256

D.3.1. Identification

For cryptographic modules supporting this realization of DSKPP-PRF, the following URN MUST be used to identify this algorithm in DSKPP:

urn:ietf:params:xml:ns:keyprov:dskpp:prf-sha256

When this URN is used to identify the encryption algorithm to use, the method for encryption of R_C values described in Section 4.2.4 MUST be used. ๐ŸŒˆ

D.3.2. Definition

DSKPP-PRF-SHA256 (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 size of SHA-256 in octets of [FIPS180-SHA]
    (no truncation is done on the HMAC output):

    bLen = 32
    (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 = CEILING( 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 HMAC construction from [RFC2104], using SHA-256 as the digest algorithm:

F (k, s, i) = HMAC-SHA256 (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 HMAC 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.3.3. Example

If we assume that sLen = 256 (two 128-octet long values) and dsLen = 16, then:

n = CEILING( 16 / 32 ) = 1

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

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

DS = B1<0 ... 15>

That is, the result will be the first 16 octets of the HMAC output. ๐Ÿฆ‹

Authors' Addresses โœจ

Okay bestie, here are the four amazing people who wrote this spec, with their mailing addresses and emails so you can slide into their inboxes ๐Ÿ’Œ๐ŸŽ€ Every detail is copied exactly.

Andrea Doherty ๐Ÿฆ‹ at RSA, The Security Division of EMC:

Andrea Doherty
RSA, The Security Division of EMC
174 Middlesex Turnpike
Bedford, MA  01730
USA

EMail: andrea.doherty@rsa.com

Mingliang Pei ๐ŸŒธ at VeriSign, Inc.:

Mingliang Pei
VeriSign, Inc.
487 E. Middlefield Road
Mountain View, CA  94043
USA

EMail: mpei@verisign.com

Salah Machani ๐Ÿงš at Diversinet Corp.:

Salah Machani
Diversinet Corp.
2225 Sheppard Avenue East, Suite 1801
Toronto, Ontario  M2J 5C2
Canada

EMail: smachani@diversinet.com

Magnus Nystrom ๐Ÿ’œ at Microsoft Corp.:

Magnus Nystrom
Microsoft Corp.
One Microsoft Way
Redmond, WA  98052
USA

EMail: mnystrom@microsoft.com

That's the whole crew, periodt! ๐ŸŒˆ๐Ÿ‘‘ Four authors, four companies, and a full stack of protocol brain power ๐Ÿ’…

๐Ÿ“ฆ where this page comes from