OSDN Git Service

(split) LDP: Update drafts based on LDP v3.40.
[linuxjm/LDP_man-pages.git] / draft / man3 / crypt.3
1 .\" Michael Haardt (michael@cantor.informatik.rwth.aachen.de)
2 .\"     Sat Sep  3 22:00:30 MET DST 1994
3 .\"
4 .\" This is free documentation; you can redistribute it and/or
5 .\" modify it under the terms of the GNU General Public License as
6 .\" published by the Free Software Foundation; either version 2 of
7 .\" the License, or (at your option) any later version.
8 .\"
9 .\" The GNU General Public License's references to "object code"
10 .\" and "executables" are to be interpreted as the output of any
11 .\" document formatting or typesetting system, including
12 .\" intermediate and printed output.
13 .\"
14 .\" This manual is distributed in the hope that it will be useful,
15 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
16 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 .\" GNU General Public License for more details.
18 .\"
19 .\" You should have received a copy of the GNU General Public
20 .\" License along with this manual; if not, write to the Free
21 .\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111,
22 .\" USA.
23 .\"
24 .\" Sun Feb 19 21:32:25 1995, faith@cs.unc.edu edited details away
25 .\"
26 .\" TO DO: This manual page should go more into detail how DES is perturbed,
27 .\" which string will be encrypted, and what determines the repetition factor.
28 .\" Is a simple repetition using ECB used, or something more advanced?  I hope
29 .\" the presented explanations are at least better than nothing, but by no
30 .\" means enough.
31 .\"
32 .\" added _XOPEN_SOURCE, aeb, 970705
33 .\" added GNU MD5 stuff, aeb, 011223
34 .\"
35 .\"*******************************************************************
36 .\"
37 .\" This file was generated with po4a. Translate the source file.
38 .\"
39 .\"*******************************************************************
40 .TH CRYPT 3 2011\-09\-15 "" "Linux Programmer's Manual"
41 .SH 名前
42 crypt, crypt_r \- パスワードとデータの暗号化
43 .SH 書式
44 .nf
45 \fB#define _XOPEN_SOURCE\fP       /* feature_test_macros(7) 参照 */
46 .br
47 \fB#include <unistd.h>\fP
48 .sp
49 \fBchar *crypt(const char *\fP\fIkey\fP\fB, const char *\fP\fIsalt\fP\fB);\fP
50 .sp
51 \fB#define _GNU_SOURCE\fP         /* See feature_test_macros(7) */
52 .br
53 \fB#include <crypt.h>\fP
54 .sp
55 \fBchar *crypt_r(const char *\fP\fIkey\fP\fB, const char *\fP\fIsalt\fP\fB,\fP
56 \fB              struct crypt_data *\fP\fIdata\fP\fB);\fP
57 .fi
58 .sp
59 \fI\-lcrypt\fP でリンクする。
60 .SH 説明
61 \fBcrypt\fP()  はパスワード暗号化関数である。 鍵探索のハードウェアによる実装を妨げるように(その他にもいろいろ)  変更した Data
62 Encryption Standard アルゴリズムを元にしている。
63 .PP
64 \fIkey\fP はユーザが入力するパスワードである。
65 .PP
66 \fIsalt\fP は集合 [\fBa\fP\(en\fBzA\fP\(en\fBZ0\fP\(en\fB9./\fP] から選ばれた 2 文字の文字列である。
67 この文字列はアルゴリズムの出力を 4096 通りにかき乱すのに使われる。
68 .PP
69 \fIkey\fP の最初の 8 文字の各文字から下位 7 ビットをとって 56 ビットの鍵が得られる。 この 56 ビットの鍵は特定の文字列(ふつうはすべて
70 0 の文字列)  を繰り返し暗号化するのに用いられる。 返り値は暗号化されたパスワードへのポインタで、13 の印字可能な ASCII 文字
71 からなる(最初の 2 文字は salt そのもの)。 返り値は、関数呼出しのたびに上書きされる静的なデータへのポインタである。
72 .PP
73 警告: 鍵空間は
74 .if  t 2\s-2\u56\s0\d
75 .if  n 2**56
76 = 7.2e16 の可能な値から成る。 この鍵空間の全探索は強力な並列計算機を使えば可能である。また \fBcrack\fP(1)
77 のようなソフトウェアはこの鍵空間の中で、多くの人にパスワードとして 使われるような鍵についての全探索が可能である。
78 それゆえ、パスワードを選択するときには、すくなくとも、 一般的に使われる単語と名前は避けるべきである。 \fBpasswd\fP(1)
79 を使う時にはクラックされうるパスワードについての検査をすることが 推奨される。
80 .PP
81 DES アルゴリズムにはいくつかの癖があり、それによってパスワード認証以外に \fBcrypt\fP()  を使うのはたいへんよくない選択となっている。もし
82 \fBcrypt\fP()  を暗号プロジェクトに使おうという案をもっているならば、それはやめたほうが よい。暗号化についてのよい本と誰でも入手できる DES
83 ライブラリのひとつを 手にいれるべきだ。
84
85 \fBcrypt_r\fP()  は \fBcrypt\fP()  の再入可能版である。 \fIdata\fP で示される構造体は結果データの保存と情報の管理に使われる。
86 この構造体に対して(メモリを割り当てること以外に)呼び出し元がするべき唯一の ことは、 \fBcrypt_r\fP()  の初回の呼び出しの前に
87 \fIdata\->initialized\fP をゼロにすることだけである。
88 .SH 返り値
89 成功の場合には、暗号化されたパスワードへのポインターが返される。 エラーの場合には NULL が返される。
90 .SH エラー
91 .TP 
92 \fBENOSYS\fP
93 .\" This level of detail is not necessary in this man page. . .
94 .\" .PP
95 .\" When encrypting a plain text P using DES with the key K results in the
96 .\" encrypted text C, then the complementary plain text P' being encrypted
97 .\" using the complementary key K' will result in the complementary encrypted
98 .\" text C'.
99 .\" .PP
100 .\" Weak keys are keys which stay invariant under the DES key transformation.
101 .\" The four known weak keys 0101010101010101, fefefefefefefefe,
102 .\" 1f1f1f1f0e0e0e0e and e0e0e0e0f1f1f1f1 must be avoided.
103 .\" .PP
104 .\" There are six known half weak key pairs, which keys lead to the same
105 .\" encrypted data.  Keys which are part of such key clusters should be
106 .\" avoided.
107 .\" Sorry, I could not find out what they are.
108 .\""
109 .\" .PP
110 .\" Heavily redundant data causes trouble with DES encryption, when used in the
111 .\" .I codebook
112 .\" mode that
113 .\" .BR crypt ()
114 .\" implements.  The
115 .\" .BR crypt ()
116 .\" interface should be used only for its intended purpose of password
117 .\" verification, and should not be used as part of a data encryption tool.
118 .\" .PP
119 .\" The first and last three output bits of the fourth S-box can be
120 .\" represented as function of their input bits.  Empiric studies have
121 .\" shown that S-boxes partially compute the same output for similar input.
122 .\" It is suspected that this may contain a back door which could allow the
123 .\" NSA to decrypt DES encrypted data.
124 .\" .PP
125 .\" Making encrypted data computed using crypt() publicly available has
126 .\" to be considered insecure for the given reasons.
127 \fBcrypt\fP()  関数が実装されていない。多分アメリカの輸出規制のために。
128 .SH 準拠
129 \fBcrypt\fP(): SVr4, 4.3BSD, POSIX.1\-2001.  \fBcrypt_r\fP()  は GNU 拡張である。
130 .SH 注意
131 .SS "glibc での注意"
132 この関数の glibc2 版は追加の暗号化アルゴリズムに対応している。
133
134 もし \fIsalt\fP の文字列が "$\fIid\fP$" で始まっていて、"$" で終わっている文字列が 続いている場合:
135 .RS
136
137 $\fIid\fP$\fIsalt\fP$\fIencrypted\fP
138
139 .RE
140 DES を使う代わりに、 \fIid\fP で使用する暗号化手法を識別し、これがパスワード文字列の残りの部分を解釈する 方法を決定する。 \fIid\fP
141 の値として、以下の値に対応している:
142 .RS
143 .TS
144 l l.
145 ID  | Method
146 _
147 1   | MD5
148 2a  | Blowfish (本流の glibc には入っていない;
149     | いくつかの Linux ディストリビューションで追加されている)
150 .\" openSUSE has Blowfish, but AFAICS, this option is not supported
151 .\" natively by glibc -- mtk, Jul 08
152 .\"
153 .\" md5 | Sun MD5
154 .\" glibc doesn't appear to natively support Sun MD5; I don't know
155 .\" if any distros add the support.
156 5   | SHA\-256 (glibc 2.7 以降)
157 6   | SHA\-512 (glibc 2.7 以降)
158 .TE
159 .RE
160
161 従って、$5$\fIsalt\fP$\fIencrypted\fP は SHA\-256 でエンコードされた
162 パスワードであり、$6$\fIsalt\fP$\fIencrypted\fP は SHA\-512 で エンコードされたパスワードである。
163
164 "\fIsalt\fP" は salt における "$\fIid\fP$" に引き続く 16 文字以下の 文字列である。
165 パスワード文字列の暗号化部分は実際に計算されたパスワードである。 この文字列のサイズは固定である:
166 .TS
167 l l.
168 MD5     | 22 characters
169 SHA\-256 | 43 characters
170 SHA\-512 | 86 characters
171 .TE
172
173 "\fIsalt\fP" と "\fIencrypted\fP" の文字は [\fBa\fP\(en\fBzA\fP\(en\fBZ0\fP\(en\fB9./\fP] の集合から
174 選ばれる。 MD5 と SHA の実装では、 \fIkey\fP 全体が意味がある (DES の場合には最初の 8 文字だけに意味がある)。
175 .SH 関連項目
176 \fBlogin\fP(1), \fBpasswd\fP(1), \fBencrypt\fP(3), \fBgetpass\fP(3), \fBpasswd\fP(5)
177 .SH この文書について
178 この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.40 の一部
179 である。プロジェクトの説明とバグ報告に関する情報は
180 http://www.kernel.org/doc/man\-pages/ に書かれている。