72891
openssl で rsa の鍵を適当に `test.pem` で生成して、その中身を `openssl rsa -in test.pem -text
-noout` で眺めていました。(長いので、この質問の末尾に付与します)

この中で、`prime1`, `prime2` はそれぞれ `1536 == 3072/2`bit 長の素数(以降、p, q と呼びます)、
`modulus` は `p * q` のかけ算の結果(以降、 n と呼びます)、 `public exponent` は公開鍵の exponent
であって(以降、 e と呼びます)、つまり公開鍵は `(e, n)`
なタプル、ということまでは理解できたのですが、それ以外が何を表しているのかがちょっと検討がついていないです。

`e^(-1) mod (p-1)*(q-1)` の値は、複合化の際に利用される値なので、それが `private exponent` か
`coefficient`
のどちらか、かなとは思ってはいるのですが、そうするとこれらのうちのあまりは何を表しているのか、がちょっと良く分かっていないです。また、
`exponent1`, `exponent2` も謎です。

# 質問

rsa 秘密鍵の中身データの中で、 `private exponent`, `coefficient`, `exponent1`, `exponent2`
はそれぞれ何を表しますか? これらは何の目的で利用される値でしょうか?

## `openssl rsa -in test.pem -text -noout` で得られる出力

```

    Private-Key: (3072 bit)
    modulus:
        00:bb:00:ee:01:84:e6:91:a8:81:82:aa:9f:07:ee:
        1e:39:b9:f8:11:f3:2c:d3:31:86:6e:c9:a9:d1:db:
        9f:4d:76:c2:8a:b7:fd:81:75:34:89:f7:5e:38:29:
        43:bc:21:fc:57:62:5f:20:a8:5a:80:83:7f:91:ed:
        38:9d:03:8c:84:65:ba:43:e7:13:b0:b7:d1:e7:80:
        b2:c3:fe:3f:f4:16:d0:45:5b:8c:13:67:26:23:c0:
        41:7a:13:ec:95:f2:9f:34:45:ba:be:93:a4:97:91:
        04:ab:76:26:5c:38:7a:92:57:1b:13:d2:87:d3:e8:
        52:7f:3e:d4:1d:7a:28:f8:06:2c:20:d0:8a:4d:32:
        60:f6:84:e3:64:26:49:a8:a9:31:f0:99:49:bf:e9:
        ab:57:82:ce:bf:6b:80:a4:e0:20:12:2c:05:57:0c:
        6e:1e:87:fb:38:f5:3a:f1:04:64:35:9f:7d:8d:69:
        a8:ff:5b:ca:56:69:13:b3:12:11:d6:8d:43:8a:63:
        1a:e5:79:ed:29:b8:df:36:c2:fe:f0:f1:ba:f0:56:
        4f:7e:3c:07:a1:50:43:2e:d9:9d:6a:2c:45:c3:0e:
        55:b9:7d:21:8e:75:b1:9a:81:bc:46:1f:b1:74:45:
        d1:d2:1d:f8:98:76:81:2f:5f:7d:87:8e:12:46:81:
        3d:ad:86:d3:04:e6:57:f1:72:8b:3c:1e:10:97:e7:
        f3:16:92:be:0b:99:c7:b6:be:02:16:b8:55:05:f7:
        c7:0b:0e:1c:aa:fa:dd:30:77:24:4f:0a:42:68:bb:
        8f:9e:f0:96:d4:8d:f9:59:7b:fc:9e:31:ab:43:66:
        16:c7:d1:b7:a1:6b:5f:2f:17:03:69:b8:a1:3f:49:
        5d:4b:e6:0b:fe:5d:46:33:6d:e4:10:b9:0d:d5:29:
        62:fa:c5:25:f7:c2:9b:44:99:8c:67:09:08:c3:c2:
        4a:e8:53:fd:f8:a7:84:d6:10:e4:ce:80:90:e9:6d:
        c4:9e:66:84:13:a9:70:6a:07:fb
    publicExponent: 65537 (0x10001)
    privateExponent:
        55:d5:52:69:4e:18:0a:a9:5e:70:9c:62:0c:60:c6:
        6c:d6:a8:3f:8c:ef:79:2c:95:38:ca:c5:70:b6:ae:
        c2:fe:8c:c2:e1:3a:b1:ae:1b:64:6c:2f:49:f5:de:
        ca:3e:8b:35:8c:c8:7f:13:e7:1e:6f:bd:21:3c:d2:
        2c:77:91:8a:bf:aa:a4:3a:2f:36:80:d9:0e:ba:6a:
        d3:3d:23:1b:a5:51:09:54:c0:d1:b3:19:b5:75:2c:
        58:9d:46:8d:78:e4:8c:38:a9:43:8a:3f:14:f6:92:
        3f:25:26:ec:53:5c:27:49:65:fb:4e:39:dc:11:19:
        b4:a0:20:fa:3a:b5:0d:4a:bf:fc:7b:db:cf:1d:1d:
        96:69:5e:79:fc:7c:f8:b6:58:5e:c7:ed:2a:f2:55:
        1c:00:c5:66:e5:30:11:fd:71:9b:05:ab:99:cd:f1:
        c9:7f:be:d6:e0:f0:a1:e9:d3:19:2d:d0:92:14:fa:
        65:e3:3a:d7:38:b9:bb:0a:c3:37:48:74:fb:6f:ee:
        3d:81:47:c7:bf:f9:6d:fb:8b:51:f1:a5:12:7f:80:
        0d:14:bf:5f:c5:18:e2:51:f5:53:70:b4:b2:1c:23:
        bf:7e:3b:6c:fe:d5:85:cc:c4:dd:b5:e0:e5:5c:09:
        52:9c:9e:61:a9:68:d8:43:f4:98:9f:cc:ad:4a:5f:
        7e:97:89:0b:53:8a:59:e4:39:7b:0d:60:dc:d7:9e:
        85:fb:15:1c:08:87:5f:cd:a8:7a:d4:4e:58:4c:cf:
        fb:82:fb:73:35:92:f5:dd:c1:87:d8:9f:1d:1e:a8:
        7b:34:25:1e:b2:a0:62:63:91:cb:fb:35:4c:89:d0:
        60:51:62:97:1a:27:cc:75:f1:19:b1:58:21:ac:1c:
        bd:0f:4f:f4:f0:34:cb:03:05:ba:48:77:99:c5:e0:
        0a:42:f7:ee:64:f0:41:df:3b:96:bf:5f:51:1e:12:
        5e:19:bc:f6:23:f4:7f:ab:42:b2:77:5e:9f:17:27:
        59:69:78:7e:f4:cf:fe:f8:49
    prime1:
        00:eb:48:0c:37:c0:ea:db:a9:e6:c3:7c:a3:33:b2:
        2c:70:90:50:8d:b3:22:b1:55:75:6c:5e:b7:1a:32:
        4c:d9:fa:17:42:ba:ba:2c:dc:36:ce:71:6a:f6:f3:
        a7:0e:91:f1:61:b4:94:d8:07:dd:98:2a:88:6a:5e:
        fa:4f:84:cc:1a:25:fe:b7:71:5b:60:62:85:a8:0b:
        53:98:7c:26:09:98:ef:12:d0:93:03:9f:00:8a:ee:
        72:0d:c6:8f:21:9d:0a:ce:44:ef:8b:5c:18:c5:21:
        7c:7d:1e:a5:29:55:11:7e:ec:b3:14:8c:08:f3:33:
        dc:cf:c7:b7:74:a3:ad:ca:53:b3:72:71:23:1c:ea:
        99:7d:0b:81:77:d0:82:67:26:aa:9d:ac:ec:bf:d0:
        df:63:86:61:68:c4:89:ab:ff:36:14:6a:ef:09:91:
        82:30:d7:b7:36:5c:cf:c5:c2:91:04:4d:1a:2c:64:
        66:ea:a9:4b:29:5d:a1:80:fb:ae:2e:b9:4d
    prime2:
        00:cb:78:8e:0a:76:d0:22:d8:50:c3:3a:d7:5d:72:
        8f:1e:80:f2:59:0b:2a:bc:25:ca:e1:2f:d0:d8:8c:
        e4:d8:38:b1:ef:7e:f7:ed:7d:94:0c:eb:2e:67:7a:
        d3:06:e1:7e:b3:5f:24:ab:a9:01:da:a7:33:a0:4a:
        87:47:8b:71:ea:99:c2:17:71:fe:62:5a:54:bf:75:
        ce:db:ed:c6:ca:5c:2f:fa:f9:e8:3b:37:ec:04:eb:
        17:af:9d:57:0e:99:23:08:cf:a5:28:93:76:95:d9:
        16:c1:00:e8:4c:87:fc:a0:1f:8f:17:9e:bc:65:a1:
        ca:44:46:4a:79:32:97:9e:5b:28:a7:b9:23:8b:1f:
        52:9d:9e:97:a8:b7:05:74:ee:a5:7f:68:3b:17:04:
        92:ad:43:c6:df:8c:75:a5:b8:05:17:44:a2:b5:b3:
        dd:11:a8:61:17:54:dc:a7:53:42:19:d0:c6:74:fc:
        cf:a7:62:93:7a:1d:ee:93:d3:34:66:62:67
    exponent1:
        00:a0:52:32:c9:16:f2:b2:05:be:d1:fc:2e:f4:fd:
        f6:dc:28:ea:4a:f4:02:b2:d5:a9:b2:d3:83:6f:1d:
        51:52:c2:e0:70:be:ee:37:bd:42:b7:3f:7f:84:91:
        18:87:8c:18:ef:db:ee:04:9a:af:7b:8d:97:f0:eb:
        91:22:f8:39:5f:a3:fe:42:1f:c3:05:15:7d:3f:b9:
        a0:17:ea:98:bc:b7:72:48:de:c9:1e:91:8c:fc:1e:
        68:a7:4c:62:a1:a3:f2:06:05:e1:38:93:e3:e9:07:
        dd:5d:20:b1:a8:4d:68:23:95:c4:9d:3e:a2:a6:9d:
        f3:5b:be:1a:1b:27:a1:37:99:fb:50:03:19:cb:0d:
        6c:d3:51:30:c2:64:d9:46:d2:89:35:f1:ec:4c:f4:
        56:13:ea:30:9c:04:38:4f:74:12:f4:ac:bc:ff:47:
        20:70:89:bd:35:14:df:1b:41:6e:31:81:1c:51:9d:
        84:a7:67:fe:68:4c:7d:cd:77:32:04:72:8d
    exponent2:
        7d:f9:a5:f7:d4:98:08:fa:e5:05:fa:e8:5c:73:11:
        29:51:ac:ba:74:af:80:cd:e5:4e:86:cc:47:46:f4:
        68:ea:b1:40:16:dc:69:ad:d6:7c:29:20:11:f1:79:
        b6:48:e6:a9:27:bf:0c:89:17:1c:c9:68:ad:55:77:
        6c:54:69:b3:56:7f:55:04:be:fb:25:f2:52:98:1d:
        fb:0c:bc:87:8d:8c:27:57:92:f1:17:2e:89:dd:04:
        4d:36:9d:2f:ec:a0:44:54:4b:6d:53:df:97:e7:50:
        af:2e:60:a5:01:8c:e7:96:a2:81:7d:46:27:a6:84:
        14:c1:70:5a:99:78:46:13:2a:98:ad:87:d4:1b:10:
        8b:86:25:5f:cf:f1:10:f4:b0:82:b1:85:e4:3a:70:
        95:d5:e0:cb:87:ab:4f:6f:1f:b7:c8:46:f5:38:e7:
        26:87:99:95:58:75:45:23:c7:49:34:79:aa:f4:db:
        9c:46:ec:08:2f:80:07:06:3c:eb:27:01
    coefficient:
        00:ca:ee:a7:ed:72:ee:6c:93:d6:de:2d:ed:29:3c:
        3c:2f:3a:03:e2:ec:c0:5e:30:48:65:5b:6e:5a:ec:
        90:a5:44:f6:4a:a5:13:47:e0:a9:e0:52:c9:8b:22:
        21:e6:a6:66:b8:81:74:dc:03:9b:2d:bb:71:97:53:
        72:21:8c:aa:fb:08:c1:de:33:b1:57:c2:60:ab:3e:
        8e:a2:a7:f6:bd:49:73:c9:42:50:9a:da:1f:f2:8e:
        f6:be:e2:7e:58:03:5e:a4:a2:1e:a4:c3:57:11:d1:
        b4:b0:6c:0c:eb:d7:3a:fe:7d:f9:53:6a:d7:1b:d1:
        2e:b1:dc:f0:0c:6a:6d:53:b6:e4:1f:e6:fa:d2:20:
        a4:d0:d7:18:6d:ae:b0:10:90:d7:c9:a0:c5:4c:bd:
        98:af:0c:51:b0:04:e0:ad:57:1c:c8:5a:64:42:a7:
        2f:97:92:b8:a4:12:a9:34:7b:94:65:1e:b3:19:14:
        27:fa:70:51:dd:50:7e:7b:be:41:2e:fd:8f
    
```
CC BY-SA 4.0
2020-11-09T10:21:33.480
71820
2020-12-28T05:03:00.073
754
question
アルゴリズム openssl 暗号理論 rsa
(openssl の) RSA 秘密鍵の中身はそれぞれ何を表す?
この後調べていった結果、 OpenSSL の RSA で用いられる秘密鍵は、[RFC3447](https://www.rfc-
editor.org/rfc/rfc3447)で定義されているものがそのまま利用されているようだな、と思っています。それぞれ、

```

    modulus:         n == p * q
    publicExponent:  e == 65537  (==0x10001)
    privateExponent: d == e^-1 mod LCM(p-1, q-1) ※
    prime1:          p
    prime2:          q
    exponent1:       d mod (p-1)
    exponent2:       d mod (q-1)
    coefficient:     q^(-1) mod p
    
```

の様子です。

※: LCM は最小公倍数関数。これは、つまり、
`p*q`の[カーマイケル関数](https://en.wikipedia.org/wiki/Carmichael_function)の値を計算している。
CC BY-SA 4.0
2020-12-25T15:13:55.563
72891
2020-12-28T05:03:00.073
2021-10-07T07:34:52.683
-1
754
71820
answer