Tech-invite3GPPspaceIETFspace
96959493929190898887868584838281807978777675747372717069686766656463626160595857565554535251504948474645444342414039383736353433323130292827262524232221201918171615141312111009080706050403020100
in Index   Prev   Next

RFC 2630

Cryptographic Message Syntax

Pages: 60
Obsoleted by:  33693370
Part 2 of 2 – Pages 28 to 60
First   Prev   None

ToP   noToC   RFC2630 - Page 28   prevText

10.2 Other Useful Types

This section defines types that are used other places in the document. The types are not listed in any particular order.

10.2.1 CertificateRevocationLists

The CertificateRevocationLists type gives a set of certificate revocation lists (CRLs). It is intended that the set contain information sufficient to determine whether the certificates and
ToP   noToC   RFC2630 - Page 29
   attribute certificates with which the set is associated are revoked
   or not.  However, there may be more CRLs than necessary or there may
   be fewer CRLs than necessary.

   The CertificateList may contain a CRL, an Authority Revocation List
   (ARL), a Delta Revocation List, or an Attribute Certificate
   Revocation List.  All of these lists share a common syntax.

   CRLs are specified in X.509 [X.509-97], and they are profiled for use
   in the Internet in RFC 2459 [PROFILE].

   The definition of CertificateList is imported from X.509.

      CertificateRevocationLists ::= SET OF CertificateList

10.2.2 CertificateChoices

The CertificateChoices type gives either a PKCS #6 extended certificate [PKCS#6], an X.509 certificate, or an X.509 attribute certificate [X.509-97]. The PKCS #6 extended certificate is obsolete. PKCS #6 certificates are included for backward compatibility, and their use should be avoided. The Internet profile of X.509 certificates is specified in the "Internet X.509 Public Key Infrastructure: Certificate and CRL Profile" [PROFILE]. The definitions of Certificate and AttributeCertificate are imported from X.509. CertificateChoices ::= CHOICE { certificate Certificate, -- See X.509 extendedCertificate [0] IMPLICIT ExtendedCertificate, -- Obsolete attrCert [1] IMPLICIT AttributeCertificate } -- See X.509 and X9.57

10.2.3 CertificateSet

The CertificateSet type provides a set of certificates. It is intended that the set be sufficient to contain chains from a recognized "root" or "top-level certification authority" to all of the sender certificates with which the set is associated. However, there may be more certificates than necessary, or there may be fewer than necessary. The precise meaning of a "chain" is outside the scope of this document. Some applications may impose upper limits on the length of a chain; others may enforce certain relationships between the subjects and issuers of certificates within a chain.
ToP   noToC   RFC2630 - Page 30
      CertificateSet ::= SET OF CertificateChoices

10.2.4 IssuerAndSerialNumber

The IssuerAndSerialNumber type identifies a certificate, and thereby an entity and a public key, by the distinguished name of the certificate issuer and an issuer-specific certificate serial number. The definition of Name is imported from X.501 [X.501-88], and the definition of CertificateSerialNumber is imported from X.509 [X.509-97]. IssuerAndSerialNumber ::= SEQUENCE { issuer Name, serialNumber CertificateSerialNumber } CertificateSerialNumber ::= INTEGER

10.2.5 CMSVersion

The Version type gives a syntax version number, for compatibility with future revisions of this document. CMSVersion ::= INTEGER { v0(0), v1(1), v2(2), v3(3), v4(4) }

10.2.6 UserKeyingMaterial

The UserKeyingMaterial type gives a syntax for user keying material (UKM). Some key agreement algorithms require UKMs to ensure that a different key is generated each time the same two parties generate a pairwise key. The sender provides a UKM for use with a specific key agreement algorithm. UserKeyingMaterial ::= OCTET STRING

10.2.7 OtherKeyAttribute

The OtherKeyAttribute type gives a syntax for the inclusion of other key attributes that permit the recipient to select the key used by the sender. The attribute object identifier must be registered along with the syntax of the attribute itself. Use of this structure should be avoided since it may impede interoperability. OtherKeyAttribute ::= SEQUENCE { keyAttrId OBJECT IDENTIFIER, keyAttr ANY DEFINED BY keyAttrId OPTIONAL }
ToP   noToC   RFC2630 - Page 31

11 Useful Attributes

This section defines attributes that may be used with signed-data, enveloped-data, encrypted-data, or authenticated-data. The syntax of Attribute is compatible with X.501 [X.501-88] and RFC 2459 [PROFILE]. Some of the attributes defined in this section were originally defined in PKCS #9 [PKCS#9], others were not previously defined. The attributes are not listed in any particular order. Additional attributes are defined in many places, notably the S/MIME Version 3 Message Specification [MSG] and the Enhanced Security Services for S/MIME [ESS], which also include recommendations on the placement of these attributes.

11.1 Content Type

The content-type attribute type specifies the content type of the ContentInfo value being signed in signed-data. The content-type attribute type is required if there are any authenticated attributes present. The content-type attribute must be a signed attribute or an authenticated attribute; it cannot be an unsigned attribute, an unauthenticated attribute, or an unprotectedAttribute. The following object identifier identifies the content-type attribute: id-contentType OBJECT IDENTIFIER ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs9(9) 3 } Content-type attribute values have ASN.1 type ContentType: ContentType ::= OBJECT IDENTIFIER A content-type attribute must have a single attribute value, even though the syntax is defined as a SET OF AttributeValue. There must not be zero or multiple instances of AttributeValue present. The SignedAttributes and AuthAttributes syntaxes are each defined as a SET OF Attributes. The SignedAttributes in a signerInfo must not include multiple instances of the content-type attribute. Similarly, the AuthAttributes in an AuthenticatedData must not include multiple instances of the content-type attribute.
ToP   noToC   RFC2630 - Page 32

11.2 Message Digest

The message-digest attribute type specifies the message digest of the encapContentInfo eContent OCTET STRING being signed in signed-data (see section 5.4) or authenticated in authenticated-data (see section 9.2). For signed-data, the message digest is computed using the signer's message digest algorithm. For authenticated-data, the message digest is computed using the originator's message digest algorithm. Within signed-data, the message-digest signed attribute type is required if there are any attributes present. Within authenticated- data, the message-digest authenticated attribute type is required if there are any attributes present. The message-digest attribute must be a signed attribute or an authenticated attribute; it cannot be an unsigned attribute or an unauthenticated attribute. The following object identifier identifies the message-digest attribute: id-messageDigest OBJECT IDENTIFIER ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs9(9) 4 } Message-digest attribute values have ASN.1 type MessageDigest: MessageDigest ::= OCTET STRING A message-digest attribute must have a single attribute value, even though the syntax is defined as a SET OF AttributeValue. There must not be zero or multiple instances of AttributeValue present. The SignedAttributes syntax is defined as a SET OF Attributes. The SignedAttributes in a signerInfo must not include multiple instances of the message-digest attribute.

11.3 Signing Time

The signing-time attribute type specifies the time at which the signer (purportedly) performed the signing process. The signing-time attribute type is intended for use in signed-data. The signing-time attribute may be a signed attribute; it cannot be an unsigned attribute, an authenticated attribute, or an unauthenticated attribute.
ToP   noToC   RFC2630 - Page 33
   The following object identifier identifies the signing-time
   attribute:

      id-signingTime OBJECT IDENTIFIER ::= { iso(1) member-body(2)
          us(840) rsadsi(113549) pkcs(1) pkcs9(9) 5 }

   Signing-time attribute values have ASN.1 type SigningTime:

      SigningTime ::= Time

      Time ::= CHOICE {
        utcTime          UTCTime,
        generalizedTime  GeneralizedTime }

   Note: The definition of Time matches the one specified in the 1997
   version of X.509 [X.509-97].

   Dates between 1 January 1950 and 31 December 2049 (inclusive) must be
   encoded as UTCTime.  Any dates with year values before 1950 or after
   2049 must be encoded as GeneralizedTime.

   UTCTime values must be expressed in Greenwich Mean Time (Zulu) and
   must include seconds (i.e., times are YYMMDDHHMMSSZ), even where the
   number of seconds is zero.  Midnight (GMT) must be represented as
   "YYMMDD000000Z".  Century information is implicit, and the century
   must be determined as follows:

      Where YY is greater than or equal to 50, the year shall be
      interpreted as 19YY; and

      Where YY is less than 50, the year shall be interpreted as 20YY.

   GeneralizedTime values shall be expressed in Greenwich Mean Time
   (Zulu) and must include seconds (i.e., times are YYYYMMDDHHMMSSZ),
   even where the number of seconds is zero.  GeneralizedTime values
   must not include fractional seconds.

   A signing-time attribute must have a single attribute value, even
   though the syntax is defined as a SET OF AttributeValue.  There must
   not be zero or multiple instances of AttributeValue present.

   The SignedAttributes syntax is defined as a SET OF Attributes.  The
   SignedAttributes in a signerInfo must not include multiple instances
   of the signing-time attribute.

   No requirement is imposed concerning the correctness of the signing
   time, and acceptance of a purported signing time is a matter of a
   recipient's discretion.  It is expected, however, that some signers,
ToP   noToC   RFC2630 - Page 34
   such as time-stamp servers, will be trusted implicitly.

11.4 Countersignature

The countersignature attribute type specifies one or more signatures on the contents octets of the DER encoding of the signatureValue field of a SignerInfo value in signed-data. Thus, the countersignature attribute type countersigns (signs in serial) another signature. The countersignature attribute must be an unsigned attribute; it cannot be a signed attribute, an authenticated attribute, or an unauthenticated attribute. The following object identifier identifies the countersignature attribute: id-countersignature OBJECT IDENTIFIER ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs9(9) 6 } Countersignature attribute values have ASN.1 type Countersignature: Countersignature ::= SignerInfo Countersignature values have the same meaning as SignerInfo values for ordinary signatures, except that: 1. The signedAttributes field must contain a message-digest attribute if it contains any other attributes, but need not contain a content-type attribute, as there is no content type for countersignatures. 2. The input to the message-digesting process is the contents octets of the DER encoding of the signatureValue field of the SignerInfo value with which the attribute is associated. A countersignature attribute can have multiple attribute values. The syntax is defined as a SET OF AttributeValue, and there must be one or more instances of AttributeValue present. The UnsignedAttributes syntax is defined as a SET OF Attributes. The UnsignedAttributes in a signerInfo may include multiple instances of the countersignature attribute. A countersignature, since it has type SignerInfo, can itself contain a countersignature attribute. Thus it is possible to construct arbitrarily long series of countersignatures.
ToP   noToC   RFC2630 - Page 35

12 Supported Algorithms

This section lists the algorithms that must be implemented. Additional algorithms that should be implemented are also included.

12.1 Digest Algorithms

CMS implementations must include SHA-1. CMS implementations should include MD5. Digest algorithm identifiers are located in the SignedData digestAlgorithms field, the SignerInfo digestAlgorithm field, the DigestedData digestAlgorithm field, and the AuthenticatedData digestAlgorithm field. Digest values are located in the DigestedData digest field, and digest values are located in the Message Digest authenticated attribute. In addition, digest values are input to signature algorithms.

12.1.1 SHA-1

The SHA-1 digest algorithm is defined in FIPS Pub 180-1 [SHA1]. The algorithm identifier for SHA-1 is: sha-1 OBJECT IDENTIFIER ::= { iso(1) identified-organization(3) oiw(14) secsig(3) algorithm(2) 26 } The AlgorithmIdentifier parameters field is optional. If present, the parameters field must contain an ASN.1 NULL. Implementations should accept SHA-1 AlgorithmIdentifiers with absent parameters as well as NULL parameters. Implementations should generate SHA-1 AlgorithmIdentifiers with NULL parameters.

12.1.2 MD5

The MD5 digest algorithm is defined in RFC 1321 [MD5]. The algorithm identifier for MD5 is: md5 OBJECT IDENTIFIER ::= { iso(1) member-body(2) us(840) rsadsi(113549) digestAlgorithm(2) 5 } The AlgorithmIdentifier parameters field must be present, and the parameters field must contain NULL. Implementations may accept the MD5 AlgorithmIdentifiers with absent parameters as well as NULL parameters.
ToP   noToC   RFC2630 - Page 36

12.2 Signature Algorithms

CMS implementations must include DSA. CMS implementations may include RSA. Signature algorithm identifiers are located in the SignerInfo signatureAlgorithm field. Also, signature algorithm identifiers are located in the SignerInfo signatureAlgorithm field of countersignature attributes. Signature values are located in the SignerInfo signature field. Also, signature values are located in the SignerInfo signature field of countersignature attributes.

12.2.1 DSA

The DSA signature algorithm is defined in FIPS Pub 186 [DSS]. DSA is always used with the SHA-1 message digest algorithm. The algorithm identifier for DSA is: id-dsa-with-sha1 OBJECT IDENTIFIER ::= { iso(1) member-body(2) us(840) x9-57 (10040) x9cm(4) 3 } The AlgorithmIdentifier parameters field must not be present.

12.2.2 RSA

The RSA signature algorithm is defined in RFC 2347 [NEWPKCS#1]. RFC 2347 specifies the use of the RSA signature algorithm with the SHA-1 and MD5 message digest algorithms. The algorithm identifier for RSA is: rsaEncryption OBJECT IDENTIFIER ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-1(1) 1 }

12.3 Key Management Algorithms

CMS accommodates three general key management techniques: key agreement, key transport, and previously distributed symmetric key- encryption keys.

12.3.1 Key Agreement Algorithms

CMS implementations must include key agreement using X9.42 Ephemeral-Static Diffie-Hellman. Any symmetric encryption algorithm that a CMS implementation includes as a content-encryption algorithm must also be included as a key-
ToP   noToC   RFC2630 - Page 37
   encryption algorithm.  CMS implementations must include key agreement
   of Triple-DES pairwise key-encryption keys and Triple-DES wrapping of
   Triple-DES content-encryption keys.  CMS implementations should
   include key agreement of RC2 pairwise key-encryption keys and RC2
   wrapping of RC2 content-encryption keys.  The key wrap algorithm for
   Triple-DES and RC2 is described in section 12.3.3.

   A CMS implementation may support mixed key-encryption and content-
   encryption algorithms.  For example, a 128-bit RC2 content-encryption
   key may be wrapped with 168-bit Triple-DES key-encryption key.
   Similarly, a 40-bit RC2 content-encryption key may be wrapped with
   128-bit RC2 key-encryption key.

   For key agreement of RC2 key-encryption keys, 128 bits must be
   generated as input to the key expansion process used to compute the
   RC2 effective key [RC2].

   Key agreement algorithm identifiers are located in the EnvelopedData
   RecipientInfos KeyAgreeRecipientInfo keyEncryptionAlgorithm and
   AuthenticatedData RecipientInfos KeyAgreeRecipientInfo
   keyEncryptionAlgorithm fields.

   Key wrap algorithm identifiers are located in the KeyWrapAlgorithm
   parameters within the EnvelopedData RecipientInfos
   KeyAgreeRecipientInfo keyEncryptionAlgorithm and AuthenticatedData
   RecipientInfos KeyAgreeRecipientInfo keyEncryptionAlgorithm fields.

   Wrapped content-encryption keys are located in the EnvelopedData
   RecipientInfos KeyAgreeRecipientInfo RecipientEncryptedKeys
   encryptedKey field.  Wrapped message-authentication keys are located
   in the AuthenticatedData RecipientInfos KeyAgreeRecipientInfo
   RecipientEncryptedKeys encryptedKey field.

12.3.1.1 X9.42 Ephemeral-Static Diffie-Hellman
Ephemeral-Static Diffie-Hellman key agreement is defined in RFC 2631 [DH-X9.42]. When using Ephemeral-Static Diffie-Hellman, the EnvelopedData RecipientInfos KeyAgreeRecipientInfo and AuthenticatedData RecipientInfos KeyAgreeRecipientInfo fields are used as follows: version must be 3. originator must be the originatorKey alternative. The originatorKey algorithm fields must contain the dh-public-number object identifier with absent parameters. The originatorKey publicKey field must contain the sender's ephemeral public key. The dh-public-number object identifier is:
ToP   noToC   RFC2630 - Page 38
         dh-public-number OBJECT IDENTIFIER ::= { iso(1) member-body(2)
             us(840) ansi-x942(10046) number-type(2) 1 }

      ukm may be absent.  When present, the ukm is used to ensure that a
      different key-encryption key is generated when the ephemeral
      private key might be used more than once.

      keyEncryptionAlgorithm must be the id-alg-ESDH algorithm
      identifier.  The algorithm identifier parameter field for id-alg-
      ESDH is KeyWrapAlgorihtm, and this parameter must be present.  The
      KeyWrapAlgorithm denotes the symmetric encryption algorithm used
      to encrypt the content-encryption key with the pairwise key-
      encryption key generated using the Ephemeral-Static Diffie-Hellman
      key agreement algorithm.  Triple-DES and RC2 key wrap algorithms
      are discussed in section 12.3.3.  The id-alg-ESDH algorithm
      identifier and parameter syntax is:

       id-alg-ESDH OBJECT IDENTIFIER ::= { iso(1) member-body(2) us(840)
           rsadsi(113549) pkcs(1) pkcs-9(9) smime(16) alg(3) 5 }

       KeyWrapAlgorithm ::= AlgorithmIdentifier

      recipientEncryptedKeys contains an identifier and an encrypted key
      for each recipient.  The RecipientEncryptedKey
      KeyAgreeRecipientIdentifier must contain either the
      issuerAndSerialNumber identifying the recipient's certificate or
      the RecipientKeyIdentifier containing the subject key identifier
      from the recipient's certificate.  In both cases, the recipient's
      certificate contains the recipient's static public key.
      RecipientEncryptedKey EncryptedKey must contain the content-
      encryption key encrypted with the Ephemeral-Static Diffie-Hellman
      generated pairwise key-encryption key using the algorithm
      specified by the KeyWrapAlgortihm.

12.3.2 Key Transport Algorithms

CMS implementations should include key transport using RSA. RSA implementations must include key transport of Triple-DES content- encryption keys. RSA implementations should include key transport of RC2 content-encryption keys. Key transport algorithm identifiers are located in the EnvelopedData RecipientInfos KeyTransRecipientInfo keyEncryptionAlgorithm and AuthenticatedData RecipientInfos KeyTransRecipientInfo keyEncryptionAlgorithm fields. Key transport encrypted content-encryption keys are located in the EnvelopedData RecipientInfos KeyTransRecipientInfo encryptedKey
ToP   noToC   RFC2630 - Page 39
   field.  Key transport encrypted message-authentication keys are
   located in the AuthenticatedData RecipientInfos KeyTransRecipientInfo
   encryptedKey field.

12.3.2.1 RSA
The RSA key transport algorithm is the RSA encryption scheme defined in RFC 2313 [PKCS#1], block type is 02, where the message to be encrypted is the content-encryption key. The algorithm identifier for RSA is: rsaEncryption OBJECT IDENTIFIER ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-1(1) 1 } The AlgorithmIdentifier parameters field must be present, and the parameters field must contain NULL. When using a Triple-DES content-encryption key, adjust the parity bits for each DES key comprising the Triple-DES key prior to RSA encryption. The use of RSA encryption, as defined in RFC 2313 [PKCS#1], to provide confidentiality has a known vulnerability concerns. The vulnerability is primarily relevant to usage in interactive applications rather than to store-and-forward environments. Further information and proposed countermeasures are discussed in the Security Considerations section of this document. Note that the same encryption scheme is also defined in RFC 2437 [NEWPKCS#1]. Within RFC 2437, this scheme is called RSAES-PKCS1-v1_5.

12.3.3 Symmetric Key-Encryption Key Algorithms

CMS implementations may include symmetric key-encryption key management. Such CMS implementations must include Triple-DES key- encryption keys wrapping Triple-DES content-encryption keys, and such CMS implementations should include RC2 key-encryption keys wrapping RC2 content-encryption keys. Only 128-bit RC2 keys may be used as key-encryption keys, and they must be used with the RC2ParameterVersion parameter set to 58. A CMS implementation may support mixed key-encryption and content-encryption algorithms. For example, a 40-bit RC2 content-encryption key may be wrapped with 168-bit Triple-DES key-encryption key or with a 128-bit RC2 key- encryption key.
ToP   noToC   RFC2630 - Page 40
   Key wrap algorithm identifiers are located in the EnvelopedData
   RecipientInfos KEKRecipientInfo keyEncryptionAlgorithm and
   AuthenticatedData RecipientInfos KEKRecipientInfo
   keyEncryptionAlgorithm fields.

   Wrapped content-encryption keys are located in the EnvelopedData
   RecipientInfos KEKRecipientInfo encryptedKey field.  Wrapped
   message-authentication keys are located in the AuthenticatedData
   RecipientInfos KEKRecipientInfo encryptedKey field.

   The output of a key agreement algorithm is a key-encryption key, and
   this key-encryption key is used to encrypt the content-encryption
   key.  In conjunction with key agreement algorithms, CMS
   implementations must include encryption of content-encryption keys
   with the pairwise key-encryption key generated using a key agreement
   algorithm.  To support key agreement, key wrap algorithm identifiers
   are located in the KeyWrapAlgorithm parameter of the EnvelopedData
   RecipientInfos KeyAgreeRecipientInfo keyEncryptionAlgorithm and
   AuthenticatedData RecipientInfos KeyAgreeRecipientInfo
   keyEncryptionAlgorithm fields.  Wrapped content-encryption keys are
   located in the EnvelopedData RecipientInfos KeyAgreeRecipientInfo
   RecipientEncryptedKeys encryptedKey field, wrapped message-
   authentication keys are located in the AuthenticatedData
   RecipientInfos KeyAgreeRecipientInfo RecipientEncryptedKeys
   encryptedKey field.

12.3.3.1 Triple-DES Key Wrap
Triple-DES key encryption has the algorithm identifier: id-alg-CMS3DESwrap OBJECT IDENTIFIER ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-9(9) smime(16) alg(3) 6 } The AlgorithmIdentifier parameter field must be NULL. The key wrap algorithm used to encrypt a Triple-DES content- encryption key with a Triple-DES key-encryption key is specified in section 12.6. Out-of-band distribution of the Triple-DES key-encryption key used to encrypt the Triple-DES content-encryption key is beyond of the scope of this document.
ToP   noToC   RFC2630 - Page 41
12.3.3.2 RC2 Key Wrap
RC2 key encryption has the algorithm identifier: id-alg-CMSRC2wrap OBJECT IDENTIFIER ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-9(9) smime(16) alg(3) 7 } The AlgorithmIdentifier parameter field must be RC2wrapParameter: RC2wrapParameter ::= RC2ParameterVersion RC2ParameterVersion ::= INTEGER The RC2 effective-key-bits (key size) greater than 32 and less than 256 is encoded in the RC2ParameterVersion. For the effective-key- bits of 40, 64, and 128, the rc2ParameterVersion values are 160, 120, and 58 respectively. These values are not simply the RC2 key length. Note that the value 160 must be encoded as two octets (00 A0), because the one octet (A0) encoding represents a negative number. Only 128-bit RC2 keys may be used as key-encryption keys, and they must be used with the RC2ParameterVersion parameter set to 58. The key wrap algorithm used to encrypt a RC2 content-encryption key with a RC2 key-encryption key is specified in section 12.6. Out-of-band distribution of the RC2 key-encryption key used to encrypt the RC2 content-encryption key is beyond of the scope of this document.

12.4 Content Encryption Algorithms

CMS implementations must include Triple-DES in CBC mode. CMS implementations should include RC2 in CBC mode. Content encryption algorithms identifiers are located in the EnvelopedData EncryptedContentInfo contentEncryptionAlgorithm and the EncryptedData EncryptedContentInfo contentEncryptionAlgorithm fields. Content encryption algorithms are used to encipher the content located in the EnvelopedData EncryptedContentInfo encryptedContent field and the EncryptedData EncryptedContentInfo encryptedContent field.
ToP   noToC   RFC2630 - Page 42

12.4.1 Triple-DES CBC

The Triple-DES algorithm is described in ANSI X9.52 [3DES]. The Triple-DES is composed from three sequential DES [DES] operations: encrypt, decrypt, and encrypt. Three-Key Triple-DES uses a different key for each DES operation. Two-Key Triple-DES uses one key for the two encrypt operations and different key for the decrypt operation. The same algorithm identifiers are used for Three-Key Triple-DES and Two-Key Triple-DES. The algorithm identifier for Triple-DES in Cipher Block Chaining (CBC) mode is: des-ede3-cbc OBJECT IDENTIFIER ::= { iso(1) member-body(2) us(840) rsadsi(113549) encryptionAlgorithm(3) 7 } The AlgorithmIdentifier parameters field must be present, and the parameters field must contain a CBCParameter: CBCParameter ::= IV IV ::= OCTET STRING -- exactly 8 octets

12.4.2 RC2 CBC

The RC2 algorithm is described in RFC 2268 [RC2]. The algorithm identifier for RC2 in CBC mode is: rc2-cbc OBJECT IDENTIFIER ::= { iso(1) member-body(2) us(840) rsadsi(113549) encryptionAlgorithm(3) 2 } The AlgorithmIdentifier parameters field must be present, and the parameters field must contain a RC2CBCParameter: RC2CBCParameter ::= SEQUENCE { rc2ParameterVersion INTEGER, iv OCTET STRING } -- exactly 8 octets The RC2 effective-key-bits (key size) greater than 32 and less than 256 is encoded in the rc2ParameterVersion. For the effective-key- bits of 40, 64, and 128, the rc2ParameterVersion values are 160, 120, and 58 respectively. These values are not simply the RC2 key length. Note that the value 160 must be encoded as two octets (00 A0), since the one octet (A0) encoding represents a negative number.

12.5 Message Authentication Code Algorithms

CMS implementations that support authenticatedData must include HMAC with SHA-1.
ToP   noToC   RFC2630 - Page 43
   MAC algorithm identifiers are located in the AuthenticatedData
   macAlgorithm field.

   MAC values are located in the AuthenticatedData mac field.

12.5.1 HMAC with SHA-1

The HMAC with SHA-1 algorithm is described in RFC 2104 [HMAC]. The algorithm identifier for HMAC with SHA-1 is: hMAC-SHA1 OBJECT IDENTIFIER ::= { iso(1) identified-organization(3) dod(6) internet(1) security(5) mechanisms(5) 8 1 2 } The AlgorithmIdentifier parameters field must be absent.

12.6 Triple-DES and RC2 Key Wrap Algorithms

CMS implementations must include encryption of a Triple-DES content- encryption key with a Triple-DES key-encryption key using the algorithm specified in Sections 12.6.2 and 12.6.3. CMS implementations should include encryption of a RC2 content-encryption key with a RC2 key-encryption key using the algorithm specified in Sections 12.6.4 and 12.6.5. Triple-DES and RC2 content-encryption keys are encrypted in Cipher Block Chaining (CBC) mode [MODES]. Key Transport algorithms allow for the content-encryption key to be directly encrypted; however, key agreement and symmetric key- encryption key algorithms encrypt the content-encryption key with a second symmetric encryption algorithm. This section describes how the Triple-DES or RC2 content-encryption key is formatted and encrypted. Key agreement algorithms generate a pairwise key-encryption key, and a key wrap algorithm is used to encrypt the content-encryption key with the pairwise key-encryption key. Similarly, a key wrap algorithm is used to encrypt the content-encryption key in a previously distributed key-encryption key. The key-encryption key is generated by the key agreement algorithm or distributed out of band. For key agreement of RC2 key-encryption keys, 128 bits must be generated as input to the key expansion process used to compute the RC2 effective key [RC2]. The same algorithm identifier is used for both 2-key and 3-key Triple-DES. When the length of the content-encryption key to be wrapped is a 2-key Triple-DES key, a third key with the same value as the first key is created. Thus, all Triple-DES content-encryption keys are wrapped like 3-key Triple-DES keys.
ToP   noToC   RFC2630 - Page 44

12.6.1 Key Checksum

The CMS Checksum Algorithm is used to provide a content-encryption key integrity check value. The algorithm is: 1. Compute a 20 octet SHA-1 [SHA1] message digest on the content-encryption key. 2. Use the most significant (first) eight octets of the message digest value as the checksum value.

12.6.2 Triple-DES Key Wrap

The Triple-DES key wrap algorithm encrypts a Triple-DES content- encryption key with a Triple-DES key-encryption key. The Triple-DES key wrap algorithm is: 1. Set odd parity for each of the DES key octets comprising the content-encryption key, call the result CEK. 2. Compute an 8 octet key checksum value on CEK as described above in Section 12.6.1, call the result ICV. 3. Let CEKICV = CEK || ICV. 4. Generate 8 octets at random, call the result IV. 5. Encrypt CEKICV in CBC mode using the key-encryption key. Use the random value generated in the previous step as the initialization vector (IV). Call the ciphertext TEMP1. 6. Let TEMP2 = IV || TEMP1. 7. Reverse the order of the octets in TEMP2. That is, the most significant (first) octet is swapped with the least significant (last) octet, and so on. Call the result TEMP3. 8. Encrypt TEMP3 in CBC mode using the key-encryption key. Use an initialization vector (IV) of 0x4adda22c79e82105. The ciphertext is 40 octets long. Note: When the same content-encryption key is wrapped in different key-encryption keys, a fresh initialization vector (IV) must be generated for each invocation of the key wrap algorithm.

12.6.3 Triple-DES Key Unwrap

The Triple-DES key unwrap algorithm decrypts a Triple-DES content- encryption key using a Triple-DES key-encryption key. The Triple-DES key unwrap algorithm is: 1. If the wrapped content-encryption key is not 40 octets, then error. 2. Decrypt the wrapped content-encryption key in CBC mode using the key-encryption key. Use an initialization vector (IV) of 0x4adda22c79e82105. Call the output TEMP3.
ToP   noToC   RFC2630 - Page 45
   3.  Reverse the order of the octets in TEMP3.  That is, the most
       significant (first) octet is swapped with the least significant
       (last) octet, and so on.  Call the result TEMP2.
   4.  Decompose the TEMP2 into IV and TEMP1.  IV is the most
       significant (first) 8 octets, and TEMP1 is the least significant
       (last) 32 octets.
   5.  Decrypt TEMP1 in CBC mode using the key-encryption key.  Use
       the IV value from the previous step as the initialization vector.
       Call the ciphertext CEKICV.
   6.  Decompose the CEKICV into CEK and ICV. CEK is the most significant
       (first) 24 octets, and ICV is the least significant (last) 8 octets.
   7.  Compute an 8 octet key checksum value on CEK as described above
       in Section 12.6.1.  If the computed key checksum value does not
       match the decrypted key checksum value, ICV, then error.
   8.  Check for odd parity each of the DES key octets comprising CEK.
       If parity is incorrect, then there is an error.
   9.  Use CEK as the content-encryption key.

12.6.4 RC2 Key Wrap

The RC2 key wrap algorithm encrypts a RC2 content-encryption key with a RC2 key-encryption key. The RC2 key wrap algorithm is: 1. Let the content-encryption key be called CEK, and let the length of the content-encryption key in octets be called LENGTH. LENGTH is a single octet. 2. Let LCEK = LENGTH || CEK. 3. Let LCEKPAD = LCEK || PAD. If the length of LCEK is a multiple of 8, the PAD has a length of zero. If the length of LCEK is not a multiple of 8, then PAD contains the fewest number of random octets to make the length of LCEKPAD a multiple of 8. 4. Compute an 8 octet key checksum value on LCEKPAD as described above in Section 12.6.1, call the result ICV. 5. Let LCEKPADICV = LCEKPAD || ICV. 6. Generate 8 octets at random, call the result IV. 7. Encrypt LCEKPADICV in CBC mode using the key-encryption key. Use the random value generated in the previous step as the initialization vector (IV). Call the ciphertext TEMP1. 8. Let TEMP2 = IV || TEMP1. 9. Reverse the order of the octets in TEMP2. That is, the most significant (first) octet is swapped with the least significant (last) octet, and so on. Call the result TEMP3. 10. Encrypt TEMP3 in CBC mode using the key-encryption key. Use an initialization vector (IV) of 0x4adda22c79e82105. Note: When the same content-encryption key is wrapped in different key-encryption keys, a fresh initialization vector (IV) must be generated for each invocation of the key wrap algorithm.
ToP   noToC   RFC2630 - Page 46

12.6.5 RC2 Key Unwrap

The RC2 key unwrap algorithm decrypts a RC2 content-encryption key using a RC2 key-encryption key. The RC2 key unwrap algorithm is: 1. If the wrapped content-encryption key is not a multiple of 8 octets, then error. 2. Decrypt the wrapped content-encryption key in CBC mode using the key-encryption key. Use an initialization vector (IV) of 0x4adda22c79e82105. Call the output TEMP3. 3. Reverse the order of the octets in TEMP3. That is, the most significant (first) octet is swapped with the least significant (last) octet, and so on. Call the result TEMP2. 4. Decompose the TEMP2 into IV and TEMP1. IV is the most significant (first) 8 octets, and TEMP1 is the remaining octets. 5. Decrypt TEMP1 in CBC mode using the key-encryption key. Use the IV value from the previous step as the initialization vector. Call the plaintext LCEKPADICV. 6. Decompose the LCEKPADICV into LCEKPAD, and ICV. ICV is the least significant (last) octet 8 octets. LCEKPAD is the remaining octets. 7. Compute an 8 octet key checksum value on LCEKPAD as described above in Section 12.6.1. If the computed key checksum value does not match the decrypted key checksum value, ICV, then error. 8. Decompose the LCEKPAD into LENGTH, CEK, and PAD. LENGTH is the most significant (first) octet. CEK is the following LENGTH octets. PAD is the remaining octets, if any. 9. If the length of PAD is more than 7 octets, then error. 10. Use CEK as the content-encryption key.
ToP   noToC   RFC2630 - Page 47

Appendix A: ASN.1 Module

CryptographicMessageSyntax { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-9(9) smime(16) modules(0) cms(1) } DEFINITIONS IMPLICIT TAGS ::= BEGIN -- EXPORTS All -- The types and values defined in this module are exported for use in -- the other ASN.1 modules. Other applications may use them for their -- own purposes. IMPORTS -- Directory Information Framework (X.501) Name FROM InformationFramework { joint-iso-itu-t ds(5) modules(1) informationFramework(1) 3 } -- Directory Authentication Framework (X.509) AlgorithmIdentifier, AttributeCertificate, Certificate, CertificateList, CertificateSerialNumber FROM AuthenticationFramework { joint-iso-itu-t ds(5) module(1) authenticationFramework(7) 3 } ; -- Cryptographic Message Syntax ContentInfo ::= SEQUENCE { contentType ContentType, content [0] EXPLICIT ANY DEFINED BY contentType } ContentType ::= OBJECT IDENTIFIER SignedData ::= SEQUENCE { version CMSVersion, digestAlgorithms DigestAlgorithmIdentifiers, encapContentInfo EncapsulatedContentInfo, certificates [0] IMPLICIT CertificateSet OPTIONAL, crls [1] IMPLICIT CertificateRevocationLists OPTIONAL, signerInfos SignerInfos } DigestAlgorithmIdentifiers ::= SET OF DigestAlgorithmIdentifier SignerInfos ::= SET OF SignerInfo
ToP   noToC   RFC2630 - Page 48
EncapsulatedContentInfo ::= SEQUENCE {
  eContentType ContentType,
  eContent [0] EXPLICIT OCTET STRING OPTIONAL }

SignerInfo ::= SEQUENCE {
  version CMSVersion,
  sid SignerIdentifier,
  digestAlgorithm DigestAlgorithmIdentifier,
  signedAttrs [0] IMPLICIT SignedAttributes OPTIONAL,
  signatureAlgorithm SignatureAlgorithmIdentifier,
  signature SignatureValue,
  unsignedAttrs [1] IMPLICIT UnsignedAttributes OPTIONAL }

SignerIdentifier ::= CHOICE {
  issuerAndSerialNumber IssuerAndSerialNumber,
  subjectKeyIdentifier [0] SubjectKeyIdentifier }

SignedAttributes ::= SET SIZE (1..MAX) OF Attribute

UnsignedAttributes ::= SET SIZE (1..MAX) OF Attribute

Attribute ::= SEQUENCE {
  attrType OBJECT IDENTIFIER,
  attrValues SET OF AttributeValue }

AttributeValue ::= ANY

SignatureValue ::= OCTET STRING

EnvelopedData ::= SEQUENCE {
  version CMSVersion,
  originatorInfo [0] IMPLICIT OriginatorInfo OPTIONAL,
  recipientInfos RecipientInfos,
  encryptedContentInfo EncryptedContentInfo,
  unprotectedAttrs [1] IMPLICIT UnprotectedAttributes OPTIONAL }

OriginatorInfo ::= SEQUENCE {
  certs [0] IMPLICIT CertificateSet OPTIONAL,
  crls [1] IMPLICIT CertificateRevocationLists OPTIONAL }

RecipientInfos ::= SET OF RecipientInfo

EncryptedContentInfo ::= SEQUENCE {
  contentType ContentType,
  contentEncryptionAlgorithm ContentEncryptionAlgorithmIdentifier,
  encryptedContent [0] IMPLICIT EncryptedContent OPTIONAL }

EncryptedContent ::= OCTET STRING
ToP   noToC   RFC2630 - Page 49
UnprotectedAttributes ::= SET SIZE (1..MAX) OF Attribute

RecipientInfo ::= CHOICE {
  ktri KeyTransRecipientInfo,
  kari [1] KeyAgreeRecipientInfo,
  kekri [2] KEKRecipientInfo }

EncryptedKey ::= OCTET STRING

KeyTransRecipientInfo ::= SEQUENCE {
  version CMSVersion,  -- always set to 0 or 2
  rid RecipientIdentifier,
  keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier,
  encryptedKey EncryptedKey }

RecipientIdentifier ::= CHOICE {
  issuerAndSerialNumber IssuerAndSerialNumber,
  subjectKeyIdentifier [0] SubjectKeyIdentifier }

KeyAgreeRecipientInfo ::= SEQUENCE {
  version CMSVersion,  -- always set to 3
  originator [0] EXPLICIT OriginatorIdentifierOrKey,
  ukm [1] EXPLICIT UserKeyingMaterial OPTIONAL,
  keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier,
  recipientEncryptedKeys RecipientEncryptedKeys }

OriginatorIdentifierOrKey ::= CHOICE {
  issuerAndSerialNumber IssuerAndSerialNumber,
  subjectKeyIdentifier [0] SubjectKeyIdentifier,
  originatorKey [1] OriginatorPublicKey }

OriginatorPublicKey ::= SEQUENCE {
  algorithm AlgorithmIdentifier,
  publicKey BIT STRING }

RecipientEncryptedKeys ::= SEQUENCE OF RecipientEncryptedKey

RecipientEncryptedKey ::= SEQUENCE {
  rid KeyAgreeRecipientIdentifier,
  encryptedKey EncryptedKey }

KeyAgreeRecipientIdentifier ::= CHOICE {
  issuerAndSerialNumber IssuerAndSerialNumber,
  rKeyId [0] IMPLICIT RecipientKeyIdentifier }
ToP   noToC   RFC2630 - Page 50
RecipientKeyIdentifier ::= SEQUENCE {
  subjectKeyIdentifier SubjectKeyIdentifier,
  date GeneralizedTime OPTIONAL,
  other OtherKeyAttribute OPTIONAL }

SubjectKeyIdentifier ::= OCTET STRING

KEKRecipientInfo ::= SEQUENCE {
  version CMSVersion,  -- always set to 4
  kekid KEKIdentifier,
  keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier,
  encryptedKey EncryptedKey }

KEKIdentifier ::= SEQUENCE {
  keyIdentifier OCTET STRING,
  date GeneralizedTime OPTIONAL,
  other OtherKeyAttribute OPTIONAL }

DigestedData ::= SEQUENCE {
  version CMSVersion,
  digestAlgorithm DigestAlgorithmIdentifier,
  encapContentInfo EncapsulatedContentInfo,
  digest Digest }

Digest ::= OCTET STRING

EncryptedData ::= SEQUENCE {
  version CMSVersion,
  encryptedContentInfo EncryptedContentInfo,
  unprotectedAttrs [1] IMPLICIT UnprotectedAttributes OPTIONAL }

AuthenticatedData ::= SEQUENCE {
  version CMSVersion,
  originatorInfo [0] IMPLICIT OriginatorInfo OPTIONAL,
  recipientInfos RecipientInfos,
  macAlgorithm MessageAuthenticationCodeAlgorithm,
  digestAlgorithm [1] DigestAlgorithmIdentifier OPTIONAL,
  encapContentInfo EncapsulatedContentInfo,
  authenticatedAttributes [2] IMPLICIT AuthAttributes OPTIONAL,
  mac MessageAuthenticationCode,
  unauthenticatedAttributes [3] IMPLICIT UnauthAttributes OPTIONAL }

AuthAttributes ::= SET SIZE (1..MAX) OF Attribute

UnauthAttributes ::= SET SIZE (1..MAX) OF Attribute

MessageAuthenticationCode ::= OCTET STRING
ToP   noToC   RFC2630 - Page 51
DigestAlgorithmIdentifier ::= AlgorithmIdentifier

SignatureAlgorithmIdentifier ::= AlgorithmIdentifier

KeyEncryptionAlgorithmIdentifier ::= AlgorithmIdentifier

ContentEncryptionAlgorithmIdentifier ::= AlgorithmIdentifier

MessageAuthenticationCodeAlgorithm ::= AlgorithmIdentifier

CertificateRevocationLists ::= SET OF CertificateList

CertificateChoices ::= CHOICE {
  certificate Certificate,  -- See X.509
  extendedCertificate [0] IMPLICIT ExtendedCertificate,  -- Obsolete
  attrCert [1] IMPLICIT AttributeCertificate }  -- See X.509 & X9.57

CertificateSet ::= SET OF CertificateChoices

IssuerAndSerialNumber ::= SEQUENCE {
  issuer Name,
  serialNumber CertificateSerialNumber }

CMSVersion ::= INTEGER  { v0(0), v1(1), v2(2), v3(3), v4(4) }

UserKeyingMaterial ::= OCTET STRING

OtherKeyAttribute ::= SEQUENCE {
  keyAttrId OBJECT IDENTIFIER,
  keyAttr ANY DEFINED BY keyAttrId OPTIONAL }


-- CMS Attributes

MessageDigest ::= OCTET STRING

SigningTime  ::= Time

Time ::= CHOICE {
  utcTime UTCTime,
  generalTime GeneralizedTime }

Countersignature ::= SignerInfo
ToP   noToC   RFC2630 - Page 52
-- Algorithm Identifiers

sha-1 OBJECT IDENTIFIER ::= { iso(1) identified-organization(3)
    oiw(14) secsig(3) algorithm(2) 26 }

md5 OBJECT IDENTIFIER ::= { iso(1) member-body(2) us(840)
    rsadsi(113549) digestAlgorithm(2) 5 }

id-dsa-with-sha1 OBJECT IDENTIFIER ::=  { iso(1) member-body(2)
    us(840) x9-57 (10040) x9cm(4) 3 }

rsaEncryption OBJECT IDENTIFIER ::= { iso(1) member-body(2)
    us(840) rsadsi(113549) pkcs(1) pkcs-1(1) 1 }

dh-public-number OBJECT IDENTIFIER ::= { iso(1) member-body(2)
    us(840) ansi-x942(10046) number-type(2) 1 }

id-alg-ESDH OBJECT IDENTIFIER ::= { iso(1) member-body(2) us(840)
    rsadsi(113549) pkcs(1) pkcs-9(9) smime(16) alg(3) 5 }

id-alg-CMS3DESwrap OBJECT IDENTIFIER ::= { iso(1) member-body(2)
    us(840) rsadsi(113549) pkcs(1) pkcs-9(9) smime(16) alg(3) 6 }

id-alg-CMSRC2wrap OBJECT IDENTIFIER ::= { iso(1) member-body(2)
    us(840) rsadsi(113549) pkcs(1) pkcs-9(9) smime(16) alg(3) 7 }

des-ede3-cbc OBJECT IDENTIFIER ::= { iso(1) member-body(2)
    us(840) rsadsi(113549) encryptionAlgorithm(3) 7 }

rc2-cbc OBJECT IDENTIFIER ::= { iso(1) member-body(2) us(840)
    rsadsi(113549) encryptionAlgorithm(3) 2 }

hMAC-SHA1 OBJECT IDENTIFIER ::= { iso(1) identified-organization(3)
    dod(6) internet(1) security(5) mechanisms(5) 8 1 2 }


-- Algorithm Parameters

KeyWrapAlgorithm ::= AlgorithmIdentifier

RC2wrapParameter ::= RC2ParameterVersion

RC2ParameterVersion ::= INTEGER

CBCParameter ::= IV

IV ::= OCTET STRING  -- exactly 8 octets
ToP   noToC   RFC2630 - Page 53
RC2CBCParameter ::= SEQUENCE {
  rc2ParameterVersion INTEGER,
  iv OCTET STRING  }  -- exactly 8 octets


-- Content Type Object Identifiers

id-ct-contentInfo OBJECT IDENTIFIER ::= { iso(1) member-body(2)
    us(840) rsadsi(113549) pkcs(1) pkcs-9(9) smime(16)
    ct(1) 6 }

id-data OBJECT IDENTIFIER ::= { iso(1) member-body(2)
    us(840) rsadsi(113549) pkcs(1) pkcs7(7) 1 }

id-signedData OBJECT IDENTIFIER ::= { iso(1) member-body(2)
    us(840) rsadsi(113549) pkcs(1) pkcs7(7) 2 }

id-envelopedData OBJECT IDENTIFIER ::= { iso(1) member-body(2)
    us(840) rsadsi(113549) pkcs(1) pkcs7(7) 3 }

id-digestedData OBJECT IDENTIFIER ::= { iso(1) member-body(2)
    us(840) rsadsi(113549) pkcs(1) pkcs7(7) 5 }

id-encryptedData OBJECT IDENTIFIER ::= { iso(1) member-body(2)
    us(840) rsadsi(113549) pkcs(1) pkcs7(7) 6 }

id-ct-authData OBJECT IDENTIFIER ::= { iso(1) member-body(2)
    us(840) rsadsi(113549) pkcs(1) pkcs-9(9) smime(16)
    ct(1) 2 }


-- Attribute Object Identifiers

id-contentType OBJECT IDENTIFIER ::= { iso(1) member-body(2)
    us(840) rsadsi(113549) pkcs(1) pkcs9(9) 3 }

id-messageDigest OBJECT IDENTIFIER ::= { iso(1) member-body(2)
    us(840) rsadsi(113549) pkcs(1) pkcs9(9) 4 }

id-signingTime OBJECT IDENTIFIER ::= { iso(1) member-body(2)
    us(840) rsadsi(113549) pkcs(1) pkcs9(9) 5 }

id-countersignature OBJECT IDENTIFIER ::= { iso(1) member-body(2)
    us(840) rsadsi(113549) pkcs(1) pkcs9(9) 6 }
ToP   noToC   RFC2630 - Page 54
-- Obsolete Extended Certificate syntax from PKCS#6

ExtendedCertificate ::= SEQUENCE {
  extendedCertificateInfo ExtendedCertificateInfo,
  signatureAlgorithm SignatureAlgorithmIdentifier,
  signature Signature }

ExtendedCertificateInfo ::= SEQUENCE {
  version CMSVersion,
  certificate Certificate,
  attributes UnauthAttributes }

Signature ::= BIT STRING


END -- of CryptographicMessageSyntax
ToP   noToC   RFC2630 - Page 55

References

3DES American National Standards Institute. ANSI X9.52-1998, Triple Data Encryption Algorithm Modes of Operation. 1998. DES American National Standards Institute. ANSI X3.106, "American National Standard for Information Systems - Data Link Encryption". 1983. DH-X9.42 Rescorla, E., "Diffie-Hellman Key Agreement Method", RFC 2631, June 1999. DSS National Institute of Standards and Technology. FIPS Pub 186: Digital Signature Standard. 19 May 1994. ESS Hoffman, P., Editor, "Enhanced Security Services for S/MIME", RFC 2634, June 1999. HMAC Krawczyk, H., "HMAC: Keyed-Hashing for Message Authentication", RFC 2104, February 1997. MD5 Rivest, R., "The MD5 Message-Digest Algorithm", RFC 1321, April 1992. MODES National Institute of Standards and Technology. FIPS Pub 81: DES Modes of Operation. 2 December 1980. MSG Ramsdell, B., Editor, "S/MIME Version 3 Message Specification", RFC 2633, June 1999. NEWPKCS#1 Kaliski, B., "PKCS #1: RSA Encryption, Version 2.0", RFC 2347, October 1998. PROFILE Housley, R., Ford, W., Polk, W. and D. Solo, "Internet X.509 Public Key Infrastructure: Certificate and CRL Profile", RFC 2459, January 1999. PKCS#1 Kaliski, B., "PKCS #1: RSA Encryption, Version 1.5.", RFC 2313, March 1998. PKCS#6 RSA Laboratories. PKCS #6: Extended-Certificate Syntax Standard, Version 1.5. November 1993. PKCS#7 Kaliski, B., "PKCS #7: Cryptographic Message Syntax, Version 1.5.", RFC 2315, March 1998. PKCS#9 RSA Laboratories. PKCS #9: Selected Attribute Types, Version 1.1. November 1993.
ToP   noToC   RFC2630 - Page 56
   RANDOM     Eastlake, D., Crocker, S. and J. Schiller, "Randomness
              Recommendations for Security", RFC 1750, December 1994.

   RC2        Rivest, R., "A Description of the RC2 (r) Encryption
              Algorithm", RFC 2268, March 1998.

   SHA1       National Institute of Standards and Technology.
              FIPS Pub 180-1: Secure Hash Standard.  17 April 1995.

   X.208-88   CCITT.  Recommendation X.208: Specification of Abstract
              Syntax Notation One (ASN.1).  1988.

   X.209-88   CCITT.  Recommendation X.209: Specification of Basic
              Encoding Rules for Abstract Syntax Notation One (ASN.1).
              1988.

   X.501-88   CCITT.  Recommendation X.501: The Directory - Models.
              1988.

   X.509-88   CCITT.  Recommendation X.509: The Directory -
              Authentication Framework.  1988.

   X.509-97   ITU-T.  Recommendation X.509: The Directory -
              Authentication Framework.  1997.

Security Considerations

The Cryptographic Message Syntax provides a method for digitally signing data, digesting data, encrypting data, and authenticating data. Implementations must protect the signer's private key. Compromise of the signer's private key permits masquerade. Implementations must protect the key management private key, the key-encryption key, and the content-encryption key. Compromise of the key management private key or the key-encryption key may result in the disclosure of all messages protected with that key. Similarly, compromise of the content-encryption key may result in disclosure of the associated encrypted content. Implementations must protect the key management private key and the message-authentication key. Compromise of the key management private key permits masquerade of authenticated data. Similarly, compromise of the message-authentication key may result in undetectable modification of the authenticated content.
ToP   noToC   RFC2630 - Page 57
   Implementations must randomly generate content-encryption keys,
   message-authentication keys, initialization vectors (IVs), and
   padding.  Also, the generation of public/private key pairs relies on
   a random numbers.  The use of inadequate pseudo-random number
   generators (PRNGs) to generate cryptographic keys can result in
   little or no security.  An attacker may find it much easier to
   reproduce the PRNG environment that produced the keys, searching the
   resulting small set of possibilities, rather than brute force
   searching the whole key space.  The generation of quality random
   numbers is difficult.  RFC 1750 [RANDOM] offers important guidance in
   this area, and Appendix 3 of FIPS Pub 186 [DSS] provides one quality
   PRNG technique.

   When using key agreement algorithms or previously distributed
   symmetric key-encryption keys, a key-encryption key is used to
   encrypt the content-encryption key.  If the key-encryption and
   content-encryption algorithms are different, the effective security
   is determined by the weaker of the two algorithms.  If, for example,
   a message content is encrypted with 168-bit Triple-DES and the
   Triple-DES content-encryption key is wrapped with a 40-bit RC2 key,
   then at most 40 bits of protection is provided.  A trivial search to
   determine the value of the 40-bit RC2 key can recover Triple-DES key,
   and then the Triple-DES key can be used to decrypt the content.
   Therefore, implementers must ensure that key-encryption algorithms
   are as strong or stronger than content-encryption algorithms.

   Section 12.6 specifies key wrap algorithms used to encrypt a Triple-
   DES [3DES] content-encryption key with a Triple-DES key-encryption
   key or to encrypt a RC2 [RC2] content-encryption key with a RC2 key-
   encryption key.  The key wrap algorithms make use of CBC mode
   [MODES].  These key wrap algorithms have been reviewed for use with
   Triple and RC2.  They have not been reviewed for use with other
   cryptographic modes or other encryption algorithms.  Therefore, if a
   CMS implementation wishes to support ciphers in addition to Triple-
   DES or RC2, then additional key wrap algorithms need to be defined to
   support the additional ciphers.

   Implementers should be aware that cryptographic algorithms become
   weaker with time.  As new cryptoanalysis techniques are developed and
   computing performance improves, the work factor to break a particular
   cryptographic algorithm will reduce.  Therefore, cryptographic
   algorithm implementations should be modular allowing new algorithms
   to be readily inserted.  That is, implementers should be prepared for
   the set of mandatory to implement algorithms to change over time.

   The countersignature unauthenticated attribute includes a digital
   signature that is computed on the content signature value, thus the
   countersigning process need not know the original signed content.
ToP   noToC   RFC2630 - Page 58
   This structure permits implementation efficiency advantages; however,
   this structure may also permit the countersigning of an inappropriate
   signature value.  Therefore, implementations that perform
   countersignatures should either verify the original signature value
   prior to countersigning it (this verification requires processing of
   the original content), or implementations should perform
   countersigning in a context that ensures that only appropriate
   signature values are countersigned.

   Users of CMS, particularly those employing CMS to support interactive
   applications, should be aware that PKCS #1 Version 1.5 as specified
   in RFC 2313 [PKCS#1] is vulnerable to adaptive chosen ciphertext
   attacks when applied for encryption purposes.  Exploitation of this
   identified vulnerability, revealing the result of a particular RSA
   decryption, requires access to an oracle which will respond to a
   large number of ciphertexts (based on currently available results,
   hundreds of thousands or more), which are constructed adaptively in
   response to previously-received replies providing information on the
   successes or failures of attempted decryption operations.  As a
   result, the attack appears significantly less feasible to perpetrate
   for store-and-forward S/MIME environments than for directly
   interactive protocols.  Where CMS constructs are applied as an
   intermediate encryption layer within an interactive request-response
   communications environment, exploitation could be more feasible.

   An updated version of PKCS #1 has been published, PKCS #1 Version 2.0
   [NEWPKCS#1].  This new document will supersede RFC 2313.  PKCS #1
   Version 2.0 preserves support for the encryption padding format
   defined in PKCS #1 Version 1.5 [PKCS#1], and it also defines a new
   alternative.  To resolve the adaptive chosen ciphertext
   vulnerability, the PKCS #1 Version 2.0 specifies and recommends use
   of Optimal Asymmetric Encryption Padding (OAEP) when RSA encryption
   is used to provide confidentiality.  Designers of protocols and
   systems employing CMS for interactive environments should either
   consider usage of OAEP, or should ensure that information which could
   reveal the success or failure of attempted PKCS #1 Version 1.5
   decryption operations is not provided.  Support for OAEP will likely
   be added to a future version of the CMS specification.

Acknowledgments

This document is the result of contributions from many professionals. I appreciate the hard work of all members of the IETF S/MIME Working Group. I extend a special thanks to Rich Ankney, Tim Dean, Steve Dusse, Carl Ellison, Peter Gutmann, Bob Jueneman, Stephen Henson, Paul Hoffman, Scott Hollenbeck, Don Johnson, Burt Kaliski, John Linn, John Pawling, Blake Ramsdell, Francois Rousseau, Jim Schaad, and Dave Solo for their efforts and support.
ToP   noToC   RFC2630 - Page 59

Author's Address

Russell Housley SPYRUS 381 Elden Street Suite 1120 Herndon, VA 20170 USA EMail: housley@spyrus.com
ToP   noToC   RFC2630 - Page 60
Full Copyright Statement

   Copyright (C) The Internet Society (1999).  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.

Acknowledgement

   Funding for the RFC Editor function is currently provided by the
   Internet Society.