Internet Draft PKIX Working Group Amit Kapoor (Certicom) Expires in 6 months Ronald Tschal„r (Certicom) October 03 2000 Transport Protocols for CMP Status of this Memo This document is an Internet-Draft and is in full conformance with all provisions of Section 10 of RFC2026. Internet-Drafts are working documents of the Internet Engineering Task Force (IETF), its areas, and its working groups. Note that other groups may also distribute working documents as Internet-Drafts. Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress." The list of current Internet-Drafts can be accessed at http://www.ietf.org/ietf/1id-abstracts.txt The list of Internet-Draft Shadow Directories can be accessed at http://www.ietf.org/shadow.html. This Internet-Draft will expire on April 03, 2001 Copyright Notice Copyright (C) The Internet Society (2000). All Rights Reserved. Abstract This document describes how to layer Certificate Management Protocols [CMP] over various transport protocols. The key words "MUST", "MUST NOT", "REQUIRED", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document (in uppercase, as shown) are to be interpreted as described in [RFC2119]. 1. Motivation Section 5 of the [RFC2510] spec specifies how to exchange CMP messages over various transports. However, implementors, during various interoperability workshops, found the protocol lacking in the following respects: 1. For CMP-over-TCP (section 5.2): A. No clear definition on when the connection is to be closed and by whom. B. No version number specified to allow for extensions. C. Error messages cannot be processed by applications. 2. For CMP-over-HTTP (section 5.4): A. No support for polling B. No specification of what to do in the case where there is no CMP response message (e.g. after a conf) Realizing that this could not be achieved in a backward compatible way, and acknowledging the changes being made to [RFC2510], the decision was made to enhance the protocol now to avoid interoperability conflicts later and to pull the transport section out in a separate draft. This enhancement tries to keep as much of the older protocol as possible, while ensuring that implementations using the old protocol will not mistake a new message for a valid message in the [RFC2510] format. For CMP-over-HTTP a new content type is specified which carries a TCP-message instead of a plain DER-encoded PKIMessage. 2. TCP-Based Management Protocol While this section is called TCP-Based and the messages are called TCP-message's, the same protocol can be used over any reliable, connection oriented transport protocol (e.g. SNA, DECnet, etc.). This protocol is suitable for cases where an end entity (or an RA) initiates a transaction and can poll to pick up the results. The client sends a TCP-message to the server, and the server responds with another TCP-message. Note that a response MUST be sent for every request, even if the encapsulated CMP message in the request does not have a corresponding response. The protocol basically assumes a listener process on an RA or CA which can accept TCP-messages on a well-defined port (default port number is 829). Typically a client initiates connection to the server and submits a PKI message. The server replies with a PKI message or with a reference number to be used later when polling for the actual PKI message response. If a polling-reference was supplied then the client will send a polling request using this polling-reference after waiting for at least the specified time. The server may again reply with a polling-reference or with the actual PKI message response. When the final PKI response message has been picked up by the client then no new polling reference is supplied. If a transaction is initiated by a PKI entity (RA or CA) then an end entity must either supply a listener process or be supplied with a polling reference (see below) in order to allow it to pick up the PKI message from the PKI management component. 2.1 General Form A TCP-message consists of: length (32-bits) version (8-bits) flags (variable length) message-type (8-bits), value (defined below) The length field contains the number of octets of the remainder of the TCP-message (i.e., number of octets of plus plus 2). All bit values in this protocol are specified to be in network byte order. The version field indicates the version of the TCP-message. It MUST be incremented for each specification which changes the flags field in a way that is not fully backwards compatible with the previous version (e.g. when the length of the flags field is changed). The flags field is for transporting TCP-message specific data. The length of this field is version dependent and is fixed for a given version. The message-type field is used to indicate the type of TCP-message. The value field contains message-type dependent data. 2.2 Version Negotiation If a client knows the protocol version(s) supported by the server (e.g. from a previous TCP-message exchange or via some out-of-band means) then it SHOULD send a TCP-message with the highest version supported both by it and the server. If a client does not know what version(s) the server supports then it SHOULD send a TCP-message using the highest version it supports. If a server receives a TCP-message version that it supports, then it MUST reply with a TCP-message of the same version. If the version received is higher than what the server supports, it MUST send back a VersionNotSupported errorMsgRep (defined below) containing the highest version it supports. 2.3 TCP-message Version 10 The TCP-message version will be 10 for this document. The number has deliberately been chosen to prevent [RFC2510] compliant applications from treating it as a valid message type. Applications receiving a version less than 10 SHOULD interpret the message as being an [RFC2510] style message. The length of the flags field for this version is 1 octet. The LSB is used to indicate a connection close; all other bits in the flags octet MUST be ignored by receivers, and MUST be set to zero by senders. By default connections are kept open after the receipt of a response. Either party (client or server) MAY set the connection close bit at any time. If the connection close bit is set on a request, then the server MUST set the bit in the response and close the connection after sending the response. If the bit is set on a response from the server, the client MUST NOT send any further requests on that connection. Applications MAY decide to close an idle connection (one on which no response is outstanding) after some time-out. Because of the problem where a client sends a request and the server closes the connection while the request is still in flight, clients SHOULD automatically retry a request for which no part of the response could be read due to a connection close or reset. If the connection is kept open, it MUST only be used for subsequent request/response transactions started by the client - the server MUST NOT use it to send requests to the client. Different transactions may be freely interwoven on the same connection. E.g. a CR/CP need not immediately be followed by the Confirm, but may be followed by any other request from a different transaction. 2.4 Detecting and Interoperating with RFC-2510 Conformant Implementations Servers wishing to interoperate with clients conforming to [RFC2510] can do so by treating any received message with a version less than 10 as an [RFC2510] message and responding in that format. Servers not wishing to support [RFC2510] messages MUST respond with a [RFC2510] errorMsgRep. Clients wishing to interoperate with [RFC2510] compliant servers SHOULD treat a response with a version less than 10 as an [RFC2510] style message. If this message is an errorMsgRep (message-type 06) then the client MAY automatically retry the request using the [RFC2510] format; if the message is not an errorMsgRep or the implementation does not wish to support [RFC2510] then it MUST abort the corresponding CMP transaction. 2.5 Message Types message-types 0-127 are reserved and will be issued under IANA auspices. message-types 128-255 are reserved for application use. The message-type's currently defined are: Message name Message-type pkiReq '00'H pollRep '01'H pollReq '02'H finRep '03'H pkiRep '05'H errorMsgRep '06'H If server receives an unknown message-type then it MUST reply with an InvalidMessageType errorMsgRep. If a client receives an unknown message-type then it MUST abort the CMP transaction. The different TCP-messages are discussed in the following sections: 2.5.1 pkiReq The pkiReq is to be used to carry a PKIMessage from the client to the server. The portion of this TCP-message will contain: DER-encoded PKIMessage. The type of PKIMessages that can be carried by this TCP-message are: CRL Announcement Certificate Confirmation Poll Request Subscription Request CA Key Update Announcement Certificate Announcement Certification Request Cross-Certification Request Error Message General Message Initialization Request Key Recovery Request Key Update Request Nested Message PKCS-10 Request POP Response Revocation Request 2.5.2 pkiRep This TCP-message is to be used to send back the response to the request. The portion of the pkiRep will contain: DER encoded PKI message The type of PKIMessages that can be carried by this TCP-message are: Confirmation Poll Response Subscription Response Certification Response Error Message General Response Initialization Response Key Recovery Response Key Update Response POP Challenge Revocation Response 2.5.3 pollReq The pollReq will be the used by the client to check the status of a pending TCP-message. The portion of the pollReq will contain: polling-reference (32 bits) The MUST be the one returned via the pollRep TCP-message. 2.5.4 pollRep The pollRep will be the response sent by the server to the client when there are no TCP-message response ready. The portion of the pollRep will contain: polling-reference (32 bits) time-to-check-back (32 bits) The is a unique 32-bit number sent by the server. The is the time in seconds indicating the minimum interval after which the client SHOULD check the status again. The duration for which the server keeps the unique is left to the implementation. 2.5.5 finRep finRep is sent by the server whenever no other response applies (such as after receiving a CMP certConf), and usually indicates the end of the CMP transaction. The portion of the finRep will contain: '00'H (8 bits) 2.5.6 errorMsgRep This TCP-message is sent when a TCP-message level protocol error is detected. Please note that PKIError messages MUST NOT be sent using this. Examples of TCP-message level errors are: 1. Invalid protocol version 2. Invalid TCP message-type 3. Invalid polling reference number The field of the TCP-message SHALL contain: error-type (16-bits) data-length (16-bits) data ( octets) UTF8 String (SHOULD include a RFC 1766 language tag) The is of the form MMNN where M and N are hex digits (0-F) and MM represents the major category and NN the minor. The major categories defined by this specification are: '01'H TCP-message version negotiation '02'H client errors '03'H server errors The major categories '80'H-'FF'H are reserved for application use. The and are additional information about the error to be used by programs for further processing and recovery. contains the length of the field in number of octets. Error messages not needing additional information to be conveyed MUST set the to 0. The UTF8 text string is for user readable error messages. 2.5.6.1 VersionNotSupported errorMsgRep The VersionNotSupported errorMsgRep is defined as follows: error-type: '0101'H data-length: 1 data: UTF8-text String: implementation defined where is the highest version the server supports. 2.5.6.2 GeneralClientError errorMsgRep The GeneralClientError errorMsgRep is defined as follows: error-type: '0200'H data-length: 0 data: UTF8-text String: implementation defined 2.5.6.3 InvalidMessageType errorMsgRep The InvalidMessageType errorMsgRep is defined as follows: error-type: '0201'H data-length: 1 data: UTF8-text String: implementation defined where is the message-type received by the server. 2.5.6.4 InvalidPollID errorMsgRep The InvalidPollID errorMsgRep is defined as follows: error-type: '0202'H data-length: 4 data: UTF8-text String: implementation defined where is the polling-reference received by the server. 2.5.6.5 GeneralServerError errorMsgRep The GeneralServerError errorMsgRep is defined as follows: error-type: '0300'H data-length: 0 data: UTF8-text String: implementation defined 3. HTTP-Based Management Protocol A client creates a TCP-message, as specified in section 2.0. The message is then sent as the entity-body of an HTTP POST request. If the HTTP request is successful then the server returns a similar message in the body of the response. The response status code in this case MUST be 200; other 2xx codes MUST NOT be used. The content type of the request and response MUST be "application/pkixcmp-poll". Applications MAY wish to also recognized and use the "application/x-pkixcmp-poll" MIME type (specified in earlier versions of this document) in order to support backward compatibility wherever applicable. Content codings may be applied. Note that a server may return any 1xx, 3xx, 4xx, or 5xx code if the HTTP request needs further handling or is otherwise not acceptable. Because in general CMP messages are not cacheable, requests and responses should include a "Cache-Control: no-cache" (and, if either side uses HTTP/1.0, a "Pragma: no-cache") to prevent the client from getting cached responses. This is especially important for polling requests and responses. Connection management SHOULD be based on the HTTP provided mechanisms (Connection and Proxy-Connection header fields) and not on the connection flag carried in the TCP-message. 4. File based protocol A file containing a PKI message MUST contain only the DER encoding of one PKI message, i.e., there MUST be no extraneous header or trailer information in the file. Such files can be used to transport PKI messages using, e.g., FTP. 5. Mail based protocol This subsection specifies a means for conveying ASN.1-encoded messages for the protocol exchanges via Internet mail. A simple MIME object is specified as follows. Content-Type: application/pkixcmp Content-Transfer-Encoding: base64 <> This MIME object can be sent and received using common MIME processing engines and provides a simple Internet mail transport for PKIX-CMP messages. Implementations MAY wish to also recognize and use the "application/x-pkixcmp" MIME type (specified in earlier versions of this document) in order to support backward compatibility wherever applicable. 6. Security Considerations Three aspects need to be considered by server side implementors: 1. There is no security at the TCP and HTTP protocol level (unless tunneled via SSL/TLS) and thus TCP-message should not be used to change state of the transaction. Change of state should be done on the signed PKIMessage being carried within the TCP-message. 2. If the server is going to be sending messages with sensitive information (not meant for public consumption) in the clear, it is RECOMMENDED that the server send back the message directly and not use the pollRep. 3. The polling request/response mechanism can be used for all kinds of denial of service attacks. It is RECOMMENDED that the server not change the polling-reference between polling requests. 7. Acknowledgments The authors gratefully acknowledge the contributions of various members of the IETF PKIX Working Group and the ICSA CA-talk mailing list (a list solely devoted to discussing CMP interoperability efforts). 8. References [RFC2510] Adams, C., Farrell, S., "Internet X.509 Public Key Infrastructure, Certificate Management Protocols", RFC 2510, March 1999. [CMP] Adams, C., Farrell, S., "Internet X.509 Public Key Infrastructure, Certificate Management Protocols", draft-ietf-pkix-rfc2510bis-01.txt, July 2000 [HTTP] Fielding, R.T., et. al, "Hypertext Transfer Protocol -- HTTP/1.1", RFC 2616, June 1999. [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", RFC 2119, March 1997. [RFC821] Postel, J., "Simple Mail Transfer Protocol", RFC 821, August 1982. Authors' Addresses Amit Kapoor Certicom 25801 Industrial Blvd Hayward, CA 94545 US E-Mail: amit@trustpoint.com Ronald Tschal„r Certicom 25801 Industrial Blvd Hayward, CA 94545 US E-Mail: ronald@trustpoint.com Appendix A: Registration of MIME Type for Section 3 To: ietf-types@iana.org Subject: Registration of MIME media type application/pkixcmp-poll MIME media type name: application MIME subtype name: pkixcmp-poll Required parameters: none Optional parameters: none Encoding considerations: Content may contain arbitrary octet values (the ASN.1 DER encoding of a PKI message, as defined in the IETF PKIX Working Group specifications). base64 encoding is required for MIME e-mail; no encoding is necessary for HTTP. Security considerations: This MIME type may be used to transport Public-Key Infrastructure (PKI) messages between PKI entities. These messages are defined by the IETF PKIX Working Group and are used to establish and maintain an Internet X.509 PKI. There is no requirement for specific security mechanisms to be applied at this level if the PKI messages themselves are protected as defined in the PKIX specifications. Interoperability considerations: - Published specification: this document Applications which use this media type: Applications using certificate management, operational, or ancillary protocols (as defined by the IETF PKIX Working Group) to send PKI messages via e-mail or HTTP. Additional information: Magic number (s): - File extension (s): ".cmp" Macintosh File Type Code (s): - Person and email address to contact for further information: Carlisle Adams, cadams@entrust.com Intended usage: COMMON Author/Change controller: Carlisle Adams Full Copyright Statement Copyright (C) The Internet Society (2000). All Rights Reserved. This document and translations of it may be copied and furnished to others, and derivative works that comment on or otherwise explain it or assist in its implementation may be prepared, copied, published and distributed, in whole or in part, without restriction of any kind, provided that the above copyright notice and this paragraph are included on all such copies and derivative works. However, this document itself may not be modified in any way, such as by removing the copyright notice or references to the Internet Society or other Internet organizations, except as needed for the purpose of developing Internet standards in which case the procedures for copyrights defined in the Internet Standards process must be followed, or as required to translate it into languages other than English. The limited permissions granted above are perpetual and will not be revoked by the Internet Society or its successors or assigns. This document and the information contained herein is provided on an "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.