Network Working Group A. Melnikov Internet-Draft Isode Ltd Intended status: Informational 4 March 2024 Expires: 5 September 2024 JMAP extension for S/MIME signing and encryption draft-melnikov-jmap-smime-sender-extensions-alt-06 Abstract This document specifies an extension to JMAP for sending S/MIME signed and/or S/MIME encrypted messages, as well as automatic decryption of received S/MIME messages. [[This version presents an alternative syntax to revision 04 of https://datatracker.ietf.org/doc/draft-ietf-jmap-smime-sender- extensions/]] Status of This Memo This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79. Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet- Drafts is at https://datatracker.ietf.org/drafts/current/. 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." This Internet-Draft will expire on 5 September 2024. Copyright Notice Copyright (c) 2024 IETF Trust and the persons identified as the document authors. All rights reserved. Melnikov Expires 5 September 2024 [Page 1] Internet-Draft JMAP extension for S/MIME March 2024 This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/ license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Revised BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Revised BSD License. Table of Contents 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 2. Conventions Used in This Document . . . . . . . . . . . . . . 2 3. Addition to the capabilities object . . . . . . . . . . . . . 3 4. Extension to Email/set for S/MIME signing and/or encryption . . . . . . . . . . . . . . . . . . . . . . . 3 5. Email/smimeDecrypt method for S/MIME decryption . . . . . . . 7 6. Extension to Email/query for S/MIME decryption . . . . . . . 10 7. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 10 7.1. JMAP capability registration for "smime-advanced" . . . . 11 7.2. JMAP Error Codes Registry Updates . . . . . . . . . . . . 11 7.2.1. signedSenderNotAllowed error code . . . . . . . . . . 11 7.2.2. validEncryptionKeyNotFound error code . . . . . . . . 11 8. Security Considerations . . . . . . . . . . . . . . . . . . . 11 9. References . . . . . . . . . . . . . . . . . . . . . . . . . 12 9.1. Normative References . . . . . . . . . . . . . . . . . . 12 9.2. Informative References . . . . . . . . . . . . . . . . . 13 Appendix A. Acknowledgements . . . . . . . . . . . . . . . . . . 13 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 13 1. Introduction [RFC8621] is a JSON based application protocol for synchronising email data between a client and a server. This document describes an extension to JMAP for sending S/MIME signed and/or encrypted messages, as well as automatic decryption of received S/MIME messages. It allows JMAP server to sign/encrypt messages on user's behalf. 2. Conventions Used in This Document The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC2119]. This document uses the terms "Cryptographic Layer" and "Cryptographic Envelope" as defined in [draft-ietf-lamps-e2e-mail-guidance] Melnikov Expires 5 September 2024 [Page 2] Internet-Draft JMAP extension for S/MIME March 2024 3. Addition to the capabilities object The capabilities object is returned as part of the standard JMAP Session object; see the JMAP spec. Servers supporting _this_ specification MUST add a property called "urn:ietf:params:jmap:smime- advanced" to the capabilities object. The value of this property is an empty object in both the JMAP session _capabilities_ property and an account's _accountCapabilities_ property. 4. Extension to Email/set for S/MIME signing and/or encryption [RFC8621] defines Email/set method for creating new email messages. This document defines the following additional Email/set argument that can be used to create S/MIME signed and/or encrypted messages: smimeOperations: SmimeOperation[]|null (default: null). The list of S/MIME operations to perform, in the order specified. If none are specified, or if this property is omitted, no S/MIME operation is performed. If multiple messages are specified in the "create" argument, these operations apply to each of them. headersToObscure: "String[String]"|"none"|null (default: null). If smimeOperations contains an "encrypt" operation, this specifies the list of header fields to obscure, as well as their obscured representation (see [draft-ietf-lamps-header-protection]). If the value is the string "none", no header field should be obscured. If the value is null, or if this property is omitted, the set of header fields to be protected is left up to the JMAP server. headersToProtect: "String[]"|"all"|"none"|null (default: null). The list of header fields which should be protected by the smimeOperations specified. If the value is "all", all header fields of the original message should be protected. If the value is "none", no header fields should be protected. If the value is null, or if this property is omitted, the set of header fields to be protected is left up to the JMAP server. The SmimeOperation object contains the following attributes: * operation: "String". S/MIME operation to perform. This document only defines 2 possible values: "sign" and "encrypt". Future documents might add further values. * options: "SignOptions"|"EncryptOptions"|null (default: null). Options controlling aspects of S/MIME signing or S/MIME encryption. If this attributes includes SignOptions when the Melnikov Expires 5 September 2024 [Page 3] Internet-Draft JMAP extension for S/MIME March 2024 operation attribute has the value "encrypt" or if this attributes includes EncryptOptions when the operation attribute has the value "sign", then JMAP server MUST return the invalidArguments error code. The SignOptions object contains the following attributes: * algorithm: "String"|null (default: null). The value represents the signature algorithm that the JMAP server should use to sign this message. If the algorithm is unspecified (the value "null") or this property is omitted, the JMAP server chooses the most appropriate algorithm to use. If the algorithm name specified is unrecognized by the server, it MUST return the unknownSignatureAlgo error code. [[Register unknownSignatureAlgo error code with IANA.]] Currently specified algorithms are "ecdsa_secp256r1_sha256", "ed25519", "rsa_pkcs1_sha256", "rsa_pss_pss_sha256". [[Alexey: probably need to define a new IANA registry or reference an existing one.]] * opaque: "Boolean" (default: true). If the value is "true", this requests the JMAP server to use application/pkcs7-mime [RFC8551] media type for S/MIME signing, otherwise multipart/signed [RFC1847] media type. The EncryptOptions object contains the following attributes: * keyEncryptionAlgorithm: "String"|null (default: null). The value represents the key encryption algorithm that the JMAP server should use when encrypting this message. If the algorithm is unspecified, this property is omitted, or an unrecognized algorithm string is specified, the JMAP server chooses the most appropriate algorithm to use. [[Need a new IANA registry or a link to an existing one here.]] * contentEncryptionAlgorithm: "String"|null (default: null). The value represents the data encryption algorithm that the JMAP server should use when encrypting this message. If the algorithm is unspecified, this property is omitted, or an unrecognized algorithm string is specified, the JMAP server chooses the most appropriate algorithm to use. [[Need a new IANA registry or a link to an existing one here.]] When the operation attribute value is "sign", JMAP server constructs the S/MIME signed message from the original message (if this is the first operation) or the result of the previous operation, taking into considerations the SignOptions object (if present) or its defaults. The signature's private key/certificate is associated with the email address in the Sender header field, if present; otherwise, it is Melnikov Expires 5 September 2024 [Page 4] Internet-Draft JMAP extension for S/MIME March 2024 associated with the email address in the From header field, if present. If multiple addresses are present in one of these header fields, or there is more than one Sender/From header field, the server SHOULD reject the Email/set as invalid with the "invalidEmail" error code; otherwise, it MUST take the first address in the last Sender/From header field. If JMAP account is not authorized to sign message as the selected sender (as above), it SHOULD return "signedSenderNotAllowed" error code. When the operation is "encrypt", JMAP server constructs the S/MIME encrypted message from the original message (if this is the first operation) or the result of the previous operation, taking into considerations the EncryptOptions object (if present) or its defaults. This is done by encapsulating the message inside application/pkcs7-mime [RFC8551] media type. The message MUST be encrypted to the sender and all To/Cc/Bcc recipients. This extension assumes that there is some kind of per user or organizational addressbook, that can be used to lookup public keys of recipients. If lookup of a particular public key fails, or results in an expired or revoked certificate, the Email/set operation MUST fail with the "validEncryptionKeyNotFound" error code. (Note that this extension doesn't allow management of private keys/ certificates. How private keys are managed or configured for a particular user is out of scope for this document.) [[ "Email/set", { "accountId": "ue150411c", "create": { "k192": { "mailboxIds": { "2ea1ca41b38e": true }, "keywords": { "$seen": true, "$draft": true }, "from": [{ "name": "Joe Bloggs", "email": "joe@example.com" }], "subject": "World domination", "receivedAt": "2021-07-07T01:03:11Z", "sentAt": "2021-07-10T11:03:11+10:00", "bodyStructure": { "type": "text/plain", Melnikov Expires 5 September 2024 [Page 5] Internet-Draft JMAP extension for S/MIME March 2024 "partId": "bd48", "header:Content-Language": "en" }, "bodyValues": { "bd48": { "value": "I have the most brilliant plan. Let me tell you all about it.", "isTruncated": false } } } }, "smimeOperations": [{ "operation": "sign", "options": { "opaque": false, "headersToProtect": "all" } }, { "operation": "encrypt" } ] }, "0" ]] This will result in the following response: [[ "Email/set", { "accountId": "ue150411c", "oldState": "780823", "newState": "780839", "created": { "k192": { "id": "Mf40b5f831efa7233b9eb1c7f", "blobId": "Gf40b5f831efa7233b9eb1c7f8f97d84eeeee64f7", "threadId": "Td957e72e89f516dc", "size": 5096 } }, ... }, "0" ]] Figure 1: Example 1: Melnikov Expires 5 September 2024 [Page 6] Internet-Draft JMAP extension for S/MIME March 2024 5. Email/smimeDecrypt method for S/MIME decryption The new method defined in this section is loosely based on Blob/ upload method defined in [RFC9404]. The Email/smimeDecrypt method creates new blob(s) with decrypted content of existing blob(s). The resulting Id can be used in Email/parse method to import the decrypted message. If the specified blob doesn't specify encrypted content, the returned Id attribute has the same value as the "blobId" attribute. *Parameters* * accountId: "Id". The id of the account in which the blobs will be created. * create: "Id[DecryptObjects]". A map of creation id to DecryptObjects *Result* The result is the same as for Foo/set in [RFC8620], with created and notCreated objects mapping from the creation id. The created objects contain: * id: "Id". The blobId that was created. * type: "String|null". The media type as given in the creation (if any). If not provided, the server MAY perform content analysis and return one of the following: the calculated value, "application/octet- string", or null. * size: "UnsignedInt". As per [RFC8620], the size of the created blob in octets. The DecryptObjects objects contains: * data: "DecryptDataSourceObject[]". An array of zero or more octet sources in order (zero to create an empty blob). The result of each of these sources is concatenated in order to create the blob. * type: "String|null" (default: null). A hint for media type of the data. The DecryptDataSourceObject objects contains exactly one of: * data:asBase64: "String|null" (base64 representation of octets) Melnikov Expires 5 September 2024 [Page 7] Internet-Draft JMAP extension for S/MIME March 2024 * or a blobId source: * blobId: "Id" * offset: "UnsignedInt|null" (MAY be zero). If null, then offset is assumed to be zero. * length: "UnsignedInt|null" (MAY be zero). If null, then length is the remaining octets in the blob. The created objects will also contain any other properties identical to those that would be returned in the JSON response of the upload endpoint described in [RFC8620]. This may be extended in the future; in this document, it is anticipated that implementations will extend both the upload endpoint and the Email/smimeDecrypt responses in the same way. If there is a problem with a creation, then the server will return a notCreated response with a map from the failed creation id to a SetError object. For each successful decryption, servers MUST add an entry to the createdIds map ([RFC8620], Section 3.3) for the request; even if the caller did not explicitly pass a createdIds, the value must be available to later methods defined in the same Request Object. This allows the blobId to be used via back-reference in subsequent method calls. The created blob will have the same lifetime and same expiry semantics as any other binary object created via the mechanism specified in [RFC8620], Section 6. First, find bodyparts that need decrypting: [[ "Email/get", { "ids": [ "f123u986" ], "properties": [ "threadId", "mailboxIds", "from", "subject", "receivedAt", "bodyStructure" ], "bodyProperties": [ "partId", "blobId", "size", "type" ] }, "#1" ]] This will result in the following response: [[ "Email/get", { "accountId": "abc", "state": "41234123231", Melnikov Expires 5 September 2024 [Page 8] Internet-Draft JMAP extension for S/MIME March 2024 "list": [ { "id": "f123u986", "threadId": "cb1314a", "mailboxIds": { "da123c": true }, "from": [{ "name": "Mice Ace", "email": "mike@example.com" }], "subject": "Dinner on Saturday?", "receivedAt": "2023-03-09T14:12:00Z", "bodyStructure": [{ "partId": "1", "blobId": "B841623871", "size": 120537, "type": "application/pkcs7-mime" }] } ] }, "#1" ]] Then decrypt the specific body part using the retrieved blobId. [ "Email/smimeDecrypt", { "accountId": "account1", "create": { "1": { "data" : [ { "blobId": "B841623871" } ] } } }, "R1" ] Response: [ "Email/smimeDecrypt", { "accountId" : "account1", "created" : { "1": { "id" : "G4c6751edf9dd6903ff54b792e432fba781271beb", "type" : "multipart/mixed", "size" : 1295 Melnikov Expires 5 September 2024 [Page 9] Internet-Draft JMAP extension for S/MIME March 2024 } } }, "R1" ] Figure 2: Example 2: 6. Extension to Email/query for S/MIME decryption [RFC8621] defines Email/query method for searching for email messages. This document defines the following additional request arguments to the *FilterCondition* object that can be used to search for S/MIME signed and/or encrypted messages: * isEncrypted: "Boolean" (default: false) If isEncrypted is true, then an Email matches this condition if it has a "Cryptographic Envelope" that contains an encryption (PKCS7 enveloped-data or PKCS7 authEnveloped-data) "Cryptographic Layer". [[Alexey: Do we want to limit this to S/MIME encryption and not OpenPGP?]] * isNotEncrypted: "Boolean" (default: false) If isNotEncrypted is true, then an Email matches this condition if it doesn't have a "Cryptographic Envelope" or it has a "Cryptographic Envelope", but it doesn't include any encryption (PKCS7 enveloped-data or PKCS7 authEnveloped-data) "Cryptographic Layer". * isSigned: "Boolean" (default: false) If isSigned is true, then an Email matches this condition if it has a "Cryptographic Envelope" that contain a Multipart Signed or PKCS7 signed-data "Cryptographic Layer". [[Alexey: Do we want to limit this to S/MIME signing and not OpenPGP?]] * isNotSigned: "Boolean" (default: false) If isNotSigned is true, then an Email matches this condition if it doesn't have a "Cryptographic Envelope" or it has a "Cryptographic Envelope", but it doesn't include any Multipart Signed or PKCS7 signed-data "Cryptographic Layer". 7. IANA Considerations Melnikov Expires 5 September 2024 [Page 10] Internet-Draft JMAP extension for S/MIME March 2024 7.1. JMAP capability registration for "smime-advanced" IANA is requested to register the "smime" JMAP Capability as follows: Capability Name: "urn:ietf:params:jmap:smime-advanced" Specification document: this document Intended use: common Change Controller: IETF Security and privacy considerations: this document, Section 8 7.2. JMAP Error Codes Registry Updates 7.2.1. signedSenderNotAllowed error code JMAP Error Code: signedSenderNotAllowed Intended use: common Change controller: IETF Reference: This document, Section 4 Description: JMAP account is not authorized to S/MIME sign message as the specified sender. 7.2.2. validEncryptionKeyNotFound error code JMAP Error Code: validEncryptionKeyNotFound Intended use: common Change controller: IETF Reference: This document, Section 4 Description: S/MIME encrypted message can't be generated because no valid certificate (non expired and non revoked) can be found for one of recipients. 8. Security Considerations This JMAP extension assumes trust between the user and the JMAP server for purposes of signing and encrypting messages on user's behalf. Melnikov Expires 5 September 2024 [Page 11] Internet-Draft JMAP extension for S/MIME March 2024 This JMAP extension also relies on access to user's (or organization's) addressbook which contain up-to-date certificates for recipients. This JMAP extension doesn't support management of user's private keys and corresponding certificates. 9. References 9.1. Normative References [RFC1847] Galvin, J., Murphy, S., Crocker, S., and N. Freed, "Security Multiparts for MIME: Multipart/Signed and Multipart/Encrypted", RFC 1847, DOI 10.17487/RFC1847, October 1995, . [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, March 1997, . [RFC8550] Schaad, J., Ramsdell, B., and S. Turner, "Secure/ Multipurpose Internet Mail Extensions (S/MIME) Version 4.0 Certificate Handling", RFC 8550, DOI 10.17487/RFC8550, April 2019, . [RFC8551] Schaad, J., Ramsdell, B., and S. Turner, "Secure/ Multipurpose Internet Mail Extensions (S/MIME) Version 4.0 Message Specification", RFC 8551, DOI 10.17487/RFC8551, April 2019, . [RFC8620] Jenkins, N. and C. Newman, "The JSON Meta Application Protocol (JMAP)", RFC 8620, DOI 10.17487/RFC8620, July 2019, . [RFC8621] Jenkins, N. and C. Newman, "The JSON Meta Application Protocol (JMAP) for Mail", RFC 8621, DOI 10.17487/RFC8621, August 2019, . [draft-ietf-lamps-header-protection] Gillmor, D. K., Hoeneisen, B., and A. Melnikov, "Header Protection for Cryptographically Protected E-mail", Work in Progress, Internet-Draft, draft-ietf-lamps-header- protection-20, 1 March 2024, . Melnikov Expires 5 September 2024 [Page 12] Internet-Draft JMAP extension for S/MIME March 2024 [draft-ietf-lamps-e2e-mail-guidance] Gillmor, D. K., Hoeneisen, B., and A. Melnikov, "Guidance on End-to-End E-mail Security", Work in Progress, Internet-Draft, draft-ietf-lamps-e2e-mail-guidance-15, 1 March 2024, . 9.2. Informative References [RFC9404] Gondwana, B., Ed., "JSON Meta Application Protocol (JMAP) Blob Management Extension", RFC 9404, DOI 10.17487/RFC9404, August 2023, . Appendix A. Acknowledgements Thank you to Phillip Tao and Neil Jenkins for suggestions, comments and corrections on this document. Author's Address Alexey Melnikov Isode Ltd 14 Castle Mews Hampton TW12 2NP United Kingdom Email: Alexey.Melnikov@isode.com Melnikov Expires 5 September 2024 [Page 13]