OSDN Git Service

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