RFC 3657
Use of the Camellia Encryption Algorithm in Cryptographic Message Syntax (CMS)
part 1 of 3 π more coming bestie, stay tuned π§
RFC 3657: Use of the Camellia Encryption Algorithm in Cryptographic Message Syntax (CMS) π¦
Okay so this one is RFC 3657, titled "Use of the Camellia Encryption Algorithm in Cryptographic Message Syntax (CMS)". It came out of the Network Working Group in January 2004 as a Standards Track doc. The authors are S. Moriai from Sony Computer Entertainment Inc. and A. Kato from NTT Software Corporation. Its title block doesn't list anything it obsoletes or updates, so it's standing on its own, no cap. π
Status of this Memo
This doc is an Internet standards track protocol for the Internet community, and it's literally asking for discussion and suggestions for improvements π«Ά If you want the current standardization state and status of this protocol, check the "Internet Official Protocol Standards" (STD 1) list. Distribution of this memo is unlimited, so share it with your whole group chat β¨
Copyright Notice
Copyright (C) The Internet Society (2004). All Rights Reserved. π
Abstract
This doc lays out the rules for using the Camellia encryption algorithm to do encryption with the Cryptographic Message Syntax (CMS). Main character energy, honestly π
1. Introduction β¨
Okay so this doc explains how to use the Camellia encryption algorithm [CamelliaSpec] for encryption with the Cryptographic Message Syntax (CMS) [CMS]. It gives you the relevant object identifiers (OIDs) and the processing steps, so Camellia can be used in the CMS specification (RFC 3369, RFC 3370) for both content and key encryption. It's giving organized πΈ
Note: This work was done when the first author worked for NTT. π
1.1. Camellia
Camellia was jointly developed by Nippon Telegraph and Telephone Corporation and Mitsubishi Electric Corporation in 2000 π§ It has a 128-bit block size and 128-, 192-, and 256-bit key sizes, which is the same interface as the Advanced Encryption Standard (AES). What makes it iconic is that it's good for both software and hardware implementations, plus it has a high level of security π₯ Practically speaking, it's built to be flexible on 32-bit processors that are used all over the Internet and tons of applications, and also on 8-bit processors used in smart cards, cryptographic hardware, embedded systems, and so on [CamelliaTech]. Lowkey the best part: its key setup time is excellent, and its key agility is superior to AES. π
Camellia has been scrutinized by the wide cryptographic community during several projects for evaluating crypto algorithms. Highkey iconic moment: it was selected as a recommended cryptographic primitive by the EU NESSIE (New European Schemes for Signatures, Integrity and Encryption) project [NESSIE]. It was also included in the list of cryptographic techniques for Japanese e-Government systems, which were selected by the Japan CRYPTREC (Cryptography Research and Evaluation Committees) [CRYPTREC] π
1.2. Terminology
Quick vibe check on 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]. π
2. Object Identifiers for Content and Key Encryption π
This section gives you the OIDs and processing info that Camellia needs for content and key encryption in CMS. It's the core of the whole thing, bestie π
Camellia gets added to the set of optional symmetric encryption algorithms in CMS through two classes of unique object identifiers (OIDs). One class defines the content encryption algorithms, and the other defines the key encryption algorithms. So a CMS agent can apply Camellia for either content or key encryption by picking the matching object identifier, supplying the required parameter, and starting the program code π¦
2.1. OIDs for Content Encryption
Camellia joins the set of symmetric content encryption algorithms defined in [CMSALG]. The Camellia content-encryption algorithm, in Cipher Block Chaining (CBC) mode, comes in three key sizes, and each one has its own OID:
id-camellia128-cbc OBJECT IDENTIFIER ::=
{ iso(1) member-body(2) 392 200011 61 security(1)
algorithm(1) symmetric-encryption-algorithm(1)
camellia128-cbc(2) }
id-camellia192-cbc OBJECT IDENTIFIER ::=
{ iso(1) member-body(2) 392 200011 61 security(1)
algorithm(1) symmetric-encryption-algorithm(1)
camellia192-cbc(3) }
id-camellia256-cbc OBJECT IDENTIFIER ::=
{ iso(1) member-body(2) 392 200011 61 security(1)
algorithm(1) symmetric-encryption-algorithm(1)
camellia256-cbc(4) }
The AlgorithmIdentifier parameters field MUST be present, and the parameters field MUST contain the value of IV:
CamelliaCBCParameter ::= CamelliaIV -- Initialization Vector
CamelliaIV ::= OCTET STRING (SIZE(16))
The plain text gets padded according to Section 6.3 of [CMS] β¨
2.2. OIDs for Key Encryption
The key-wrap/unwrap procedures that encrypt and decrypt a Camellia content-encryption key (CEK) with a Camellia key-encryption key (KEK) are in Section 3. Generating and distributing key-encryption keys is out of scope for this doc π
The Camellia key-encryption algorithm has these object identifiers:
id-camellia128-wrap OBJECT IDENTIFIER ::=
{ iso(1) member-body(2) 392 200011 61 security(1)
algorithm(1) key-wrap-algorithm(3)
camellia128-wrap(2) }
id-camellia192-wrap OBJECT IDENTIFIER ::=
{ iso(1) member-body(2) 392 200011 61 security(1)
algorithm(1) key-wrap-algorithm(3)
camellia192-wrap(3) }
id-camellia256-wrap OBJECT IDENTIFIER ::=
{ iso(1) member-body(2) 392 200011 61 security(1)
algorithm(1) key-wrap-algorithm(3)
camellia256-wrap(4) }
In every case, the parameters field of AlgorithmIdentifier MUST be ABSENT, because the key wrapping procedure itself defines how and when to use an IV π The OID tells you the KEK key size, but it doesn't say anything about the size of the wrapped Camellia CEK. Implementations MAY use different KEK and CEK sizes. Implementations MUST support the CEK and the KEK having the same length. If different lengths are supported, the KEK MUST be of equal or greater length than the CEK π«Ά
3. Key Wrap Algorithm πΈ
Camellia key wrapping and unwrapping are done in conformance with the AES key wrap algorithm [RFC3394], because Camellia and AES have the same block and key sizes: a 128-bit block, and key sizes of 128, 192, and 256 bits β¨
3.1. Notation and Definitions
Here's the notation we use to describe the key wrapping algorithms π§
Camellia(K, W)
Encrypt W using the Camellia codebook with key K
Camellia-1(K, W)
Decrypt W using the Camellia codebook with key K
MSB(j, W) Return the most significant j bits of W
LSB(j, W) Return the least significant j bits of W
B1 ^ B2 The bitwise exclusive or (XOR) of B1 and B2
B1 | B2 Concatenate B1 and B2
K The key-encryption key K
n The number of 64-bit key data blocks
s The number of steps in the wrapping process, s = 6n
P[i] The ith plaintext key data block
C[i] The ith ciphertext data block
A The 64-bit integrity check register
R[i] An array of 64-bit registers where
i = 0, 1, 2, ..., n
A[t], R[t][i] The contents of registers A and R[i] after encryption
step t.
IV The 64-bit initial value used during the wrapping
process.
In the key wrap algorithm, the concatenation function gets used to join 64-bit quantities into the 128-bit input for the Camellia codebook. The extraction functions get used to split the 128-bit output from the Camellia codebook into two 64-bit quantities π¦
3.2. Camellia Key Wrap
Key wrapping with Camellia is identical to Section 2.2.1 of [RFC3394] with "AES" replaced by "Camellia". Easy, right? π
The inputs to the key wrapping process are the KEK and the plaintext to be wrapped. The plaintext is n 64-bit blocks holding the key data being wrapped. Here's how the process goes π
Inputs: Plaintext, n 64-bit values {P[1], P[2], ..., P[n]},
and Key, K (the KEK).
Outputs: Ciphertext, (n+1) 64-bit values {C[0], C[1], ...,
C[n]}.
1) Initialize variables.
Set A[0] to an initial value (see Section 3.4)
For i = 1 to n
R[0][i] = P[i]
2) Calculate intermediate values.
For t = 1 to s, where s = 6n
A[t] = MSB(64, Camellia(K, A[t-1] | R[t-1][1])) ^ t
For i = 1 to n-1
R[t][i] = R[t-1][i+1]
R[t][n] = LSB(64, Camellia(K, A[t-1] | R[t-1][1]))
3) Output the results.
Set C[0] = A[t]
For i = 1 to n
C[i] = R[t][i]
There's also an alternative description of the key wrap algorithm that uses indexing instead of shifting. This approach lets you calculate the wrapped key in place, which skips the rotation from the previous description. It produces identical results and is more easily implemented in software π
Inputs: Plaintext, n 64-bit values {P[1], P[2], ..., P[n]},
and Key, K (the KEK).
Outputs: Ciphertext, (n+1) 64-bit values {C[0], C[1], ...,
C[n]}.
1) Initialize variables.
Set A = IV, an initial value (see Section 3.4)
For i = 1 to n
R[i] = P[i]
2) Calculate intermediate values.
For j = 0 to 5
For i=1 to n
B = Camellia(K, A | R[i])
A = MSB(64, B) ^ t where t = (n*j)+i
R[i] = LSB(64, B)
3) Output the results.
Set C[0] = A
For i = 1 to n
C[i] = R[i]
3.3. Camellia Key Unwrap πβ¨
okay so unwrapping with Camellia is literally identical to Section 2.2.2 of [RFC3394], we just swap "AES" for "Camellia" π
The inputs are the KEK plus (n+1) 64-bit blocks of ciphertext holding the previously wrapped key. What comes out is n blocks of plaintext, which are the n 64-bit blocks of the decrypted key data π
Inputs: Ciphertext, (n+1) 64-bit values {C[0], C[1], ..., C[n]},
and Key, K (the KEK).
Outputs: Plaintext, n 64-bit values {P[1], P[2], ..., P[n]}.
1) Initialize variables.
Set A[s] = C[0] where s = 6n
For i = 1 to n
R[s][i] = C[i]
2) Calculate the intermediate values.
For t = s to 1
A[t-1] = MSB(64, Camellia-1(K, ((A[t] ^ t) | R[t][n]))
R[t-1][1] = LSB(64, Camellia-1(K, ((A[t]^t) | R[t][n]))
For i = 2 to n
R[t-1][i] = R[t][i-1]
3) Output the results.
If A[0] is an appropriate initial value (see Section 3.4),
Then
For i = 1 to n
P[i] = R[0][i]
Else
Return an error
The unwrap algorithm can also be written as an index based operation, which lets the calculations happen in place. Again, this gives the exact same results as the register shifting approach, so no plot twist there π¦
Inputs: Ciphertext, (n+1) 64-bit values {C[0], C[1], ..., C[n]},
and Key, K (the KEK).
Outputs: Plaintext, n 64-bit values {P[0], P[1], ..., P[n]}.
1) Initialize variables.
Set A = C[0]
For i = 1 to n
R[i] = C[i]
2) Calculate intermediate values.
For j = 5 to 0
For i = n to 1
B = Camellia-1(K, (A ^ t) | R[i]) where t = n*j+i
A = MSB(64, B)
R[i] = LSB(64, B)
3) Output results.
If A is an appropriate initial value (see Section 3.4),
Then
For i = 1 to n
P[i] = R[i]
Else
Return an error
3.4. Key Data Integrity -- the Initial Value π‘οΈ
okay the initial value (IV) is the value assigned to A[0] in the very first step of wrapping π₯Ί It's what gives you an integrity check on the key data. At the end of unwrapping, the recovered A[0] gets compared to the expected A[0]. If they match, the key is accepted as valid and the unwrap hands it back. If they don't match, the key is rejected and the unwrap returns an error π ββοΈ
The exact properties of that check depend on how the initial value is defined, and different apps can want different things. Like, do you need to check the key data's integrity across its whole lifecycle, or just at the moment it gets unwrapped? This spec gives you a default IV that protects the key data during the time it's wrapped (see Section 3.4.1), and it also leaves room for alternative IVs (see Section 3.4.2) β¨
3.4.1. Default Initial Value π
The default initial value (IV) is defined to be this hexadecimal constant:
A[0] = IV = A6A6A6A6A6A6A6A6
Using a constant as the IV gives you a strong integrity check on the key data while it's wrapped πͺ If unwrapping produces A[0] = A6A6A6A6A6A6A6A6, then the chance that the key data is corrupt is 2^-64. If unwrapping produces any other value for A[0], then the unwrap must return an error and not return any key data π«
3.4.2. Alternative Initial Values πΈ
sometimes the key wrap is part of a bigger key management protocol or system, and then the integrity you want might cover more than just the key data, or last longer than just the wrapped period. Also, if the key data isn't just a Camellia key, it might not be a multiple of 64 bits. Alternative definitions of the initial value can cover those cases. According to [RFC3394], NIST will define alternative initial values in future key management publications as needed. Since that set of alternatives may change over time, key wrap implementations that aren't application-specific will require some flexibility in how the initial value gets set and tested π§
4. SMIMECapabilities Attribute π
An S/MIME client SHOULD announce the set of cryptographic functions it supports by using the S/MIME capabilities attribute π£ This attribute gives a partial list of OIDs for cryptographic functions, and it MUST be signed by the client ποΈ The function OIDs SHOULD be logically separated into functional categories, and they MUST be ordered by preference π
RFC 2633 [RFC2633], Section 2.5.2 defines the SMIMECapabilities signed attribute (a SEQUENCE of SMIMECapability SEQUENCEs) for specifying a partial list of algorithms that the software announcing the SMIMECapabilities can support π§
If an S/MIME client is required to support symmetric encryption with Camellia, the capabilities attribute MUST contain the Camellia OID specified above, under the category of symmetric algorithms π The parameter tied to this OID MUST be CamelliaSMimeCapability:
CamelliaSMimeCapabilty ::= NULL
The SMIMECapability SEQUENCE representing Camellia MUST be DER-encoded as these hexadecimal strings π€
Key Size Capability
128 30 0f 06 0b 2a 83 08 8c 9a 4b 3d 01 01 01 02 05 00
196 30 0f 06 0b 2a 83 08 8c 9a 4b 3d 01 01 01 03 05 00
256 30 0f 06 0b 2a 83 08 8c 9a 4b 3d 01 01 01 04 05 00
When a sending agent creates an encrypted message, it has to decide which encryption algorithm to use π Generally that decision uses info from the capabilities lists in messages received from the recipient, plus other stuff like private agreements, user preferences, legal restrictions, and so on. If users require Camellia for symmetric encryption, then it MUST be supported by the S/MIME clients on both the sending and receiving side, and it MUST be set in the user preferences π
5. Security Considerations π
okay this section is SERIOUS bestie π This document specifies the use of Camellia for encrypting the content of a CMS message and for encrypting the symmetric key used to encrypt that content. The other mechanisms are the same as the existing ones. Because of that, the security considerations in the CMS specifications [CMS][CMSALG] and the AES key wrap algorithm [RFC3394] can be applied to this document. No security problem has been found on Camellia [CRYPTREC][NESSIE] π‘οΈβ¨
6. Intellectual Property Statement βοΈ
The IETF takes no position on the validity or scope of any intellectual property or other rights that might be claimed to pertain to the implementation or use of the technology in this document, or on the extent to which any license under such rights might or might not be available. It also doesn't say it has tried to identify any such rights. Info on the IETF's procedures for rights in standards-track and standards-related documentation can be found in BCP-11. Copies of claims of rights made available for publication, any assurances of licenses to be made available, or the result of an attempt to get a general license or permission for implementors or users of this specification to use such proprietary rights can be obtained from the IETF Secretariat π
The IETF invites any interested party to bring to its attention any copyrights, patents or patent applications, or other proprietary rights that may cover technology that may be required to practice this standard. Send that info to the IETF Executive Director π
The IETF has been notified of intellectual property rights claimed in regard to some or all of the specification in this document. For more information, consult the online list of claimed rights π¦
7. References π
7.1. Normative References
- [CamelliaSpec] Aoki, K., Ichikawa, T., Kanda, M., Matsui, M., Moriai, S., Nakajima, J., and Tokita, T., "Specification of Camellia - a 128-bit Block Cipher". http://info.isl.ntt.co.jp/camellia/
- [CMS] Housley, R., "Cryptographic Message Syntax", RFC 3369, August 2002.
- [CMSALG] Housley, R., "Cryptographic Message Syntax (CMS) Algorithms", RFC 3370, August 2002.
- [RFC2633] Ramsdell, B., Editor, "S/MIME Version 3 Message Specification", RFC 2633, June 1999.
- [RFC3565] Schaad, J., "Use of the Advanced Encryption Standard (AES) Encryption Algorithm in Cryptographic Message Syntax (CMS)", RFC 3565, July 2003.
- [RFC3394] Schaad, J. and R. Housley, "Advanced Encryption Standard (AES) Key Wrap Algorithm", RFC 3394, September 2002.
7.2. Informative References
- [DES] National Institute of Standards and Technology. FIPS Pub 46: Data Encryption Standard. 15 January 1977.
- [CamelliaTech] Aoki, K., Ichikawa, T., Kanda, M., Matsui, M., Moriai, S., Nakajima, J., and Tokita, T., "Camellia: A 128-Bit Block Cipher Suitable for Multiple Platforms - Design and Analysis -", In Selected Areas in Cryptography, 7th Annual International Workshop, SAC 2000, August 2000, Proceedings, Lecture Notes in Computer Science 2012, pp.39-56, Springer-Verlag, 2001.
- [CRYPTREC] Information-technology Promotion Agency (IPA), Japan, CRYPTREC. http://www.ipa.go.jp/security/enc/CRYPTREC/index-e.html
- [NESSIE] New European Schemes for Signatures, Integrity and Encryption (NESSIE) project. http://www.cryptonessie.org
- [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997.
Appendix A. ASN.1 Module π§©
CamelliaEncryptionAlgorithmInCMS
{ iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1)
pkcs9(9) smime(16) modules(0) id-mod-cms-camellia(23) }
DEFINITIONS IMPLICIT TAGS ::=
BEGIN
-- Camellia using CBC-chaining mode for key sizes of 128, 192, 256
id-camellia128-cbc OBJECT IDENTIFIER ::=
{ iso(1) member-body(2) 392 200011 61 security(1)
algorithm(1) symmetric-encryption-algorithm(1)
camellia128-cbc(2) }
id-camellia192-cbc OBJECT IDENTIFIER ::=
{ iso(1) member-body(2) 392 200011 61 security(1)
algorithm(1) symmetric-encryption-algorithm(1)
camellia192-cbc(3) }
id-camellia256-cbc OBJECT IDENTIFIER ::=
{ iso(1) member-body(2) 392 200011 61 security(1)
algorithm(1) symmetric-encryption-algorithm(1)
camellia256-cbc(4) }
-- Camellia-IV is the parameter for all the above object identifiers.
Camellia-IV ::= OCTET STRING (SIZE(16))
-- Camellia S/MIME Capabilty parameter for all the above object
-- identifiers.
CamelliaSMimeCapability ::= NULL
-- Camellia Key Wrap Algorithm identifiers - Parameter is absent.
id-camellia128-wrap OBJECT IDENTIFIER ::=
{ iso(1) member-body(2) 392 200011 61 security(1)
algorithm(1) key-wrap-algorithm(3)
camellia128-wrap(2) }
id-camellia192-wrap OBJECT IDENTIFIER ::=
{ iso(1) member-body(2) 392 200011 61 security(1)
algorithm(1) key-wrap-algorithm(3)
camellia192-wrap(3) }
id-camellia256-wrap OBJECT IDENTIFIER ::=
{ iso(1) member-body(2) 392 200011 61 security(1)
algorithm(1) key-wrap-algorithm(3)
camellia256-wrap(4) }
END
Authors' Addresses π
Shiho Moriai
Sony Computer Entertainment Inc.
Phone: +81-3-6438-7523
Fax: +81-3-6438-8629
EMail: camellia@isl.ntt.co.jp (Camellia team)
shiho@rd.scei.sony.co.jp (Shiho Moriai)
Akihiro Kato
NTT Software Corporation
Phone: +81-45-212-7934
Fax: +81-45-212-9800
EMail: akato@po.ntts.co.jp
Full Copyright Statement π
okay bestie, this part is lowkey serious, so read it carefully π«Ά
Copyright (C) The Internet Society (2004). All Rights Reserved.
You're allowed to copy this document and share translations of it. You can also write derivative works that comment on it, explain it, or help people implement it, and you can publish and distribute those too, in whole or in part, with no restrictions of any kind. The one catch is that the above copyright notice and this paragraph have to be included on every copy and every derivative work. β¨
The document itself, though, can't be modified in any way. That means no removing the copyright notice or the references to the Internet Society or other Internet organizations. There are two exceptions. The first is when it's needed for developing Internet standards, and then the copyright procedures in the Internet Standards process must be followed. The second is when it's translated into a language other than English. πΈ
The limited permissions above are perpetual. The Internet Society or its successors or assignees will never revoke them. π
This document and the information in it are 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. π
π¦ where this page comes from
- ietf: rfc3657 2004-01
- π girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms