Home | History | Annotate | Line # | Download | only in ref
      1 
      2 
      3 
      4 
      5 
      6 
      7 Network Working Group                                         B. Kaliski
      8 Request for Comments: 2437                                    J. Staddon
      9 Obsoletes: 2313                                         RSA Laboratories
     10 Category: Informational                                     October 1998
     11 
     12 
     13                 PKCS #1: RSA Cryptography Specifications
     14                               Version 2.0
     15 
     16 Status of this Memo
     17 
     18    This memo provides information for the Internet community.  It does
     19    not specify an Internet standard of any kind.  Distribution of this
     20    memo is unlimited.
     21 
     22 Copyright Notice
     23 
     24    Copyright (C) The Internet Society (1998).  All Rights Reserved.
     25 
     26 Table of Contents
     27 
     28    1.       Introduction.....................................2
     29    1.1      Overview.........................................3
     30    2.       Notation.........................................3
     31    3.       Key types........................................5
     32    3.1      RSA public key...................................5
     33    3.2      RSA private key..................................5
     34    4.       Data conversion primitives.......................6
     35    4.1      I2OSP............................................6
     36    4.2      OS2IP............................................7
     37    5.       Cryptographic primitives.........................8
     38    5.1      Encryption and decryption primitives.............8
     39    5.1.1    RSAEP............................................8
     40    5.1.2    RSADP............................................9
     41    5.2      Signature and verification primitives...........10
     42    5.2.1    RSASP1..........................................10
     43    5.2.2    RSAVP1..........................................11
     44    6.       Overview of schemes.............................11
     45    7.       Encryption schemes..............................12
     46    7.1      RSAES-OAEP......................................13
     47    7.1.1    Encryption operation............................13
     48    7.1.2    Decryption operation............................14
     49    7.2      RSAES-PKCS1-v1_5................................15
     50    7.2.1    Encryption operation............................17
     51    7.2.2    Decryption operation............................17
     52    8.       Signature schemes with appendix.................18
     53    8.1      RSASSA-PKCS1-v1_5...............................19
     54    8.1.1    Signature generation operation..................20
     55 
     56 
     57 
     58 Kaliski & Staddon            Informational                      [Page 1]
     59 
     61 RFC 2437        PKCS #1: RSA Cryptography Specifications    October 1998
     62 
     63 
     64    8.1.2    Signature verification operation................21
     65    9.       Encoding methods................................22
     66    9.1      Encoding methods for encryption.................22
     67    9.1.1    EME-OAEP........................................22
     68    9.1.2    EME-PKCS1-v1_5..................................24
     69    9.2      Encoding methods for signatures with appendix...26
     70    9.2.1    EMSA-PKCS1-v1_5.................................26
     71    10.      Auxiliary Functions.............................27
     72    10.1     Hash Functions..................................27
     73    10.2     Mask Generation Functions.......................28
     74    10.2.1   MGF1............................................28
     75    11.      ASN.1 syntax....................................29
     76    11.1     Key representation..............................29
     77    11.1.1   Public-key syntax...............................30
     78    11.1.2   Private-key syntax..............................30
     79    11.2     Scheme identification...........................31
     80    11.2.1   Syntax for RSAES-OAEP...........................31
     81    11.2.2   Syntax for RSAES-PKCS1-v1_5.....................32
     82    11.2.3   Syntax for RSASSA-PKCS1-v1_5....................33
     83    12       Patent Statement................................33
     84    12.1     Patent statement for the RSA algorithm..........34
     85    13.      Revision history................................35
     86    14.      References......................................35
     87             Security Considerations.........................37
     88             Acknowledgements................................37
     89             Authors' Addresses..............................38
     90             Full Copyright Statement........................39
     91 
     92 1. Introduction
     93 
     94    This memo is the successor to RFC 2313. This document provides
     95    recommendations for the implementation of public-key cryptography
     96    based on the RSA algorithm [18], covering the following aspects:
     97 
     98       -cryptographic primitives
     99       -encryption schemes
    100       -signature schemes with appendix
    101       -ASN.1 syntax for representing keys and for identifying the
    102        schemes
    103 
    104    The recommendations are intended for general application within
    105    computer and communications systems, and as such include a fair
    106    amount of flexibility. It is expected that application standards
    107    based on these specifications may include additional constraints. The
    108    recommendations are intended to be compatible with draft standards
    109    currently being developed by the ANSI X9F1 [1] and IEEE P1363 working
    110    groups [14].  This document supersedes PKCS #1 version 1.5 [20].
    111 
    112 
    113 
    114 
    115 Kaliski & Staddon            Informational                      [Page 2]
    116 
    118 RFC 2437        PKCS #1: RSA Cryptography Specifications    October 1998
    119 
    120 
    121    Editor's note. It is expected that subsequent versions of PKCS #1 may
    122    cover other aspects of the RSA algorithm such as key size, key
    123    generation, key validation, and signature schemes with message
    124    recovery.
    125 
    126 1.1 Overview
    127 
    128    The organization of this document is as follows:
    129 
    130       -Section 1 is an introduction.
    131       -Section 2 defines some notation used in this document.
    132       -Section 3 defines the RSA public and private key types.
    133       -Sections 4 and 5 define several primitives, or basic mathematical
    134        operations. Data conversion primitives are in Section 4, and
    135        cryptographic primitives (encryption-decryption,
    136        signature-verification) are in Section 5.
    137       -Section 6, 7 and 8 deal with the encryption and signature schemes
    138        in this document. Section 6 gives an overview. Section 7 defines
    139        an OAEP-based [2] encryption scheme along with the method found
    140        in PKCS #1 v1.5.  Section 8 defines a signature scheme with
    141        appendix; the method is identical to that of PKCS #1 v1.5.
    142       -Section 9 defines the encoding methods for the encryption and
    143        signature schemes in Sections 7 and 8.
    144       -Section 10 defines the hash functions and the mask generation
    145        function used in this document.
    146       -Section 11 defines the ASN.1 syntax for the keys defined in
    147        Section 3 and the schemes gives in Sections 7 and 8.
    148       -Section 12 outlines the revision history of PKCS #1.
    149       -Section 13 contains references to other publications and
    150        standards.
    151 
    152 2. Notation
    153 
    154    (n, e)        RSA public key
    155 
    156    c             ciphertext representative, an integer between 0 and n-1
    157 
    158    C             ciphertext, an octet string
    159 
    160    d             private exponent
    161 
    162    dP            p's exponent, a positive integer such that:
    163                   e(dP)\equiv 1 (mod(p-1))
    164 
    165    dQ            q's exponent, a positive integer such that:
    166                   e(dQ)\equiv 1 (mod(q-1))
    167 
    168    e             public exponent
    169 
    170 
    171 
    172 Kaliski & Staddon            Informational                      [Page 3]
    173 
    175 RFC 2437        PKCS #1: RSA Cryptography Specifications    October 1998
    176 
    177 
    178    EM            encoded message, an octet string
    179 
    180    emLen         intended length in octets of an encoded message
    181 
    182    H             hash value, an output of Hash
    183 
    184    Hash          hash function
    185 
    186    hLen          output length in octets of hash function Hash
    187 
    188    K             RSA private key
    189 
    190    k             length in octets of the modulus
    191 
    192    l             intended length of octet string
    193 
    194    lcm(.,.)      least common multiple of two
    195                  nonnegative integers
    196 
    197    m             message representative, an integer between
    198                  0 and n-1
    199 
    200    M             message, an octet string
    201 
    202    MGF           mask generation function
    203 
    204    n             modulus
    205 
    206    P             encoding parameters, an octet string
    207 
    208    p,q           prime factors of the modulus
    209 
    210    qInv          CRT coefficient, a positive integer less
    211                  than p such: q(qInv)\equiv 1 (mod p)
    212 
    213    s             signature representative, an integer
    214                  between 0 and n-1
    215 
    216    S             signature, an octet string
    217 
    218    x             a nonnegative integer
    219 
    220    X             an octet string corresponding to x
    221 
    222    \xor          bitwise exclusive-or of two octet strings
    223 
    224    \lambda(n)    lcm(p-1, q-1), where n = pq
    225 
    226 
    227 
    228 
    229 Kaliski & Staddon            Informational                      [Page 4]
    230 
    232 RFC 2437        PKCS #1: RSA Cryptography Specifications    October 1998
    233 
    234 
    235    ||            concatenation operator
    236 
    237    ||.||         octet length operator
    238 
    239 3. Key types
    240 
    241    Two key types are employed in the primitives and schemes defined in
    242    this document: RSA public key and RSA private key. Together, an RSA
    243    public key and an RSA private key form an RSA key pair.
    244 
    245 3.1 RSA public key
    246 
    247    For the purposes of this document, an RSA public key consists of two
    248    components:
    249 
    250    n, the modulus, a nonnegative integer
    251    e, the public exponent, a nonnegative integer
    252 
    253    In a valid RSA public key, the modulus n is a product of two odd
    254    primes p and q, and the public exponent e is an integer between 3 and
    255    n-1 satisfying gcd (e, \lambda(n)) = 1, where \lambda(n) = lcm (p-
    256    1,q-1).  A recommended syntax for interchanging RSA public keys
    257    between implementations is given in Section 11.1.1; an
    258    implementation's internal representation may differ.
    259 
    260 3.2 RSA private key
    261 
    262    For the purposes of this document, an RSA private key may have either
    263    of two representations.
    264 
    265    1. The first representation consists of the pair (n, d), where the
    266    components have the following meanings:
    267 
    268    n, the modulus, a nonnegative integer
    269    d, the private exponent, a nonnegative integer
    270 
    271    2. The second representation consists of a quintuple (p, q, dP, dQ,
    272    qInv), where the components have the following meanings:
    273 
    274    p, the first factor, a nonnegative integer
    275    q, the second factor, a nonnegative integer
    276    dP, the first factor's exponent, a nonnegative integer
    277    dQ, the second factor's exponent, a nonnegative integer
    278    qInv, the CRT coefficient, a nonnegative integer
    279 
    280    In a valid RSA private key with the first representation, the modulus
    281    n is the same as in the corresponding public key and is the product
    282    of two odd primes p and q, and the private exponent d is a positive
    283 
    284 
    285 
    286 Kaliski & Staddon            Informational                      [Page 5]
    287 
    289 RFC 2437        PKCS #1: RSA Cryptography Specifications    October 1998
    290 
    291 
    292    integer less than n satisfying:
    293 
    294    ed \equiv 1 (mod \lambda(n))
    295 
    296    where e is the corresponding public exponent and \lambda(n) is as
    297    defined above.
    298 
    299    In a valid RSA private key with the second representation, the two
    300    factors p and q are the prime factors of the modulus n, the exponents
    301    dP and dQ are positive integers less than p and q respectively
    302    satisfying
    303 
    304    e(dP)\equiv 1(mod(p-1))
    305    e(dQ)\equiv 1(mod(q-1)),
    306 
    307    and the CRT coefficient qInv is a positive integer less than p
    308    satisfying:
    309 
    310    q(qInv)\equiv 1 (mod p).
    311 
    312    A recommended syntax for interchanging RSA private keys between
    313    implementations, which includes components from both representations,
    314    is given in Section 11.1.2; an implementation's internal
    315    representation may differ.
    316 
    317 4. Data conversion primitives
    318 
    319    Two data conversion primitives are employed in the schemes defined in
    320    this document:
    321 
    322    I2OSP: Integer-to-Octet-String primitive
    323    OS2IP: Octet-String-to-Integer primitive
    324 
    325    For the purposes of this document, and consistent with ASN.1 syntax, an
    326    octet string is an ordered sequence of octets (eight-bit bytes). The
    327    sequence is indexed from first (conventionally, leftmost) to last
    328    (rightmost). For purposes of conversion to and from integers, the first
    329    octet is considered the most significant in the following conversion
    330    primitives
    331 
    332 4.1 I2OSP
    333 
    334    I2OSP converts a nonnegative integer to an octet string of a specified
    335    length.
    336 
    337    I2OSP (x, l)
    338 
    339 
    340 
    341 
    342 
    343 Kaliski & Staddon            Informational                      [Page 6]
    344 
    346 RFC 2437        PKCS #1: RSA Cryptography Specifications    October 1998
    347 
    348 
    349    Input:
    350    x         nonnegative integer to be converted
    351    l         intended length of the resulting octet string
    352 
    353    Output:
    354    X         corresponding octet string of length l; or
    355              "integer too large"
    356 
    357    Steps:
    358 
    359    1. If x>=256^l, output "integer too large" and stop.
    360 
    361    2. Write the integer x in its unique l-digit representation base 256:
    362 
    363    x = x_{l-1}256^{l-1} + x_{l-2}256^{l-2} +... + x_1 256 + x_0
    364 
    365    where 0 <= x_i < 256 (note that one or more leading digits will be
    366    zero if x < 256^{l-1}).
    367 
    368    3. Let the octet X_i have the value x_{l-i} for 1 <= i <= l.  Output
    369    the octet string:
    370 
    371    X = X_1 X_2 ... X_l.
    372 
    373 4.2 OS2IP
    374 
    375    OS2IP converts an octet string to a nonnegative integer.
    376 
    377    OS2IP (X)
    378 
    379    Input:
    380    X         octet string to be converted
    381 
    382    Output:
    383    x         corresponding nonnegative integer
    384 
    385    Steps:
    386 
    387    1. Let X_1 X_2 ... X_l  be the octets of X from first to last, and
    388    let x{l-i} have value X_i for 1<= i <= l.
    389 
    390    2. Let x = x{l-1} 256^{l-1} + x_{l-2} 256^{l-2} +...+ x_1 256 + x_0.
    391 
    392    3. Output x.
    393 
    394 
    395 
    396 
    397 
    398 
    399 
    400 Kaliski & Staddon            Informational                      [Page 7]
    401 
    403 RFC 2437        PKCS #1: RSA Cryptography Specifications    October 1998
    404 
    405 
    406 5. Cryptographic primitives
    407 
    408    Cryptographic primitives are basic mathematical operations on which
    409    cryptographic schemes can be built. They are intended for
    410    implementation in hardware or as software modules, and are not
    411    intended to provide security apart from a scheme.
    412 
    413    Four types of primitive are specified in this document, organized in
    414    pairs: encryption and decryption; and signature and verification.
    415 
    416    The specifications of the primitives assume that certain conditions
    417    are met by the inputs, in particular that public and private keys are
    418    valid.
    419 
    420 5.1 Encryption and decryption primitives
    421 
    422    An encryption primitive produces a ciphertext representative from a
    423    message representative under the control of a public key, and a
    424    decryption primitive recovers the message representative from the
    425    ciphertext representative under the control of the corresponding
    426    private key.
    427 
    428    One pair of encryption and decryption primitives is employed in the
    429    encryption schemes defined in this document and is specified here:
    430    RSAEP/RSADP. RSAEP and RSADP involve the same mathematical operation,
    431    with different keys as input.
    432 
    433    The primitives defined here are the same as in the draft IEEE P1363
    434    and are compatible with PKCS #1 v1.5.
    435 
    436    The main mathematical operation in each primitive is exponentiation.
    437 
    438 5.1.1 RSAEP
    439 
    440    RSAEP((n, e), m)
    441 
    442    Input:
    443    (n, e)    RSA public key
    444    m         message representative, an integer between 0 and n-1
    445 
    446    Output:
    447    c         ciphertext representative, an integer between 0 and n-1;
    448              or "message representative out of range"
    449 
    450    Assumptions: public key (n, e) is valid
    451 
    452    Steps:
    453 
    454 
    455 
    456 
    457 Kaliski & Staddon            Informational                      [Page 8]
    458 
    460 RFC 2437        PKCS #1: RSA Cryptography Specifications    October 1998
    461 
    462 
    463    1. If the message representative m is not between 0 and n-1, output
    464    message representative out of range and stop.
    465 
    466    2. Let c = m^e mod n.
    467 
    468    3. Output c.
    469 
    470 5.1.2 RSADP
    471 
    472    RSADP (K, c)
    473 
    474    Input:
    475 
    476    K         RSA private key, where K has one of the following forms
    477                  -a pair (n, d)
    478                  -a quintuple (p, q, dP, dQ, qInv)
    479    c         ciphertext representative, an integer between 0 and n-1
    480 
    481    Output:
    482    m         message representative, an integer between 0 and n-1; or
    483              "ciphertext representative out of range"
    484 
    485    Assumptions: private key K is valid
    486 
    487    Steps:
    488 
    489    1. If the ciphertext representative c is not between 0 and n-1,
    490    output "ciphertext representative out of range" and stop.
    491 
    492    2. If the first form (n, d) of K is used:
    493 
    494    2.1 Let m = c^d mod n.          Else, if the second form (p, q, dP,
    495    dQ, qInv) of K is used:
    496 
    497    2.2 Let m_1 = c^dP mod p.
    498 
    499    2.3 Let m_2 = c^dQ mod q.
    500 
    501    2.4 Let h = qInv ( m_1 - m_2 ) mod p.
    502 
    503    2.5 Let m = m_2 + hq.
    504 
    505    3. Output m.
    506 
    507 
    508 
    509 
    510 
    511 
    512 
    513 
    514 Kaliski & Staddon            Informational                      [Page 9]
    515 
    517 RFC 2437        PKCS #1: RSA Cryptography Specifications    October 1998
    518 
    519 
    520 5.2 Signature and verification primitives
    521 
    522    A signature primitive produces a signature representative from a
    523    message representative under the control of a private key, and a
    524    verification primitive recovers the message representative from the
    525    signature representative under the control of the corresponding
    526    public key. One pair of signature and verification primitives is
    527    employed in the signature schemes defined in this document and is
    528    specified here: RSASP1/RSAVP1.
    529 
    530    The primitives defined here are the same as in the draft IEEE P1363
    531    and are compatible with PKCS #1 v1.5.
    532 
    533    The main mathematical operation in each primitive is exponentiation,
    534    as in the encryption and decryption primitives of Section 5.1. RSASP1
    535    and RSAVP1 are the same as RSADP and RSAEP except for the names of
    536    their input and output arguments; they are distinguished as they are
    537    intended for different purposes.
    538 
    539 5.2.1 RSASP1
    540 
    541    RSASP1 (K, m)
    542 
    543    Input:
    544    K             RSA private key, where K has one of the following
    545                  forms:
    546                     -a pair (n, d)
    547                     -a quintuple (p, q, dP, dQ, qInv)
    548 
    549    m             message representative, an integer between 0 and n-1
    550 
    551    Output:
    552    s             signature representative, an integer between  0 and
    553                  n-1, or "message representative out of range"
    554 
    555    Assumptions:
    556    private key K is valid
    557 
    558    Steps:
    559 
    560    1. If the message representative m is not between 0 and n-1, output
    561    "message representative out of range" and stop.
    562 
    563    2. If the first form (n, d) of K is used:
    564 
    565    2.1 Let s = m^d mod n.          Else, if the second form (p, q, dP,
    566    dQ, qInv) of K is used:
    567 
    568 
    569 
    570 
    571 Kaliski & Staddon            Informational                     [Page 10]
    572 
    574 RFC 2437        PKCS #1: RSA Cryptography Specifications    October 1998
    575 
    576 
    577    2.2 Let s_1 = m^dP mod p.
    578 
    579    2.3 Let s_2 = m^dQ mod q.
    580 
    581    2.4 Let h = qInv ( s_1 - s_2 ) mod p.
    582 
    583    2.5 Let s = s_2 + hq.
    584 
    585    3. Output S.
    586 
    587 5.2.2 RSAVP1
    588 
    589    RSAVP1 ((n, e), s)
    590 
    591    Input:
    592    (n, e)  RSA public key
    593    s       signature representative, an integer between 0 and n-1
    594 
    595    Output:
    596    m       message representative, an integer between 0 and n-1;
    597            or "invalid"
    598 
    599    Assumptions:
    600    public key (n, e) is valid
    601 
    602    Steps:
    603 
    604    1. If the signature representative s is not between 0 and n-1, output
    605    "invalid" and stop.
    606 
    607    2. Let m = s^e mod n.
    608 
    609    3. Output m.
    610 
    611 6. Overview of schemes
    612 
    613    A scheme combines cryptographic primitives and other techniques to
    614    achieve a particular security goal. Two types of scheme are specified
    615    in this document: encryption schemes and signature schemes with
    616    appendix.
    617 
    618    The schemes specified in this document are limited in scope in that
    619    their operations consist only of steps to process data with a key,
    620    and do not include steps for obtaining or validating the key. Thus,
    621    in addition to the scheme operations, an application will typically
    622    include key management operations by which parties may select public
    623    and private keys for a scheme operation. The specific additional
    624    operations and other details are outside the scope of this document.
    625 
    626 
    627 
    628 Kaliski & Staddon            Informational                     [Page 11]
    629 
    631 RFC 2437        PKCS #1: RSA Cryptography Specifications    October 1998
    632 
    633 
    634    As was the case for the cryptographic primitives (Section 5), the
    635    specifications of scheme operations assume that certain conditions
    636    are met by the inputs, in particular that public and private keys are
    637    valid. The behavior of an implementation is thus unspecified when a
    638    key is invalid. The impact of such unspecified behavior depends on
    639    the application. Possible means of addressing key validation include
    640    explicit key validation by the application; key validation within the
    641    public-key infrastructure; and assignment of liability for operations
    642    performed with an invalid key to the party who generated the key.
    643 
    644 7. Encryption schemes
    645 
    646    An encryption scheme consists of an encryption operation and a
    647    decryption operation, where the encryption operation produces a
    648    ciphertext from a message with a recipient's public key, and the
    649    decryption operation recovers the message from the ciphertext with
    650    the recipient's corresponding private key.
    651 
    652    An encryption scheme can be employed in a variety of applications. A
    653    typical application is a key establishment protocol, where the
    654    message contains key material to be delivered confidentially from one
    655    party to another. For instance, PKCS #7 [21] employs such a protocol
    656    to deliver a content-encryption key from a sender to a recipient; the
    657    encryption schemes defined here would be suitable key-encryption
    658    algorithms in that context.
    659 
    660    Two encryption schemes are specified in this document: RSAES-OAEP and
    661    RSAES-PKCS1-v1_5. RSAES-OAEP is recommended for new applications;
    662    RSAES-PKCS1-v1_5 is included only for compatibility with existing
    663    applications, and is not recommended for new applications.
    664 
    665    The encryption schemes given here follow a general model similar to
    666    that employed in IEEE P1363, by combining encryption and decryption
    667    primitives with an encoding method for encryption. The encryption
    668    operations apply a message encoding operation to a message to produce
    669    an encoded message, which is then converted to an integer message
    670    representative. An encryption primitive is applied to the message
    671    representative to produce the ciphertext. Reversing this, the
    672    decryption operations apply a decryption primitive to the ciphertext
    673    to recover a message representative, which is then converted to an
    674    octet string encoded message. A message decoding operation is applied
    675    to the encoded message to recover the message and verify the
    676    correctness of the decryption.
    677 
    678 
    679 
    680 
    681 
    682 
    683 
    684 
    685 Kaliski & Staddon            Informational                     [Page 12]
    686 
    688 RFC 2437        PKCS #1: RSA Cryptography Specifications    October 1998
    689 
    690 
    691 7.1 RSAES-OAEP
    692 
    693    RSAES-OAEP combines the RSAEP and RSADP primitives (Sections 5.1.1
    694    and 5.1.2) with the EME-OAEP encoding method (Section 9.1.1) EME-OAEP
    695    is based on the method found in [2]. It is compatible with the IFES
    696    scheme defined in the draft P1363 where the encryption and decryption
    697    primitives are IFEP-RSA and IFDP-RSA and the message encoding method
    698    is EME-OAEP. RSAES-OAEP can operate on messages of length up to k-2-
    699    2hLen octets, where hLen is the length of the hash function output
    700    for EME-OAEP and k is the length in octets of the recipient's RSA
    701    modulus.  Assuming that the hash function in EME-OAEP has appropriate
    702    properties, and the key size is sufficiently large, RSAEP-OAEP
    703    provides "plaintext-aware encryption," meaning that it is
    704    computationally infeasible to obtain full or partial information
    705    about a message from a ciphertext, and computationally infeasible to
    706    generate a valid ciphertext without knowing the corresponding
    707    message.  Therefore, a chosen-ciphertext attack is ineffective
    708    against a plaintext-aware encryption scheme such as RSAES-OAEP.
    709 
    710    Both the encryption and the decryption operations of RSAES-OAEP take
    711    the value of the parameter string P as input. In this version of PKCS
    712    #1, P is an octet string that is specified explicitly. See Section
    713    11.2.1 for the relevant ASN.1 syntax. We briefly note that to receive
    714    the full security benefit of RSAES-OAEP, it should not be used in a
    715    protocol involving RSAES-PKCS1-v1_5. It is possible that in a
    716    protocol on which both encryption schemes are present, an adaptive
    717    chosen ciphertext attack such as [4] would be useful.
    718 
    719    Both the encryption and the decryption operations of RSAES-OAEP take
    720    the value of the parameter string P as input. In this version of PKCS
    721    #1, P is an octet string that is specified explicitly. See Section
    722    11.2.1 for the relevant ASN.1 syntax.
    723 
    724 7.1.1 Encryption operation
    725 
    726    RSAES-OAEP-ENCRYPT ((n, e), M, P)
    727 
    728    Input:
    729    (n, e)    recipient's RSA public key
    730 
    731    M         message to be encrypted, an octet string of length at
    732              most k-2-2hLen, where k is the length in octets of the
    733              modulus n and hLen is the length in octets of the hash
    734              function output for EME-OAEP
    735 
    736    P         encoding parameters, an octet string that may be empty
    737 
    738 
    739 
    740 
    741 
    742 Kaliski & Staddon            Informational                     [Page 13]
    743 
    745 RFC 2437        PKCS #1: RSA Cryptography Specifications    October 1998
    746 
    747 
    748    Output:
    749    C         ciphertext, an octet string of length k; or "message too
    750              long"
    751 
    752    Assumptions: public key (n, e) is valid
    753 
    754    Steps:
    755 
    756    1. Apply the EME-OAEP encoding operation (Section 9.1.1.2) to the
    757    message M and the encoding parameters P to produce an encoded message
    758    EM of length k-1 octets:
    759 
    760    EM = EME-OAEP-ENCODE (M, P, k-1)
    761 
    762    If the encoding operation outputs "message too long," then output
    763    "message too long" and stop.
    764 
    765    2. Convert the encoded message EM to an integer message
    766    representative m: m = OS2IP (EM)
    767 
    768    3. Apply the RSAEP encryption primitive (Section 5.1.1) to the public
    769    key (n, e) and the message representative m to produce an integer
    770    ciphertext representative c:
    771 
    772    c = RSAEP ((n, e), m)
    773 
    774    4. Convert the ciphertext representative c to a ciphertext C of
    775    length k octets: C = I2OSP (c, k)
    776 
    777    5. Output the ciphertext C.
    778 
    779 7.1.2 Decryption operation
    780 
    781    RSAES-OAEP-DECRYPT (K, C, P)
    782 
    783    Input:
    784    K          recipient's RSA private key
    785    C          ciphertext to be decrypted, an octet string of length
    786               k, where k is the length in octets of the modulus n
    787    P          encoding parameters, an octet string that may be empty
    788 
    789    Output:
    790    M          message, an octet string of length at most k-2-2hLen,
    791               where hLen is the length in octets of the hash
    792               function output for EME-OAEP; or "decryption error"
    793 
    794 
    795 
    796 
    797 
    798 
    799 Kaliski & Staddon            Informational                     [Page 14]
    800 
    802 RFC 2437        PKCS #1: RSA Cryptography Specifications    October 1998
    803 
    804 
    805    Steps:
    806 
    807    1. If the length of the ciphertext C is not k octets, output
    808    "decryption error" and stop.
    809 
    810    2. Convert the ciphertext C to an integer ciphertext representative
    811    c: c = OS2IP (C).
    812 
    813    3. Apply the RSADP decryption primitive (Section 5.1.2) to the
    814    private key K and the ciphertext representative c to produce an
    815    integer message representative m:
    816 
    817    m = RSADP (K, c)
    818 
    819    If RSADP outputs "ciphertext out of range," then output "decryption
    820    error" and stop.
    821 
    822    4. Convert the message representative m to an encoded message EM of
    823    length k-1 octets: EM = I2OSP (m, k-1)
    824 
    825    If I2OSP outputs "integer too large," then output "decryption error"
    826    and stop.
    827 
    828    5. Apply the EME-OAEP decoding operation to the encoded message EM
    829    and the encoding parameters P to recover a message M:
    830 
    831    M = EME-OAEP-DECODE (EM, P)
    832 
    833    If the decoding operation outputs "decoding error," then output
    834    "decryption error" and stop.
    835 
    836    6. Output the message M.
    837 
    838    Note. It is important that the error messages output in steps 4 and 5
    839    be the same, otherwise an adversary may be able to extract useful
    840    information from the type of error message received. Error message
    841    information is used to mount a chosen-ciphertext attack on PKCS #1
    842    v1.5 encrypted messages in [4].
    843 
    844 7.2 RSAES-PKCS1-v1_5
    845 
    846    RSAES-PKCS1-v1_5 combines the RSAEP and RSADP primitives with the
    847    EME-PKCS1-v1_5 encoding method. It is the same as the encryption
    848    scheme in PKCS #1 v1.5. RSAES-PKCS1-v1_5 can operate on messages of
    849    length up to k-11 octets, although care should be taken to avoid
    850    certain attacks on low-exponent RSA due to Coppersmith, et al. when
    851    long messages are encrypted (see the third bullet in the notes below
    852    and [7]).
    853 
    854 
    855 
    856 Kaliski & Staddon            Informational                     [Page 15]
    857 
    859 RFC 2437        PKCS #1: RSA Cryptography Specifications    October 1998
    860 
    861 
    862    RSAES-PKCS1-v1_5 does not provide "plaintext aware" encryption. In
    863    particular, it is possible to generate valid ciphertexts without
    864    knowing the corresponding plaintexts, with a reasonable probability
    865    of success. This ability can be exploited in a chosen ciphertext
    866    attack as shown in [4]. Therefore, if RSAES-PKCS1-v1_5 is to be used,
    867    certain easily implemented countermeasures should be taken to thwart
    868    the attack found in [4]. The addition of structure to the data to be
    869    encoded, rigorous checking of PKCS #1 v1.5 conformance and other
    870    redundancy in decrypted messages, and the consolidation of error
    871    messages in a client-server protocol based on PKCS #1 v1.5 can all be
    872    effective countermeasures and don't involve changes to a PKCS #1
    873    v1.5-based protocol. These and other countermeasures are discussed in
    874    [5].
    875 
    876    Notes. The following passages describe some security recommendations
    877    pertaining to the use of RSAES-PKCS1-v1_5. Recommendations from
    878    version 1.5 of this document are included as well as new
    879    recommendations motivated by cryptanalytic advances made in the
    880    intervening years.
    881 
    882    -It is recommended that the pseudorandom octets in EME-PKCS1-v1_5 be
    883    generated independently for each encryption process, especially if
    884    the same data is input to more than one encryption process. Hastad's
    885    results [13] are one motivation for this recommendation.
    886 
    887    -The padding string PS in EME-PKCS1-v1_5 is at least eight octets
    888    long, which is a security condition for public-key operations that
    889    prevents an attacker from recovering data by trying all possible
    890    encryption blocks.
    891 
    892    -The pseudorandom octets can also help thwart an attack due to
    893    Coppersmith et al. [7] when the size of the message to be encrypted
    894    is kept small. The attack works on low-exponent RSA when similar
    895    messages are encrypted with the same public key. More specifically,
    896    in one flavor of the attack, when two inputs to RSAEP agree on a
    897    large fraction of bits (8/9) and low-exponent RSA (e = 3) is used to
    898    encrypt both of them, it may be possible to recover both inputs with
    899    the attack. Another flavor of the attack is successful in decrypting
    900    a single ciphertext when a large fraction (2/3) of the input to RSAEP
    901    is already known. For typical applications, the message to be
    902    encrypted is short (e.g., a 128-bit symmetric key) so not enough
    903    information will be known or common between two messages to enable
    904    the attack.  However, if a long message is encrypted, or if part of a
    905    message is known, then the attack may be a concern. In any case, the
    906    RSAEP-OAEP scheme overcomes the attack.
    907 
    908 
    909 
    910 
    911 
    912 
    913 Kaliski & Staddon            Informational                     [Page 16]
    914 
    916 RFC 2437        PKCS #1: RSA Cryptography Specifications    October 1998
    917 
    918 
    919 7.2.1 Encryption operation
    920 
    921    RSAES-PKCS1-V1_5-ENCRYPT ((n, e), M)
    922 
    923    Input:
    924    (n, e)  recipient's RSA public key
    925    M       message to be encrypted, an octet string of length at
    926            most k-11 octets, where k is the length in octets of the
    927            modulus n
    928 
    929    Output:
    930    C       ciphertext, an octet string of length k; or "message too
    931            long"
    932 
    933    Steps:
    934 
    935    1. Apply the EME-PKCS1-v1_5 encoding operation (Section 9.1.2.1) to
    936    the message M to produce an encoded message EM of length k-1 octets:
    937 
    938    EM = EME-PKCS1-V1_5-ENCODE (M, k-1)
    939 
    940    If the encoding operation outputs "message too long," then output
    941    "message too long" and stop.
    942 
    943    2. Convert the encoded message EM to an integer message
    944    representative m: m = OS2IP (EM)
    945 
    946    3. Apply the RSAEP encryption primitive (Section 5.1.1) to the public
    947    key (n, e) and the message representative m to produce an integer
    948    ciphertext representative c: c = RSAEP ((n, e), m)
    949 
    950    4. Convert the ciphertext representative c to a ciphertext C of
    951    length k octets: C = I2OSP (c, k)
    952 
    953    5. Output the ciphertext C.
    954 
    955 7.2.2 Decryption operation
    956 
    957    RSAES-PKCS1-V1_5-DECRYPT (K, C)
    958 
    959    Input:
    960    K       recipient's RSA private key
    961    C       ciphertext to be decrypted, an octet string of length k,
    962            where k is the length in octets of the modulus n
    963 
    964    Output:
    965    M       message, an octet string of length at most k-11; or
    966            "decryption error"
    967 
    968 
    969 
    970 Kaliski & Staddon            Informational                     [Page 17]
    971 
    973 RFC 2437        PKCS #1: RSA Cryptography Specifications    October 1998
    974 
    975 
    976    Steps:
    977 
    978    1. If the length of the ciphertext C is not k octets, output
    979    "decryption error" and stop.
    980 
    981    2. Convert the ciphertext C to an integer ciphertext representative
    982    c: c = OS2IP (C).
    983 
    984    3. Apply the RSADP decryption primitive to the private key (n, d) and
    985    the ciphertext representative c to produce an integer message
    986    representative m: m = RSADP ((n, d), c).
    987 
    988    If RSADP outputs "ciphertext out of range," then output "decryption
    989    error" and stop.
    990 
    991    4. Convert the message representative m to an encoded message EM of
    992    length k-1 octets: EM = I2OSP (m, k-1)
    993 
    994    If I2OSP outputs "integer too large," then output "decryption error"
    995    and stop.
    996 
    997    5. Apply the EME-PKCS1-v1_5 decoding operation to the encoded message
    998    EM to recover a message M: M = EME-PKCS1-V1_5-DECODE (EM).
    999 
   1000    If the decoding operation outputs "decoding error," then output
   1001    "decryption error" and stop.
   1002 
   1003    6. Output the message M.
   1004 
   1005    Note. It is important that only one type of error message is output
   1006    by EME-PKCS1-v1_5, as ensured by steps 4 and 5. If this is not done,
   1007    then an adversary may be able to use information extracted form the
   1008    type of error message received to mount a chosen-ciphertext attack
   1009    such as the one found in [4].
   1010 
   1011 8. Signature schemes with appendix
   1012 
   1013    A signature scheme with appendix consists of a signature generation
   1014    operation and a signature verification operation, where the signature
   1015    generation operation produces a signature from a message with a
   1016    signer's private key, and the signature verification operation
   1017    verifies the signature on the message with the signer's corresponding
   1018    public key.  To verify a signature constructed with this type of
   1019    scheme it is necessary to have the message itself. In this way,
   1020    signature schemes with appendix are distinguished from signature
   1021    schemes with message recovery, which are not supported in this
   1022    document.
   1023 
   1024 
   1025 
   1026 
   1027 Kaliski & Staddon            Informational                     [Page 18]
   1028 
   1030 RFC 2437        PKCS #1: RSA Cryptography Specifications    October 1998
   1031 
   1032 
   1033    A signature scheme with appendix can be employed in a variety of
   1034    applications. For instance, X.509 [6] employs such a scheme to
   1035    authenticate the content of a certificate; the signature scheme with
   1036    appendix defined here would be a suitable signature algorithm in that
   1037    context. A related signature scheme could be employed in PKCS #7
   1038    [21], although for technical reasons, the current version of PKCS #7
   1039    separates a hash function from a signature scheme, which is different
   1040    than what is done here.
   1041 
   1042    One signature scheme with appendix is specified in this document:
   1043    RSASSA-PKCS1-v1_5.
   1044 
   1045    The signature scheme with appendix given here follows a general model
   1046    similar to that employed in IEEE P1363, by combining signature and
   1047    verification primitives with an encoding method for signatures. The
   1048    signature generation operations apply a message encoding operation to
   1049    a message to produce an encoded message, which is then converted to
   1050    an integer message representative. A signature primitive is then
   1051    applied to the message representative to produce the signature. The
   1052    signature verification operations apply a signature verification
   1053    primitive to the signature to recover a message representative, which
   1054    is then converted to an octet string. The message encoding operation
   1055    is again applied to the message, and the result is compared to the
   1056    recovered octet string. If there is a match, the signature is
   1057    considered valid. (Note that this approach assumes that the signature
   1058    and verification primitives have the message-recovery form and the
   1059    encoding method is deterministic, as is the case for RSASP1/RSAVP1
   1060    and EMSA-PKCS1-v1_5. The signature generation and verification
   1061    operations have a different form in P1363 for other primitives and
   1062    encoding methods.)
   1063 
   1064    Editor's note. RSA Laboratories is investigating the possibility of
   1065    including a scheme based on the PSS encoding methods specified in
   1066    [3], which would be recommended for new applications.
   1067 
   1068 8.1 RSASSA-PKCS1-v1_5
   1069 
   1070    RSASSA-PKCS1-v1_5 combines the RSASP1 and RSAVP1 primitives with the
   1071    EME-PKCS1-v1_5 encoding method. It is compatible with the IFSSA
   1072    scheme defined in the draft P1363 where the signature and
   1073    verification primitives are IFSP-RSA1 and IFVP-RSA1 and the message
   1074    encoding method is EMSA-PKCS1-v1_5 (which is not defined in P1363).
   1075    The length of messages on which RSASSA-PKCS1-v1_5 can operate is
   1076    either unrestricted or constrained by a very large number, depending
   1077    on the hash function underlying the message encoding method.
   1078 
   1079 
   1080 
   1081 
   1082 
   1083 
   1084 Kaliski & Staddon            Informational                     [Page 19]
   1085 
   1087 RFC 2437        PKCS #1: RSA Cryptography Specifications    October 1998
   1088 
   1089 
   1090    Assuming that the hash function in EMSA-PKCS1-v1_5 has appropriate
   1091    properties and the key size is sufficiently large, RSASSA-PKCS1-v1_5
   1092    provides secure signatures, meaning that it is computationally
   1093    infeasible to generate a signature without knowing the private key,
   1094    and computationally infeasible to find a message with a given
   1095    signature or two messages with the same signature. Also, in the
   1096    encoding method EMSA-PKCS1-v1_5, a hash function identifier is
   1097    embedded in the encoding.  Because of this feature, an adversary must
   1098    invert or find collisions of the particular hash function being used;
   1099    attacking a different hash function than the one selected by the
   1100    signer is not useful to the adversary.
   1101 
   1102 8.1.1 Signature generation operation
   1103 
   1104    RSASSA-PKCS1-V1_5-SIGN (K, M)
   1105    Input:
   1106    K         signer's RSA private ke
   1107    M         message to be signed, an octet string
   1108 
   1109    Output:
   1110    S         signature, an octet string of length k, where k is the
   1111              length in octets of the modulus n; "message too long" or
   1112              "modulus too short"
   1113    Steps:
   1114 
   1115    1. Apply the EMSA-PKCS1-v1_5 encoding operation (Section 9.2.1) to
   1116    the message M to produce an encoded message EM of length k-1 octets:
   1117 
   1118    EM = EMSA-PKCS1-V1_5-ENCODE (M, k-1)
   1119 
   1120    If the encoding operation outputs "message too long," then output
   1121    "message too long" and stop. If the encoding operation outputs
   1122    "intended encoded message length too short" then output "modulus too
   1123    short".
   1124 
   1125    2. Convert the encoded message EM to an integer message
   1126    representative m: m = OS2IP (EM)
   1127 
   1128    3. Apply the RSASP1 signature primitive (Section 5.2.1) to the
   1129    private key K and the message representative m to produce an integer
   1130    signature representative s: s = RSASP1 (K, m)
   1131 
   1132    4. Convert the signature representative s to a signature S of length
   1133    k octets: S = I2OSP (s, k)
   1134 
   1135    5. Output the signature S.
   1136 
   1137 
   1138 
   1139 
   1140 
   1141 Kaliski & Staddon            Informational                     [Page 20]
   1142 
   1144 RFC 2437        PKCS #1: RSA Cryptography Specifications    October 1998
   1145 
   1146 
   1147 8.1.2 Signature verification operation
   1148 
   1149    RSASSA-PKCS1-V1_5-VERIFY ((n, e), M, S)
   1150 
   1151    Input:
   1152    (n, e)    signer's RSA public key
   1153    M         message whose signature is to be verified, an octet string
   1154    S         signature to be verified, an octet string of length k,
   1155              where k is the length in octets of the modulus n
   1156 
   1157    Output: "valid signature," "invalid signature," or "message too
   1158    long", or "modulus too short"
   1159 
   1160    Steps:
   1161 
   1162    1. If the length of the signature S is not k octets, output "invalid
   1163    signature" and stop.
   1164 
   1165    2. Convert the signature S to an integer signature representative s:
   1166 
   1167    s = OS2IP (S)
   1168 
   1169    3. Apply the RSAVP1 verification primitive (Section 5.2.2) to the
   1170    public key (n, e) and the signature representative s to produce an
   1171    integer message representative m:
   1172 
   1173    m = RSAVP1 ((n, e), s)                  If RSAVP1 outputs "invalid"
   1174    then output "invalid signature" and stop.
   1175 
   1176    4. Convert the message representative m to an encoded message EM of
   1177    length k-1 octets: EM = I2OSP (m, k-1)
   1178 
   1179    If I2OSP outputs "integer too large," then output "invalid signature"
   1180    and stop.
   1181 
   1182    5. Apply the EMSA-PKCS1-v1_5 encoding operation (Section 9.2.1) to
   1183    the message M to produce a second encoded message EM' of length k-1
   1184    octets:
   1185 
   1186    EM' = EMSA-PKCS1-V1_5-ENCODE (M, k-1)
   1187 
   1188    If the encoding operation outputs "message too long," then output
   1189    "message too long" and stop. If the encoding operation outputs
   1190    "intended encoded message length too short" then output "modulus too
   1191    short".
   1192 
   1193 
   1194 
   1195 
   1196 
   1197 
   1198 Kaliski & Staddon            Informational                     [Page 21]
   1199 
   1201 RFC 2437        PKCS #1: RSA Cryptography Specifications    October 1998
   1202 
   1203 
   1204    6. Compare the encoded message EM and the second encoded message EM'.
   1205    If they are the same, output "valid signature"; otherwise, output
   1206    "invalid signature."
   1207 
   1208 9. Encoding methods
   1209 
   1210    Encoding methods consist of operations that map between octet string
   1211    messages and integer message representatives.
   1212 
   1213    Two types of encoding method are considered in this document:
   1214    encoding methods for encryption, encoding methods for signatures with
   1215    appendix.
   1216 
   1217 9.1 Encoding methods for encryption
   1218 
   1219    An encoding method for encryption consists of an encoding operation
   1220    and a decoding operation. An encoding operation maps a message M to a
   1221    message representative EM of a specified length; the decoding
   1222    operation maps a message representative EM back to a message. The
   1223    encoding and decoding operations are inverses.
   1224 
   1225    The message representative EM will typically have some structure that
   1226    can be verified by the decoding operation; the decoding operation
   1227    will output "decoding error" if the structure is not present. The
   1228    encoding operation may also introduce some randomness, so that
   1229    different applications of the encoding operation to the same message
   1230    will produce different representatives.
   1231 
   1232    Two encoding methods for encryption are employed in the encryption
   1233    schemes and are specified here: EME-OAEP and EME-PKCS1-v1_5.
   1234 
   1235 9.1.1 EME-OAEP
   1236 
   1237    This encoding method is parameterized by the choice of hash function
   1238    and mask generation function. Suggested hash and mask generation
   1239    functions are given in Section 10. This encoding method is based on
   1240    the method found in [2].
   1241 
   1242 9.1.1.1 Encoding operation
   1243 
   1244    EME-OAEP-ENCODE (M, P, emLen)
   1245 
   1246    Options:
   1247    Hash      hash function (hLen denotes the length in octet of the
   1248              hash function output)
   1249    MGF       mask generation function
   1250 
   1251 
   1252 
   1253 
   1254 
   1255 Kaliski & Staddon            Informational                     [Page 22]
   1256 
   1258 RFC 2437        PKCS #1: RSA Cryptography Specifications    October 1998
   1259 
   1260 
   1261    Input:
   1262    M         message to be encoded, an octet string of length at most
   1263              emLen-1-2hLen
   1264    P         encoding parameters, an octet string
   1265    emLen     intended length in octets of the encoded message, at least
   1266              2hLen+1
   1267 
   1268    Output:
   1269    EM        encoded message, an octet string of length emLen;
   1270              "message too long" or "parameter string too long"
   1271 
   1272    Steps:
   1273 
   1274    1. If the length of P is greater than the input limitation for the
   1275    hash function (2^61-1 octets for SHA-1) then output "parameter string
   1276    too long" and stop.
   1277 
   1278    2. If ||M|| > emLen-2hLen-1 then output "message too long" and stop.
   1279 
   1280    3. Generate an octet string PS consisting of emLen-||M||-2hLen-1 zero
   1281    octets. The length of PS may be 0.
   1282 
   1283    4. Let pHash = Hash(P), an octet string of length hLen.
   1284 
   1285    5. Concatenate pHash, PS, the message M, and other padding to form a
   1286    data block DB as: DB = pHash || PS || 01 || M
   1287 
   1288    6. Generate a random octet string seed of length hLen.
   1289 
   1290    7. Let dbMask = MGF(seed, emLen-hLen).
   1291 
   1292    8. Let maskedDB = DB \xor dbMask.
   1293 
   1294    9. Let seedMask = MGF(maskedDB, hLen).
   1295 
   1296    10. Let maskedSeed = seed \xor seedMask.
   1297 
   1298    11. Let EM = maskedSeed || maskedDB.
   1299 
   1300    12. Output EM.
   1301 
   1302 9.1.1.2 Decoding operation EME-OAEP-DECODE (EM, P)
   1303 
   1304    Options:
   1305    Hash      hash function (hLen denotes the length in octet of the hash
   1306              function output)
   1307 
   1308    MGF       mask generation function
   1309 
   1310 
   1311 
   1312 Kaliski & Staddon            Informational                     [Page 23]
   1313 
   1315 RFC 2437        PKCS #1: RSA Cryptography Specifications    October 1998
   1316 
   1317 
   1318    Input:
   1319 
   1320    EM        encoded message, an octet string of length at least 2hLen+1
   1321    P         encoding parameters, an octet string
   1322 
   1323    Output:
   1324    M         recovered message, an octet string of length at most
   1325              ||EM||-1-2hLen; or "decoding error"
   1326 
   1327    Steps:
   1328 
   1329    1. If the length of P is greater than the input limitation for the
   1330    hash function (2^61-1 octets for SHA-1) then output "parameter string
   1331    too long" and stop.
   1332 
   1333    2. If ||EM|| < 2hLen+1, then output "decoding error" and stop.
   1334 
   1335    3. Let maskedSeed be the first hLen octets of EM and let maskedDB be
   1336    the remaining ||EM|| - hLen octets.
   1337 
   1338    4. Let seedMask = MGF(maskedDB, hLen).
   1339 
   1340    5. Let seed = maskedSeed \xor seedMask.
   1341 
   1342    6. Let dbMask = MGF(seed, ||EM|| - hLen).
   1343 
   1344    7. Let DB = maskedDB \xor dbMask.
   1345 
   1346    8. Let pHash = Hash(P), an octet string of length hLen.
   1347 
   1348    9. Separate DB into an octet string pHash' consisting of the first
   1349    hLen octets of DB, a (possibly empty) octet string PS consisting of
   1350    consecutive zero octets following pHash', and a message M as:
   1351 
   1352    DB = pHash' || PS || 01 || M
   1353 
   1354    If there is no 01 octet to separate PS from M, output "decoding
   1355    error" and stop.
   1356 
   1357    10. If pHash' does not equal pHash, output "decoding error" and stop.
   1358 
   1359    11. Output M.
   1360 
   1361 9.1.2 EME-PKCS1-v1_5
   1362 
   1363    This encoding method is the same as in PKCS #1 v1.5, Section 8:
   1364    Encryption Process.
   1365 
   1366 
   1367 
   1368 
   1369 Kaliski & Staddon            Informational                     [Page 24]
   1370 
   1372 RFC 2437        PKCS #1: RSA Cryptography Specifications    October 1998
   1373 
   1374 
   1375 9.1.2.1 Encoding operation
   1376 
   1377    EME-PKCS1-V1_5-ENCODE (M, emLen)
   1378 
   1379    Input:
   1380    M         message to be encoded, an octet string of length at most
   1381              emLen-10
   1382    emLen     intended length in octets of the encoded message
   1383 
   1384    Output:
   1385    EM        encoded message, an octet string of length emLen; or
   1386              "message too long"
   1387 
   1388    Steps:
   1389 
   1390    1. If the length of the message M is greater than emLen - 10 octets,
   1391    output "message too long" and stop.
   1392 
   1393    2. Generate an octet string PS of length emLen-||M||-2 consisting of
   1394    pseudorandomly generated nonzero octets. The length of PS will be at
   1395    least 8 octets.
   1396 
   1397    3. Concatenate PS, the message M, and other padding to form the
   1398    encoded message EM as:
   1399 
   1400    EM = 02 || PS || 00 || M
   1401 
   1402    4. Output EM.
   1403 
   1404 9.1.2.2 Decoding operation
   1405 
   1406    EME-PKCS1-V1_5-DECODE (EM)
   1407 
   1408    Input:
   1409    EM      encoded message, an octet string of length at least 10
   1410 
   1411    Output:
   1412    M       recovered message, an octet string of length at most
   1413            ||EM||-10; or "decoding error"
   1414 
   1415    Steps:
   1416 
   1417    1. If the length of the encoded message EM is less than 10, output
   1418    "decoding error" and stop.
   1419 
   1420    2. Separate the encoded message EM into an octet string PS consisting
   1421    of nonzero octets and a message M as: EM = 02 || PS || 00 || M.
   1422 
   1423 
   1424 
   1425 
   1426 Kaliski & Staddon            Informational                     [Page 25]
   1427 
   1429 RFC 2437        PKCS #1: RSA Cryptography Specifications    October 1998
   1430 
   1431 
   1432    If the first octet of EM is not 02, or if there is no 00 octet to
   1433    separate PS from M, output "decoding error" and stop.
   1434 
   1435    3. If the length of PS is less than 8 octets, output "decoding error"
   1436    and stop.
   1437 
   1438    4. Output M.
   1439 
   1440 9.2 Encoding methods for signatures with appendix
   1441 
   1442    An encoding method for signatures with appendix, for the purposes of
   1443    this document, consists of an encoding operation. An encoding
   1444    operation maps a message M to a message representative EM of a
   1445    specified length. (In future versions of this document, encoding
   1446    methods may be added that also include a decoding operation.)
   1447 
   1448    One encoding method for signatures with appendix is employed in the
   1449    encryption schemes and is specified here: EMSA-PKCS1-v1_5.
   1450 
   1451 9.2.1 EMSA-PKCS1-v1_5
   1452 
   1453    This encoding method only has an encoding operation.
   1454 
   1455    EMSA-PKCS1-v1_5-ENCODE (M, emLen)
   1456 
   1457    Option:
   1458    Hash      hash function (hLen denotes the length in octet of the hash
   1459              function output)
   1460 
   1461    Input:
   1462    M         message to be encoded
   1463    emLen     intended length in octets of the encoded message, at least
   1464              ||T|| + 10, where T is the DER encoding of a certain value
   1465              computed during the encoding operation
   1466 
   1467    Output:
   1468    EM        encoded message, an octet string of length emLen; or "message
   1469              too long" or "intended encoded message length too short"
   1470 
   1471    Steps:
   1472 
   1473    1. Apply the hash function to the message M to produce a hash value
   1474    H:
   1475 
   1476    H = Hash(M).
   1477 
   1478    If the hash function outputs "message too long," then output "message
   1479    too long".
   1480 
   1481 
   1482 
   1483 Kaliski & Staddon            Informational                     [Page 26]
   1484 
   1486 RFC 2437        PKCS #1: RSA Cryptography Specifications    October 1998
   1487 
   1488 
   1489    2. Encode the algorithm ID for the hash function and the hash value
   1490    into an ASN.1 value of type DigestInfo (see Section 11) with the
   1491    Distinguished Encoding Rules (DER), where the type DigestInfo has the
   1492    syntax
   1493 
   1494    DigestInfo::=SEQUENCE{
   1495      digestAlgorithm  AlgorithmIdentifier,
   1496      digest OCTET STRING }
   1497 
   1498    The first field identifies the hash function and the second contains
   1499    the hash value. Let T be the DER encoding.
   1500 
   1501    3. If emLen is less than ||T|| + 10 then output "intended encoded
   1502    message length too short".
   1503 
   1504    4. Generate an octet string PS consisting of emLen-||T||-2 octets
   1505    with value FF (hexadecimal). The length of PS will be at least 8
   1506    octets.
   1507 
   1508    5. Concatenate PS, the DER encoding T, and other padding to form the
   1509    encoded message EM as: EM = 01 || PS || 00 || T
   1510 
   1511    6. Output EM.
   1512 
   1513 10. Auxiliary Functions
   1514 
   1515    This section specifies the hash functions and the mask generation
   1516    functions that are mentioned in the encoding methods (Section 9).
   1517 
   1518 10.1 Hash Functions
   1519 
   1520    Hash functions are used in the operations contained in Sections 7, 8
   1521    and 9. Hash functions are deterministic, meaning that the output is
   1522    completely determined by the input. Hash functions take octet strings
   1523    of variable length, and generate fixed length octet strings. The hash
   1524    functions used in the operations contained in Sections 7, 8 and 9
   1525    should be collision resistant. This means that it is infeasible to
   1526    find two distinct inputs to the hash function that produce the same
   1527    output. A collision resistant hash function also has the desirable
   1528    property of being one-way; this means that given an output, it is
   1529    infeasible to find an input whose hash is the specified output. The
   1530    property of collision resistance is especially desirable for RSASSA-
   1531    PKCS1-v1_5, as it makes it infeasible to forge signatures. In
   1532    addition to the requirements, the hash function should yield a mask
   1533    generation function  (Section 10.2) with pseudorandom output.
   1534 
   1535 
   1536 
   1537 
   1538 
   1539 
   1540 Kaliski & Staddon            Informational                     [Page 27]
   1541 
   1543 RFC 2437        PKCS #1: RSA Cryptography Specifications    October 1998
   1544 
   1545 
   1546    Three hash functions are recommended for the encoding methods in this
   1547    document: MD2 [15], MD5 [17], and SHA-1 [16]. For the EME-OAEP
   1548    encoding method, only SHA-1 is recommended. For the EMSA-PKCS1-v1_5
   1549    encoding method, SHA-1 is recommended for new applications. MD2 and
   1550    MD5 are recommended only for compatibility with existing applications
   1551    based on PKCS #1 v1.5.
   1552 
   1553    The hash functions themselves are not defined here; readers are
   1554    referred to the appropriate references ([15], [17] and [16]).
   1555 
   1556    Note. Version 1.5 of this document also allowed for the use of MD4 in
   1557    signature schemes. The cryptanalysis of MD4 has progressed
   1558    significantly in the intervening years. For example, Dobbertin [10]
   1559    demonstrated how to find collisions for MD4 and that the first two
   1560    rounds of MD4 are not one-way [11]. Because of these results and
   1561    others (e.g. [9]), MD4 is no longer recommended. There have also been
   1562    advances in the cryptanalysis of MD2 and MD5, although not enough to
   1563    warrant removal from existing applications. Rogier and Chauvaud [19]
   1564    demonstrated how to find collisions in a modified version of MD2. No
   1565    one has demonstrated how to find collisions for the full MD5
   1566    algorithm, although partial results have been found (e.g. [8]). For
   1567    new applications, to address these concerns, SHA-1 is preferred.
   1568 
   1569 10.2 Mask Generation Functions
   1570 
   1571    A mask generation function takes an octet string of variable length
   1572    and a desired output length as input, and outputs an octet string of
   1573    the desired length. There may be restrictions on the length of the
   1574    input and output octet strings, but such bounds are generally very
   1575    large. Mask generation functions are deterministic; the octet string
   1576    output is completely determined by the input octet string. The output
   1577    of a mask generation function should be pseudorandom, that is, if the
   1578    seed to the function is unknown, it should be infeasible to
   1579    distinguish the output from a truly random string. The plaintext-
   1580    awareness of RSAES-OAEP relies on the random nature of the output of
   1581    the mask generation function, which in turn relies on the random
   1582    nature of the underlying hash.
   1583 
   1584    One mask generation function is recommended for the encoding methods
   1585    in this document, and is defined here: MGF1, which is based on a hash
   1586    function. Future versions of this document may define other mask
   1587    generation functions.
   1588 
   1589 10.2.1 MGF1
   1590 
   1591    MGF1 is a Mask Generation Function based on a hash function.
   1592 
   1593    MGF1 (Z, l)
   1594 
   1595 
   1596 
   1597 Kaliski & Staddon            Informational                     [Page 28]
   1598 
   1600 RFC 2437        PKCS #1: RSA Cryptography Specifications    October 1998
   1601 
   1602 
   1603    Options:
   1604    Hash    hash function (hLen denotes the length in octets of the hash
   1605            function output)
   1606 
   1607    Input:
   1608    Z       seed from which mask is generated, an octet string
   1609    l       intended length in octets of the mask, at most 2^32(hLen)
   1610 
   1611    Output:
   1612    mask    mask, an octet string of length l; or "mask too long"
   1613 
   1614    Steps:
   1615 
   1616    1.If l > 2^32(hLen), output "mask too long" and stop.
   1617 
   1618    2.Let T  be the empty octet string.
   1619 
   1620    3.For counter from 0 to \lceil{l / hLen}\rceil-1, do the following:
   1621 
   1622    a.Convert counter to an octet string C of length 4 with the primitive
   1623    I2OSP: C = I2OSP (counter, 4)
   1624 
   1625    b.Concatenate the hash of the seed Z and C to the octet string T: T =
   1626    T || Hash (Z || C)
   1627 
   1628    4.Output the leading l octets of T as the octet string mask.
   1629 
   1630 11. ASN.1 syntax
   1631 
   1632 11.1 Key representation
   1633 
   1634    This section defines ASN.1 object identifiers for RSA public and
   1635    private keys, and defines the types RSAPublicKey and RSAPrivateKey.
   1636    The intended application of these definitions includes X.509
   1637    certificates, PKCS #8 [22], and PKCS #12 [23].
   1638 
   1639    The object identifier rsaEncryption identifies RSA public and private
   1640    keys as defined in Sections 11.1.1 and 11.1.2. The parameters field
   1641    associated with this OID in an AlgorithmIdentifier shall have type
   1642    NULL.
   1643 
   1644    rsaEncryption OBJECT IDENTIFIER ::= {pkcs-1 1}
   1645 
   1646    All of the definitions in this section are the same as in PKCS #1
   1647    v1.5.
   1648 
   1649 
   1650 
   1651 
   1652 
   1653 
   1654 Kaliski & Staddon            Informational                     [Page 29]
   1655 
   1657 RFC 2437        PKCS #1: RSA Cryptography Specifications    October 1998
   1658 
   1659 
   1660 11.1.1 Public-key syntax
   1661 
   1662    An RSA public key should be represented with the ASN.1 type
   1663    RSAPublicKey:
   1664 
   1665    RSAPublicKey::=SEQUENCE{
   1666      modulus INTEGER, -- n
   1667      publicExponent INTEGER -- e }
   1668 
   1669    (This type is specified in X.509 and is retained here for
   1670    compatibility.)
   1671 
   1672    The fields of type RSAPublicKey have the following meanings:
   1673    -modulus is the modulus n.
   1674    -publicExponent is the public exponent e.
   1675 
   1676 11.1.2 Private-key syntax
   1677 
   1678    An RSA private key should be represented with ASN.1 type
   1679    RSAPrivateKey:
   1680 
   1681    RSAPrivateKey ::= SEQUENCE {
   1682      version Version,
   1683      modulus INTEGER, -- n
   1684      publicExponent INTEGER, -- e
   1685      privateExponent INTEGER, -- d
   1686      prime1 INTEGER, -- p
   1687      prime2 INTEGER, -- q
   1688      exponent1 INTEGER, -- d mod (p-1)
   1689      exponent2 INTEGER, -- d mod (q-1)
   1690      coefficient INTEGER -- (inverse of q) mod p }
   1691 
   1692    Version ::= INTEGER
   1693 
   1694    The fields of type RSAPrivateKey have the following meanings:
   1695 
   1696    -version is the version number, for compatibility with future
   1697    revisions of this document. It shall be 0 for this version of the
   1698    document.
   1699    -modulus is the modulus n.
   1700    -publicExponent is the public exponent e.
   1701    -privateExponent is the private exponent d.
   1702    -prime1 is the prime factor p of n.
   1703    -prime2 is the prime factor q of n.
   1704    -exponent1 is d mod (p-1).
   1705    -exponent2 is d mod (q-1).
   1706    -coefficient is the Chinese Remainder Theorem coefficient q-1 mod p.
   1707 
   1708 
   1709 
   1710 
   1711 Kaliski & Staddon            Informational                     [Page 30]
   1712 
   1714 RFC 2437        PKCS #1: RSA Cryptography Specifications    October 1998
   1715 
   1716 
   1717 11.2 Scheme identification
   1718 
   1719    This section defines object identifiers for the encryption and
   1720    signature schemes. The schemes compatible with PKCS #1 v1.5 have the
   1721    same definitions as in PKCS #1 v1.5. The intended application of
   1722    these definitions includes X.509 certificates and PKCS #7.
   1723 
   1724 11.2.1 Syntax for RSAES-OAEP
   1725 
   1726    The object identifier id-RSAES-OAEP identifies the RSAES-OAEP
   1727    encryption scheme.
   1728 
   1729    id-RSAES-OAEP OBJECT IDENTIFIER ::= {pkcs-1 7}
   1730 
   1731    The parameters field associated with this OID in an
   1732    AlgorithmIdentifier shall have type RSAEP-OAEP-params:
   1733 
   1734    RSAES-OAEP-params ::=  SEQUENCE {
   1735      hashFunc [0] AlgorithmIdentifier {{oaepDigestAlgorithms}}
   1736        DEFAULT sha1Identifier,
   1737      maskGenFunc [1] AlgorithmIdentifier {{pkcs1MGFAlgorithms}}
   1738        DEFAULT mgf1SHA1Identifier,
   1739      pSourceFunc [2] AlgorithmIdentifier
   1740        {{pkcs1pSourceAlgorithms}}
   1741        DEFAULT pSpecifiedEmptyIdentifier }
   1742 
   1743    The fields of type RSAES-OAEP-params have the following meanings:
   1744 
   1745    -hashFunc identifies the hash function. It shall be an algorithm ID
   1746    with an OID in the set oaepDigestAlgorithms, which for this version
   1747    shall consist of id-sha1, identifying the SHA-1 hash function. The
   1748    parameters field for id-sha1 shall have type NULL.
   1749 
   1750    oaepDigestAlgorithms ALGORITHM-IDENTIFIER ::= {
   1751      {NULL IDENTIFIED BY id-sha1} }
   1752 
   1753    id-sha1 OBJECT IDENTIFIER ::=
   1754      {iso(1) identified-organization(3) oiw(14) secsig(3)
   1755        algorithms(2) 26}
   1756 
   1757 
   1758    The default hash function is SHA-1:
   1759    sha1Identifier ::= AlgorithmIdentifier {id-sha1, NULL}
   1760 
   1761    -maskGenFunc identifies the mask generation function. It shall be an
   1762    algorithm ID with an OID in the set pkcs1MGFAlgorithms, which for
   1763    this version shall consist of id-mgf1, identifying the MGF1 mask
   1764    generation function (see Section 10.2.1). The parameters field for
   1765 
   1766 
   1767 
   1768 Kaliski & Staddon            Informational                     [Page 31]
   1769 
   1771 RFC 2437        PKCS #1: RSA Cryptography Specifications    October 1998
   1772 
   1773 
   1774    id-mgf1 shall have type AlgorithmIdentifier, identifying the hash
   1775    function on which MGF1 is based, where the OID for the hash function
   1776    shall be in the set oaepDigestAlgorithms.
   1777 
   1778    pkcs1MGFAlgorithms ALGORITHM-IDENTIFIER ::= {
   1779      {AlgorithmIdentifier {{oaepDigestAlgorithms}} IDENTIFIED
   1780        BY id-mgf1} }
   1781 
   1782    id-mgf1 OBJECT IDENTIFIER ::= {pkcs-1 8}
   1783 
   1784    The default mask generation function is MGF1 with SHA-1:
   1785 
   1786    mgf1SHA1Identifier ::= AlgorithmIdentifier {
   1787      id-mgf1, sha1Identifier }
   1788 
   1789    -pSourceFunc identifies the source (and possibly the value) of the
   1790    encoding parameters P. It shall be an algorithm ID with an OID in the
   1791    set pkcs1pSourceAlgorithms, which for this version shall consist of
   1792    id-pSpecified, indicating that the encoding parameters are specified
   1793    explicitly. The parameters field for id-pSpecified shall have type
   1794    OCTET STRING, containing the encoding parameters.
   1795 
   1796    pkcs1pSourceAlgorithms ALGORITHM-IDENTIFIER ::= {
   1797      {OCTET STRING IDENTIFIED BY id-pSpecified} }
   1798 
   1799    id-pSpecified OBJECT IDENTIFIER ::= {pkcs-1 9}
   1800 
   1801    The default encoding parameters is an empty string (so that pHash in
   1802    EME-OAEP will contain the hash of the empty string):
   1803 
   1804    pSpecifiedEmptyIdentifier ::= AlgorithmIdentifier {
   1805      id-pSpecified, OCTET STRING SIZE (0) }
   1806 
   1807    If all of the default values of the fields in RSAES-OAEP-params are
   1808    used, then the algorithm identifier will have the following value:
   1809 
   1810    RSAES-OAEP-Default-Identifier ::= AlgorithmIdentifier {
   1811      id-RSAES-OAEP,
   1812      {sha1Identifier,
   1813       mgf1SHA1Identifier,
   1814       pSpecifiedEmptyIdentifier } }
   1815 
   1816 11.2.2 Syntax for RSAES-PKCS1-v1_5
   1817 
   1818    The object identifier rsaEncryption (Section 11.1) identifies the
   1819    RSAES-PKCS1-v1_5 encryption scheme. The parameters field associated
   1820    with this OID in an AlgorithmIdentifier shall have type NULL. This is
   1821    the same as in PKCS #1 v1.5.
   1822 
   1823 
   1824 
   1825 Kaliski & Staddon            Informational                     [Page 32]
   1826 
   1828 RFC 2437        PKCS #1: RSA Cryptography Specifications    October 1998
   1829 
   1830 
   1831    RsaEncryption   OBJECT IDENTIFIER ::= {PKCS-1 1}
   1832 
   1833 11.2.3 Syntax for RSASSA-PKCS1-v1_5
   1834 
   1835    The object identifier for RSASSA-PKCS1-v1_5 shall be one of the
   1836    following. The choice of OID depends on the choice of hash algorithm:
   1837    MD2, MD5 or SHA-1. Note that if either MD2 or MD5 is used then the
   1838    OID is just as in PKCS #1 v1.5. For each OID, the parameters field
   1839    associated with this OID in an AlgorithmIdentifier shall have type
   1840    NULL.
   1841 
   1842    If the hash function to be used is MD2, then the OID should be:
   1843 
   1844    md2WithRSAEncryption ::= {PKCS-1 2}
   1845 
   1846    If the hash function to be used is MD5, then the OID should be:
   1847 
   1848    md5WithRSAEncryption ::= {PKCS-1 4}
   1849 
   1850    If the hash function to be used is SHA-1, then the OID should be:
   1851 
   1852    sha1WithRSAEncryption ::= {pkcs-1 5}
   1853 
   1854    In the digestInfo type mentioned in Section 9.2.1 the OIDS for the
   1855    digest algorithm are the following:
   1856 
   1857    id-SHA1 OBJECT IDENTIFIER ::=
   1858            {iso(1) identified-organization(3) oiw(14) secsig(3)
   1859             algorithms(2) 26 }
   1860 
   1861    md2 OBJECT IDENTIFIER ::=
   1862            {iso(1) member-body(2) US(840) rsadsi(113549)
   1863             digestAlgorithm(2) 2}
   1864 
   1865    md5 OBJECT IDENTIFIER ::=
   1866            {iso(1) member-body(2) US(840) rsadsi(113549)
   1867             digestAlgorithm(2) 5}
   1868 
   1869    The parameters field of the digest algorithm has ASN.1 type NULL for
   1870    these OIDs.
   1871 
   1872 12. Patent statement
   1873 
   1874    The Internet Standards Process as defined in RFC 1310 requires a
   1875    written statement from the Patent holder that a license will be made
   1876    available to applicants under reasonable terms and conditions prior
   1877    to approving a specification as a Proposed, Draft or Internet
   1878    Standard.
   1879 
   1880 
   1881 
   1882 Kaliski & Staddon            Informational                     [Page 33]
   1883 
   1885 RFC 2437        PKCS #1: RSA Cryptography Specifications    October 1998
   1886 
   1887 
   1888    The Internet Society, Internet Architecture Board, Internet
   1889    Engineering Steering Group and the Corporation for National Research
   1890    Initiatives take no position on the validity or scope of the
   1891    following patents and patent applications, nor on the appropriateness
   1892    of the terms of the assurance. The Internet Society and other groups
   1893    mentioned above have not made any determination as to any other
   1894    intellectual property rights which may apply to the practice of this
   1895    standard.  Any further consideration of these matters is the user's
   1896    responsibility.
   1897 
   1898 12.1 Patent statement for the RSA algorithm
   1899 
   1900    The Massachusetts Institute of Technology has granted RSA Data
   1901    Security, Inc., exclusive sub-licensing rights to the following
   1902    patent issued in the United States:
   1903 
   1904    Cryptographic Communications System and Method ("RSA"), No. 4,405,829
   1905 
   1906    RSA Data Security, Inc. has provided the following statement with
   1907    regard to this patent:
   1908 
   1909    It is RSA's business practice to make licenses to its patents
   1910    available on reasonable and nondiscriminatory terms. Accordingly, RSA
   1911    is willing, upon request, to grant non-exclusive licenses to such
   1912    patent on reasonable and non-discriminatory terms and conditions to
   1913    those who respect RSA's intellectual property rights and subject to
   1914    RSA's then current royalty rate for the patent licensed. The royalty
   1915    rate for the RSA patent is presently set at 2% of the licensee's
   1916    selling price for each product covered by the patent.  Any requests
   1917    for license information may be directed to:
   1918 
   1919             Director of Licensing
   1920             RSA Data Security, Inc.
   1921             2955 Campus Drive
   1922             Suite 400
   1923             San Mateo, CA 94403
   1924 
   1925    A license under RSA's patent(s) does not include any rights to know-
   1926    how or other technical information or license under other
   1927    intellectual property rights.  Such license does not extend to any
   1928    activities which constitute infringement or inducement thereto. A
   1929    licensee must make his own determination as to whether a license is
   1930    necessary under patents of others.
   1931 
   1932 
   1933 
   1934 
   1935 
   1936 
   1937 
   1938 
   1939 Kaliski & Staddon            Informational                     [Page 34]
   1940 
   1942 RFC 2437        PKCS #1: RSA Cryptography Specifications    October 1998
   1943 
   1944 
   1945 13. Revision history
   1946 
   1947    Versions 1.0-1.3
   1948 
   1949    Versions 1.0-1.3 were distributed to participants in RSA Data
   1950    Security, Inc.'s Public-Key Cryptography Standards meetings in
   1951    February and March 1991.
   1952 
   1953 
   1954    Version 1.4
   1955 
   1956    Version 1.4 was part of the June 3, 1991 initial public release of
   1957    PKCS. Version 1.4 was published as NIST/OSI Implementors' Workshop
   1958    document SEC-SIG-91-18.
   1959 
   1960 
   1961    Version 1.5
   1962 
   1963    Version 1.5 incorporates several editorial changes, including updates
   1964    to the references and the addition of a revision history. The
   1965    following substantive changes were made: -Section 10: "MD4 with RSA"
   1966    signature and verification processes were added.
   1967 
   1968    -Section 11: md4WithRSAEncryption object identifier was added.
   1969 
   1970    Version 2.0 [DRAFT]
   1971 
   1972    Version 2.0 incorporates major editorial changes in terms of the
   1973    document structure, and introduces the RSAEP-OAEP encryption scheme.
   1974    This version continues to support the encryption and signature
   1975    processes in version 1.5, although the hash algorithm MD4 is no
   1976    longer allowed due to cryptanalytic advances in the intervening
   1977    years.
   1978 
   1979 14. References
   1980 
   1981    [1] ANSI, ANSI X9.44: Key Management Using Reversible Public Key
   1982        Cryptography for the Financial Services Industry. Work in
   1983        Progress.
   1984 
   1985    [2] M. Bellare and P. Rogaway. Optimal Asymmetric Encryption - How to
   1986        Encrypt with RSA. In Advances in Cryptology-Eurocrypt '94, pp.
   1987        92-111, Springer-Verlag, 1994.
   1988 
   1989    [3] M. Bellare and P. Rogaway. The Exact Security of Digital
   1990        Signatures - How to Sign with RSA and Rabin. In Advances in
   1991        Cryptology-Eurocrypt '96, pp. 399-416, Springer-Verlag, 1996.
   1992 
   1993 
   1994 
   1995 
   1996 Kaliski & Staddon            Informational                     [Page 35]
   1997 
   1999 RFC 2437        PKCS #1: RSA Cryptography Specifications    October 1998
   2000 
   2001 
   2002    [4] D. Bleichenbacher. Chosen Ciphertext Attacks against Protocols
   2003        Based on the RSA Encryption Standard PKCS #1. To appear in
   2004        Advances in Cryptology-Crypto '98.
   2005 
   2006    [5] D. Bleichenbacher, B. Kaliski and J. Staddon. Recent Results on
   2007        PKCS #1: RSA Encryption Standard. RSA Laboratories' Bulletin,
   2008        Number 7, June 24, 1998.
   2009 
   2010    [6] CCITT. Recommendation X.509: The Directory-Authentication
   2011        Framework. 1988.
   2012 
   2013    [7] D. Coppersmith, M. Franklin, J. Patarin and M. Reiter. Low-
   2014        Exponent RSA with Related Messages. In Advances in Cryptology-
   2015        Eurocrypt '96, pp. 1-9, Springer-Verlag, 1996
   2016 
   2017    [8] B. Den Boer and Bosselaers. Collisions for the Compression
   2018        Function of MD5. In Advances in Cryptology-Eurocrypt '93, pp
   2019        293-304, Springer-Verlag, 1994.
   2020 
   2021    [9] B. den Boer, and A. Bosselaers. An Attack on the Last Two Rounds
   2022        of MD4. In Advances in Cryptology-Crypto '91, pp.194-203,
   2023        Springer-Verlag, 1992.
   2024 
   2025    [10] H. Dobbertin. Cryptanalysis of MD4. Fast Software Encryption.
   2026         Lecture Notes in Computer Science, Springer-Verlag 1996, pp.
   2027         55-72.
   2028 
   2029    [11] H. Dobbertin. Cryptanalysis of MD5 Compress. Presented at the
   2030         rump session of Eurocrypt `96, May 14, 1996
   2031 
   2032    [12] H. Dobbertin.The First Two Rounds of MD4 are Not One-Way. Fast
   2033         Software Encryption. Lecture Notes in Computer Science,
   2034         Springer-Verlag 1998, pp. 284-292.
   2035 
   2036    [13] J. Hastad. Solving Simultaneous Modular Equations of Low Degree.
   2037         SIAM Journal of Computing, 17, 1988, pp. 336-341.
   2038 
   2039    [14] IEEE. IEEE P1363: Standard Specifications for Public Key
   2040         Cryptography. Draft Version 4.
   2041 
   2042    [15] Kaliski, B., "The MD2 Message-Digest Algorithm", RFC 1319, April
   2043         1992.
   2044 
   2045    [16] National Institute of Standards and Technology (NIST). FIPS
   2046         Publication 180-1: Secure Hash Standard. April 1994.
   2047 
   2048    [17] Rivest, R., "The MD5 Message-Digest Algorithm", RFC 1321, April
   2049         1992.
   2050 
   2051 
   2052 
   2053 Kaliski & Staddon            Informational                     [Page 36]
   2054 
   2056 RFC 2437        PKCS #1: RSA Cryptography Specifications    October 1998
   2057 
   2058 
   2059    [18] R. Rivest, A. Shamir and L. Adleman. A Method for Obtaining
   2060         Digital Signatures and Public-Key Cryptosystems. Communications
   2061         of the ACM, 21(2), pp. 120-126, February 1978.
   2062 
   2063    [19] N. Rogier and P. Chauvaud. The Compression Function of MD2 is
   2064         not Collision Free. Presented at Selected Areas of Cryptography
   2065         `95. Carleton University, Ottawa, Canada. May 18-19, 1995.
   2066 
   2067    [20] RSA Laboratories. PKCS #1: RSA Encryption Standard. Version 1.5,
   2068         November 1993.
   2069 
   2070    [21] RSA Laboratories. PKCS #7: Cryptographic Message Syntax
   2071         Standard. Version 1.5, November 1993.
   2072 
   2073    [22] RSA  Laboratories. PKCS #8: Private-Key Information Syntax
   2074         Standard. Version 1.2, November 1993.
   2075 
   2076    [23] RSA Laboratories. PKCS #12: Personal Information Exchange Syntax
   2077         Standard. Version 1.0, Work in Progress, April 1997.
   2078 
   2079 Security Considerations
   2080 
   2081    Security issues are discussed throughout this memo.
   2082 
   2083 Acknowledgements
   2084 
   2085    This document is based on a contribution of RSA Laboratories, a
   2086    division of RSA Data Security, Inc.  Any substantial use of the text
   2087    from this document must acknowledge RSA Data Security, Inc. RSA Data
   2088    Security, Inc. requests that all material mentioning or referencing
   2089    this document identify this as "RSA Data Security, Inc. PKCS #1
   2090    v2.0".
   2091 
   2092 
   2093 
   2094 
   2095 
   2096 
   2097 
   2098 
   2099 
   2100 
   2101 
   2102 
   2103 
   2104 
   2105 
   2106 
   2107 
   2108 
   2109 
   2110 Kaliski & Staddon            Informational                     [Page 37]
   2111 
   2113 RFC 2437        PKCS #1: RSA Cryptography Specifications    October 1998
   2114 
   2115 
   2116 Authors' Addresses
   2117 
   2118    Burt Kaliski
   2119    RSA Laboratories East
   2120    20 Crosby Drive
   2121    Bedford, MA  01730
   2122 
   2123    Phone: (617) 687-7000
   2124    EMail: burt (a] rsa.com
   2125 
   2126 
   2127    Jessica Staddon
   2128    RSA Laboratories West
   2129    2955 Campus Drive
   2130    Suite 400
   2131    San Mateo, CA 94403
   2132 
   2133    Phone: (650) 295-7600
   2134    EMail: jstaddon (a] rsa.com
   2135 
   2136 
   2137 
   2138 
   2139 
   2140 
   2141 
   2142 
   2143 
   2144 
   2145 
   2146 
   2147 
   2148 
   2149 
   2150 
   2151 
   2152 
   2153 
   2154 
   2155 
   2156 
   2157 
   2158 
   2159 
   2160 
   2161 
   2162 
   2163 
   2164 
   2165 
   2166 
   2167 Kaliski & Staddon            Informational                     [Page 38]
   2168 
   2170 RFC 2437        PKCS #1: RSA Cryptography Specifications    October 1998
   2171 
   2172 
   2173 Full Copyright Statement
   2174 
   2175    Copyright (C) The Internet Society (1998).  All Rights Reserved.
   2176 
   2177    This document and translations of it may be copied and furnished to
   2178    others, and derivative works that comment on or otherwise explain it
   2179    or assist in its implementation may be prepared, copied, published
   2180    and distributed, in whole or in part, without restriction of any
   2181    kind, provided that the above copyright notice and this paragraph are
   2182    included on all such copies and derivative works.  However, this
   2183    document itself may not be modified in any way, such as by removing
   2184    the copyright notice or references to the Internet Society or other
   2185    Internet organizations, except as needed for the purpose of
   2186    developing Internet standards in which case the procedures for
   2187    copyrights defined in the Internet Standards process must be
   2188    followed, or as required to translate it into languages other than
   2189    English.
   2190 
   2191    The limited permissions granted above are perpetual and will not be
   2192    revoked by the Internet Society or its successors or assigns.
   2193 
   2194    This document and the information contained herein is provided on an
   2195    "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
   2196    TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
   2197    BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
   2198    HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
   2199    MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
   2200 
   2201 
   2202 
   2203 
   2204 
   2205 
   2206 
   2207 
   2208 
   2209 
   2210 
   2211 
   2212 
   2213 
   2214 
   2215 
   2216 
   2217 
   2218 
   2219 
   2220 
   2221 
   2222 
   2223 
   2224 Kaliski & Staddon            Informational                     [Page 39]
   2225 
   2227