OSDN Git Service

Update release for LDP 3.67
[linuxjm/LDP_man-pages.git] / release / 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 .\"
42 .\" Japanese Version Copyright (c) 1998 Hiroaki Nagoya and MAEHARA Kouichi all rights reserved.
43 .\" Translated Sun Sep 27 JST 1998 by Hiroaki Nagoya <nagoya@cc.hit-u.ac.jp> and MAEHARA Kouichi <maeharak@kw.netlaputa.ne.jp>
44 .\" Updated 2002-01-19 by Kentaro Shirakata <argrath@ub32.org>
45 .\" Updated 2007-01-01 by Kentaro Shirakata <argrath@ub32.org>
46 .\" Updated 2008-07-30 by Kentaro Shirakata <argrath@ub32.org>
47 .\" Updated 2009-09-28 by Kentaro Shirakata <argrath@ub32.org>
48 .\"
49 .TH CRYPT 3 2014\-02\-26 "" "Linux Programmer's Manual"
50 .SH 名前
51 crypt, crypt_r \- パスワードとデータの暗号化
52 .SH 書式
53 .nf
54 \fB#define _XOPEN_SOURCE\fP       /* feature_test_macros(7) 参照 */
55 .br
56 \fB#include <unistd.h>\fP
57 .sp
58 \fBchar *crypt(const char *\fP\fIkey\fP\fB, const char *\fP\fIsalt\fP\fB);\fP
59 .sp
60 \fB#define _GNU_SOURCE\fP         /* See feature_test_macros(7) */
61 .br
62 \fB#include <crypt.h>\fP
63 .sp
64 \fBchar *crypt_r(const char *\fP\fIkey\fP\fB, const char *\fP\fIsalt\fP\fB,\fP
65 \fB              struct crypt_data *\fP\fIdata\fP\fB);\fP
66 .fi
67 .sp
68 \fI\-lcrypt\fP でリンクする。
69 .SH 説明
70 \fBcrypt\fP()  はパスワード暗号化関数である。 鍵探索のハードウェアによる実装を妨げるように(その他にもいろいろ)  変更した Data
71 Encryption Standard アルゴリズムを元にしている。
72 .PP
73 \fIkey\fP はユーザが入力するパスワードである。
74 .PP
75 \fIsalt\fP は集合 [\fBa\-zA\-Z0\-9./\fP] から選ばれた 2 文字の文字列である。 この文字列はアルゴリズムの出力を 4096
76 通りにかき乱すのに使われる。
77 .PP
78 \fIkey\fP の最初の 8 文字の各文字から下位 7 ビットをとって 56 ビットの鍵が得られる。 この 56 ビットの鍵は特定の文字列(ふつうはすべて
79 0 の文字列)  を繰り返し暗号化するのに用いられる。 返り値は暗号化されたパスワードへのポインタで、13 の印字可能な ASCII 文字
80 からなる(最初の 2 文字は salt そのもの)。 返り値は、関数呼出しのたびに上書きされる静的なデータへのポインタである。
81 .PP
82 警告: 鍵空間は
83 .if  t 2\s-2\u56\s0\d
84 .if  n 2**56
85 = 7.2e16 の可能な値から成る。 この鍵空間の全探索は強力な並列計算機を使えば可能である。また \fBcrack\fP(1)
86 のようなソフトウェアはこの鍵空間の中で、多くの人にパスワードとして 使われるような鍵についての全探索が可能である。
87 それゆえ、パスワードを選択するときには、すくなくとも、 一般的に使われる単語と名前は避けるべきである。 \fBpasswd\fP(1)
88 を使う時にはクラックされうるパスワードについての検査をすることが 推奨される。
89 .PP
90 DES アルゴリズムにはいくつかの癖があり、それによってパスワード認証以外に \fBcrypt\fP()  を使うのはたいへんよくない選択となっている。もし
91 \fBcrypt\fP()  を暗号プロジェクトに使おうという案をもっているならば、それはやめたほうが よい。暗号化についてのよい本と誰でも入手できる DES
92 ライブラリのひとつを 手にいれるべきだ。
93
94 \fBcrypt_r\fP()  は \fBcrypt\fP()  の再入可能版である。 \fIdata\fP で示される構造体は結果データの保存と情報の管理に使われる。
95 この構造体に対して(メモリを割り当てること以外に)呼び出し元がするべき唯一の ことは、 \fBcrypt_r\fP()  の初回の呼び出しの前に
96 \fIdata\->initialized\fP をゼロにすることだけである。
97 .SH 返り値
98 成功の場合には、暗号化されたパスワードへのポインターが返される。 エラーの場合には NULL が返される。
99 .SH エラー
100 .TP 
101 \fBEINVAL\fP
102 \fIsalt\fP が間違ったフォーマットである。
103 .TP 
104 \fB
105 .TP 
106 \fBENOSYS\fP
107 .\" This level of detail is not necessary in this man page. . .
108 .\" .PP
109 .\" When encrypting a plain text P using DES with the key K results in the
110 .\" encrypted text C, then the complementary plain text P' being encrypted
111 .\" using the complementary key K' will result in the complementary encrypted
112 .\" text C'.
113 .\" .PP
114 .\" Weak keys are keys which stay invariant under the DES key transformation.
115 .\" The four known weak keys 0101010101010101, fefefefefefefefe,
116 .\" 1f1f1f1f0e0e0e0e and e0e0e0e0f1f1f1f1 must be avoided.
117 .\" .PP
118 .\" There are six known half weak key pairs, which keys lead to the same
119 .\" encrypted data.  Keys which are part of such key clusters should be
120 .\" avoided.
121 .\" Sorry, I could not find out what they are.
122 .\""
123 .\" .PP
124 .\" Heavily redundant data causes trouble with DES encryption, when used in the
125 .\" .I codebook
126 .\" mode that
127 .\" .BR crypt ()
128 .\" implements.  The
129 .\" .BR crypt ()
130 .\" interface should be used only for its intended purpose of password
131 .\" verification, and should not be used as part of a data encryption tool.
132 .\" .PP
133 .\" The first and last three output bits of the fourth S-box can be
134 .\" represented as function of their input bits.  Empiric studies have
135 .\" shown that S-boxes partially compute the same output for similar input.
136 .\" It is suspected that this may contain a back door which could allow the
137 .\" NSA to decrypt DES encrypted data.
138 .\" .PP
139 .\" Making encrypted data computed using crypt() publicly available has
140 .\" to be considered insecure for the given reasons.
141 \fBcrypt\fP()  関数が実装されていない。多分アメリカの輸出規制のために。
142 .TP 
143 \fBEPERM\fP
144 \fI/proc/sys/crypto/fips_enabled\fP が 0 でない値で、 DES などの弱い暗号タイプを利用しようとした。
145 .SH 属性
146 .SS "マルチスレッディング (pthreads(7) 参照)"
147 \fBcrypt\fP() 関数はスレッドセーフではない。
148 .LP
149 \fBcrypt_r\fP() 関数はスレッドセーフである。
150 .SH 準拠
151 \fBcrypt\fP(): SVr4, 4.3BSD, POSIX.1\-2001.  \fBcrypt_r\fP()  は GNU 拡張である。
152 .SH 注意
153 .SS "glibc での注意"
154 この関数の glibc2 版は追加の暗号化アルゴリズムに対応している。
155
156 もし \fIsalt\fP の文字列が "$\fIid\fP$" で始まっていて、"$" で終わっている文字列が 続いている場合:
157 .RS
158
159 $\fIid\fP$\fIsalt\fP$\fIencrypted\fP
160
161 .RE
162 DES を使う代わりに、 \fIid\fP で使用する暗号化手法を識別し、これがパスワード文字列の残りの部分を解釈する 方法を決定する。 \fIid\fP
163 の値として、以下の値に対応している:
164 .RS
165 .TS
166 l l.
167 ID  | Method
168 _
169 1   | MD5
170 2a  | Blowfish (本流の glibc には入っていない;
171     | いくつかの Linux ディストリビューションで追加されている)
172 .\" openSUSE has Blowfish, but AFAICS, this option is not supported
173 .\" natively by glibc -- mtk, Jul 08
174 .\"
175 .\" md5 | Sun MD5
176 .\" glibc doesn't appear to natively support Sun MD5; I don't know
177 .\" if any distros add the support.
178 5   | SHA\-256 (glibc 2.7 以降)
179 6   | SHA\-512 (glibc 2.7 以降)
180 .TE
181 .RE
182
183 従って、$5$\fIsalt\fP$\fIencrypted\fP は SHA\-256 でエンコードされた
184 パスワードであり、$6$\fIsalt\fP$\fIencrypted\fP は SHA\-512 で エンコードされたパスワードである。
185
186 "\fIsalt\fP" は salt における "$\fIid\fP$" に引き続く 16 文字以下の 文字列である。
187 パスワード文字列の暗号化部分は実際に計算されたパスワードである。 この文字列のサイズは固定である:
188 .TS
189 l l.
190 MD5     | 22 characters
191 SHA\-256 | 43 characters
192 SHA\-512 | 86 characters
193 .TE
194
195 "\fIsalt\fP" と "\fIencrypted\fP" の文字は [\fBa\-zA\-Z0\-9./\fP] の集合から 選ばれる。 MD5 と SHA
196 の実装では、 \fIkey\fP 全体が意味がある (DES の場合には最初の 8 文字だけに意味がある)。
197 .SH 関連項目
198 \fBlogin\fP(1), \fBpasswd\fP(1), \fBencrypt\fP(3), \fBgetpass\fP(3), \fBpasswd\fP(5)
199 .SH この文書について
200 この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.67 の一部
201 である。プロジェクトの説明とバグ報告に関する情報は
202 http://www.kernel.org/doc/man\-pages/ に書かれている。