Net-SSLeay-1.20 > 1.36 との差分

Net::SSLeay 1.36 と 1.20 の差分

11
22=encoding euc-jp
33
44=head1 NAME
55
66=begin original
77
8Net::SSLeay - Perl extension for using OpenSSL
8Net::SSLeay - Perl extension for using OpenSSL or SSLeay
99
1010=end original
1111
12Net::SSLeay - OpenSSL を使うための Perl 拡張
12Net::SSLeay - OpenSSLやSSLeayを使うためのPerl拡張
1313
1414=head1 SYNOPSIS
1515
16 use Net::SSLeay qw(get_https post_https sslcat make_headers make_form);
16 use Net::SSLeay, qw(get_https post_https sslcat make_headers make_form);
1717
1818 ($page) = get_https('www.bacus.pt', 443, '/'); # 1
1919
2020 ($page, $response, %reply_headers)
2121 = get_https('www.bacus.pt', 443, '/', # 2
2222 make_headers(User-Agent => 'Cryptozilla/5.0b1',
2323 Referer => 'https://www.bacus.pt'
2424 ));
2525
2626 ($page, $result, %headers) = # 2b
2727 = get_https('www.bacus.pt', 443, '/protected.html',
2828 make_headers(Authorization =>
2929 'Basic ' . MIME::Base64::encode("$user:$pass",''))
3030 );
3131
3232 ($page, $response, %reply_headers)
3333 = post_https('www.bacus.pt', 443, '/foo.cgi', '', # 3
3434 make_form(OK => '1',
3535 name => 'Sampo'
3636 ));
3737
3838 $reply = sslcat($host, $port, $request); # 4
3939
4040 ($reply, $err, $server_cert) = sslcat($host, $port, $request); # 5
4141
4242 $Net::SSLeay::trace = 2; # 0=no debugging, 1=ciphers, 2=trace, 3=dump data
4343
4444=head1 DESCRIPTION
4545
4646=begin original
4747
48There is a related module called C<Net::SSLeay::Handle> included in this
48There is a related module called Net::SSLeay::Handle included in this
4949distribution that you might want to use instead. It has its own pod
5050documentation.
5151
5252=end original
5353
54あなたが代わりに使いたいかもしれない、この配布
54あなたが代わりに使いたいかもしれない、このディストリビューション
55含まれている C<Net::SSLeay::Handle> という関連するモジュールがあります。
55含まれているNet::SSLeay::Handleという関連するモジュールがあります。
56それは、それ独自の POD ドキュメントを持っています。
56それは、それ独自のPODドキュメントを持っています。
5757
5858=begin original
5959
60This module offers some high level convenience functions for accessing
60This module offers some high level convinience functions for accessing
61web pages on SSL servers (for symmetry, the same API is offered for
61web pages on SSL servers, a sslcat() function for writing your own
62accessing http servers, too), an C<sslcat()> function for writing your own
62clients, and finally access to the SSL api of SSLeay/OpenSSL package so you
63clients, and finally access to the SSL api of the SSLeay/OpenSSL package
63can write servers or clients for more complicated applications.
64so you can write servers or clients for more complicated applications.
6564
6665=end original
6766
68このモジュールは、SSL サーバ上の Web ページにアクセスするためのいくつかの
67このモジュールは、SSLサーバ上のWebページにアクセスするためのいくつかの
69高レベルで便利な関数
68高レベルで便利な関数、独自のクライアントを書くためのsslcat()
70(対称性のために、同じ API で http サーバへのアクセスも提供します)、
69関数、そして最終的にはより複雑なアプリケーションのためにサーバーや
71独自のクライアントを書くためC<sslcat()> 関数、そして最終的には
70クライアントを書くことができるようなSSLeay/OpenSSLパッケージSSL apiへの
72より複雑なアプリケーションのためにサーバやクライアントを書くことが
73できるような SSLeay/OpenSSL パッケージの SSL api への
7471アクセスを提供します。
7572
7673=begin original
7774
78For high level functions it is most convenient to import them into your
75For high level functions it is most convinient to import them to your
7976main namespace as indicated in the synopsis.
8077
8178=end original
8279
83高レベルの関数については、概要で示したように、あなたの main 名前空間に
80高レベルの関数については、概要で示したように、あなたのmain名前空間に
8481インポートすることが、とても便利でしょう。
8582
8683=begin original
8784
88Case 1 demonstrates the typical invocation of get_https() to fetch an HTML
85Case 1 demonstrates typical invocation of get_https() to fetch an HTML
89page from secure server. The first argument provides the hostname or IP
86page from secure server. The first argument provides host name or ip
90in dotted decimal notation of the remote server to contact. The second
87in dotted decimal notation of the remote server to contact. Second
9188argument is the TCP port at the remote end (your own port is picked
9289arbitrarily from high numbered ports as usual for TCP). The third
9390argument is the URL of the page without the host name part. If in
94doubt consult the HTTP specifications at L<http://www.w3c.org>.
91doubt consult HTTP specifications at <http://www.w3c.org>
9592
9693=end original
9794
98ケース 1 はセキュアなサーバから HTML ページを取り出すための get_https()
95ケース 1はセキュアなサーバからHTMLページを取り出すためのget_https()の
99典型的な呼び出しを示しています。
96典型的な呼び出しを示しています。最初の引数は接続するリモートのサーバーの
100最初の引数は接続すリモーのサーバの
97ホスト名あいはIPをドッ区切られた数字による書き方によって与えます。
101ホスるい IP をドット区切られ数字による書き方によって与えます。
982番目の引数はリモー側のTCPポートです(なた自身のポート通常のTCPめの
1022 番目の引数はリモー側の TCP ポートです(あなた自身のポートは通常
99高く号が振られたものから勝手に選択されます)。3番目の引数はホス
103TCP の大きな番号振らたものから勝手選択されます)。
100部分を抜いページURLです。もし疑問ば、<http://www.w3c.org>ある
1043 番目引数はホスト名の部分抜いページの URL です
101HTTP仕様ってみてください
105もし疑問があれば、L<http://www.w3c.org> にある HTTP の仕様を
106あたってみてください。
107102
108103=begin original
109104
110Case 2 demonstrates full fledged use of C<get_https()>. As can be seen,
105Case 2 demonstrates full fledged use of get_https(). As can be seen,
111C<get_https()> parses the response and response headers and returns them as
106get_https() parses the response and response headers and returns them as
112107a list, which can be captured in a hash for later reference. Also a
113fourth argument to C<get_https()> is used to insert some additional headers
108fourth argument to get_https() is used to insert some additional headers
114in the request. C<make_headers()> is a function that will convert a list or
109in the request. make_headers() is a function that will convert a list or
115hash to such headers. By default C<get_https()> supplies C<Host> (to make
110hash to such headers. By default get_https() supplies Host (make virtual
116virtual hosting easy) and C<Accept> (reportedly needed by IIS) headers.
111hosting easy) and Accept (reportedly needed by IIS) headers.
117112
118113=end original
119114
120ケース 2 は、完全に一人前の C<get_https()> の使い方を示しています。
115ケース 2は、完全に一人前のget_https()の使い方を示しています。ご覧になった通り、
121ご覧になった通り
116get_https()は応答と応答のヘッダを解析しそれをリストで返しています。
122C<get_https()> は応答と応答ヘッダを解析し、それをリストで返しています。
117それらはハッシュや後者のリファレンスで捉えることができます。またget_https()の
123それらはハッシュや後者リファレンス捉えことができます。
1184番目引数は、応答の追加のヘッダを挿入すために使われます。
124また C<get_https()> の 4 番目の引数は、応答で追加のヘッダを挿入するために
119make_headers()はリストやハッシュをようなヘッダに変換する関数です。
125使われます。
120デフォルトではget_https()はHost(バーチャル・ホストを簡単に行えるように)と
126C<make_headers()> はリストやハッシュを、そようなヘッダに変換する関数です。
121Accept(IISが必要としているとこと)ヘッダを提供します。
127デフォルトでは C<get_https()> は C<Host>(バーチャルホストを簡単に
128行えるように)と C<Accept> (IIS が必要としているとのこと)ヘッダを提供します。
129122
130123=begin original
131124
132Case 2b demonstrates how to get a password protected page. Refer to
125Case 2b demonstrates how to get password protected page. Refer to
133the HTTP protocol specifications for further details (e.g. RFC-2617).
126HTTP protocol specifications for further details (e.g. RFC2617).
134127
135128=end original
136129
137ケース 2b はパスワードで保護されているページを取得する方法を示しています。
130ケース 2bはパスワードで保護されているページを取得する方法を示しています。
138更なる詳細に関しては、HTTP プロトコルの仕様を参照してください
131更なる詳細に関しては、HTTPプロトコルの仕様を参照してください。(例えばRFC2617)。
139(例えば RFC-2617)。
140132
141133=begin original
142134
143Case 3 invokes C<post_https()> to submit a HTML/CGI form to a secure
135Case 3 invokes post_https() to submit a HTML/CGI form to secure
144server. The first four arguments are equal to C<get_https()> (note that
136server. First four arguments are equal to get_https() (note that empty
145the empty string (C<''>) is passed as header argument).
137string ('') is passed as header argument). The fifth argument is the
146The fifth argument is the
147138contents of the form formatted according to CGI specification. In this
148case the helper function C<make_https()> is used to do the formatting,
139case the helper function make_https() is used to do the formatting,
149but you could pass any string. C<post_https()> automatically adds
140but you could pass any string. The post_https() automatically adds
150C<Content-Type> and C<Content-Length> headers to the request.
141Content-Type and Content-Length headers to the request.
151142
152143=end original
153144
154ケース 3 HTML/CGI フォームをセキュアなサーバで実行するために
145ケース 3はHTML/CGIフォームをセキュアなサーバで実行するためにpost_https()を
155C<post_https()> を呼び出しま
146呼び出します。最初の4つの引数はget_https()と同じで(空文字列('')が
156最初 4 つの引数は C<get_https()> 同じです (空文字列(C<''>)
147ヘッダの引数として渡されていることに注意してください)。5番目の引数は
157ヘッダ引数として渡されていること注意しください)
148CGI仕様従っ形式が整えられたフォームの内容ですこの場合、
1585 番目引数は CGI の仕様従って形式整えられフォムの内容で
149ように形式整えめにヘルパ関数make_https()が使われまが、
159場合、そのように形式を整えるためにヘルパー関数 C<make_https()> が
150のような文字列でも渡すことができます。post_https()は自動的にリクエストに
160使われますが、どのような文字列でも渡すこができます。
151Content-Type Content-Length ヘッダを付与します。
161C<post_https()> は自動的にリクエストに C<Content-Type> と C<Content-Length>
162ヘッダを付与します。
163152
164153=begin original
165154
166Case 4 shows the fundamental C<sslcat()> function (inspired in spirit by
155Case 4 shows the fundamental sslcat() function (inspired in spirit by
167the C<netcat> utility :-). It's your swiss army knife that allows you to
156netcat utility :-). Its your swiss army knife that allows you to
168157easily contact servers, send some data, and then get the response. You
169158are responsible for formatting the data and parsing the response -
170C<sslcat()> is just a transport.
159sslcat() is just a transport.
171160
172161=end original
173162
174ケース 4 は、基本的な C<sslcat()> 関数を示しています(C<netcat>
163ケース 4は、基本的なsslcat()関数を示しています(netcatユーティリティに
175ユーティリティに心を動かされました :-)。
164心を動かされました :-)。これは単純にサーバーに接続し、データを送信し、
176バに接続し、デタを送信し、
165から応答を取得することを簡単にするスイス・アナイフのような
177それから応答を取得ることを簡単にするスイスアミーナイフようのです
166もので。デ整形と応答の解析についてはあ責任です - sslcat()は
178データの整形と応答の解析についてはあなたの責任です - C<sslcat()> は
179167単に転送するだけのものです。
180168
181169=begin original
182170
183Case 5 is a full invocation of C<sslcat()> which allows the return of errors
171Case 5 is a full invocation of sslcat() which allows return of errors
184172as well as the server (peer) certificate.
185173
186174=end original
187175
188ケース 5 は、エラーだけでなくサーバ(相手側)証明書と同様も返すことを
176ケース 5は、エラーだけでなくサーバ(相手側)証明書と同様も返すことを
189可能にする、C<sslcat()> の完全な呼び出しです。
177可能にする、sslcat()の完全な呼び出しです。
190178
191179=begin original
192180
193The C<$trace> global variable can be used to control the verbosity of the
181The $trace global variable can be used to control the verbosity of high
194high level functions. Level 0 guarantees silence, level 1 (the default)
182level functions. Level 0 guarantees silence, level 1 (the default)
195183only emits error messages.
196184
197185=end original
198186
199C<$trace> グローバル変数は高レベル関数の冗長さを制御するために使うことが
187$traceグローバル変数は高レベル関数の冗長さを制御するために使うことが
200出来ます。
188出来ます。レベル0は何もいわないことを保障します。レベル1(デフォルト)は
201レベル 0 は何もいわないこと保証します。
189エラーメッセージだけ吐き出します。
202レベル 1 (デフォルト) はエラーメッセージだけを吐き出します。
203190
204191=head2 Alternate versions of the API
205192
206(API の代替)
193(APIの代替バージョン)
207194
208195=begin original
209196
210197The above mentioned functions actually return the response headers as
211198a list, which only gets converted to hash upon assignment (this
212199assignment looses information if the same header occurs twice, as may
213200be the case with cookies). There are also other variants of the
214201functions that return unprocessed headers and that return a reference
215202to a hash.
216203
217204=end original
218205
219上記の関数は実際には応答ヘッダをリストで返します。
206上記の関数は実際には応答ヘッダをリストで返します。それは代入されたハッシュに
220それは代入されたハッシュに変換されます
207変換されます(もしクッキーの場合がそうであるかもしれないように同じヘッダが
221(もしクッキー場合そうであるかもしれないように同じヘッダが
2082回発生すると、こ代入によって情報失われるかもしれません)。処理されて
2222 回発生する、こ代入によって情報が失われるかしれせん)
209いないヘッダハッシュへリファレンスを返す関数の別の形あり
223処理されていないヘッダとハッシュへのリファレンスを返す別の形の関数もあります。
224210
225211 ($page, $response, @headers) = get_https('www.bacus.pt', 443, '/');
226212 for ($i = 0; $i < $#headers; $i+=2) {
227213 print "$headers[$i] = " . $headers[$i+1] . "\n";
228214 }
215
230216 ($page, $response, $headers, $server_cert)
231217 = get_https3('www.bacus.pt', 443, '/');
232218 print "$headers\n";
233219
234220 ($page, $response, %headers_ref, $server_cert)
235221 = get_https4('www.bacus.pt', 443, '/');
236222 for $k (sort keys %{headers_ref}) {
237223 for $v (@{$headers_ref{$k}}) {
238224 print "$k = $v\n";
239225 }
240226 }
241227
242228=begin original
243229
244230All of the above code fragments accomplish the same thing: display all
245231values of all headers. The API functions ending in "3" return the
246232headers simply as a scalar string and it is up to the application to
247233split them up. The functions ending in "4" return a reference to
248a hash of arrays (see L<perlref> and L<perllol> if you are
234hash of arrays (see perlref and perllol manual pages if you are
249not familiar with complex perl data structures). To access a single value
235not familiar with complex perl data structures). To access single value
250of such a header hash you would do something like
236of such header hash you would do something like
251237
252238=end original
253239
254上記の全てのちょっとしたコードは、同じ事を実現します: ヘッダの全ての値を
240上記の全てのちょっとしたコードは、同じ事を実現します:ヘッダの全ての値を
255表示します。
241表示します。"3"で終わるAPI関数はヘッダを単なるスカラーの文字列で返します。
256"3" で終わる API 関数はヘッダを単なるスカラーの文字列で返します。
242アプリケーションがそれを分割することになります。"4"で終わる関数は
257アプリケーがそれ分割することになります
243配列のハッュへのリファレ返します(複雑なperlデータ構造体に精通して
258"4" で終わる関数は配列のハッシへのリファレンス返します(複雑
244いなければperlrefとperllolマニアル・ページご覧ください)。そのよう
259perl データ構造体精通していなければ L<perlref> と L<Lperllol>
245ヘッダ・ハッシュの1つの値アクセスするためには、以下のようにしてくださ
260マニュアルページをご覧ください)。
261そのようなヘッダハッシュの1つの値にアクセスするためには、
262以下のようにしてください:
263246
264247 print $headers_ref{COOKIE}[0];
265248
266249=begin original
267250
268Variants 3 and 4 also allow you to discover the server certificate
251The variants 3 and 4 also allow you to discover the server certificate
269252in case you would like to store or display it, e.g.
270253
271254=end original
272255
2733 4 の形は、それを格納したり表示したいときサーバ証明書を見つけることも
2563と4の形は、それを格納したり表示したいときサーバ証明書を見つけることも
274可能にします。
257可能にします。例えば
275例えば:
276258
277259 ($p, $resp, $hdrs, $server_cert) = get_https3('www.bacus.pt', 443, '/');
278260 if (!defined($server_cert) || ($server_cert == 0)) {
279261 warn "Subject Name: undefined, Issuer Name: undefined";
280262 } else {
281263 warn 'Subject Name: '
282264 . Net::SSLeay::X509_NAME_oneline(
283265 Net::SSLeay::X509_get_subject_name($server_cert))
284266 . 'Issuer Name: '
285267 . Net::SSLeay::X509_NAME_oneline(
286268 Net::SSLeay::X509_get_issuer_name($server_cert));
287269 }
288270
289271=begin original
290272
291273Beware that this method only allows after the fact verification of
292the certificate: by the time C<get_https3()> has returned the https
274the certificate: by the time get_https3() has returned the https
293275request has already been sent to the server, whether you decide to
294trust it or not. To do the verification correctly you must either
276tryst it or not. To do the verification correctly you must either
295277employ the OpenSSL certificate verification framework or use
296278the lower level API to first connect and verify the certificate
297and only then send the http data. See the implementation of C<ds_https3()>
279and only then send the http data. See implementation of ds_https3()
298280for guidance on how to do this.
299281
300282=end original
301283
302284この方法は証明書の確認の後にだけ可能になるということに注意してください:
303そのときには、あなたが信用するかどうかに関わらず、C<get_https3()>
285そのときには、あなたが信用するかどうかに関わらず、get_https3()は
304サーバに送信された https リクエストを返してしまっています。
286サーバに送信されたhttpsリクエストを返してしまっています。
305正しく確認するためには、OpenSSL 証明書確認フレームワークを採用するか、
287正しく確認するためには、OpenSSL証明書確認フレームワークを採用するか、
306最初に接続し、証明書を確認し、そのときにだけ http データを送信するため
288最初に接続し、証明書を確認し、そのときにだけhttpデータを送信するため
307低レベル API を利用するかのどちらかをする必要があります。
289低レベルAPIを利用するかのどちらかをする必要があります。この
308このやり方についてのガイ C<ds_https3()> の実装をご覧ください。
290やり方についてのガイダンスはds_https3()の実装をご覧ください。
309291
310292=head2 Using client certificates
311293
312(クライアント証明書使)
294(クライアント証明書使い方)
313295
314296=begin original
315297
316298Secure web communications are encrypted using symmetric crypto keys
317299exchanged using encryption based on the certificate of the
318300server. Therefore in all SSL connections the server must have a
319301certificate. This serves both to authenticate the server to the
320302clients and to perform the key exchange.
321303
322304=end original
323305
324セキュアな Web 通信はサーバの証明書をベースにした暗号を使って
306セキュアなWeb通信はサーバの証明書をベースにした暗号を使って
325交換された対称になった暗号鍵を使って暗号化されます。
307交換された対称になった暗号鍵を使って暗号化されます。このため
326このため全ての SSL の通信では、サーバは証明書を持っていなければなりません。
308全てのSSLの通信では、サーバは証明書を持っていなければなりません。
327これはクライアントへのサーバの認証と鍵の交換の両方を提供します。
309これはクライアントへのサーバの認証と鍵の交換の両方を提供します。
328310
329311=begin original
330312
331313Sometimes it is necessary to authenticate the client as well. Two
332options are available: HTTP basic authentication and a client side
314options are available: http basic authentication and client side
333certificate. The basic authentication over HTTPS is actually quite
315certificate. The basic authentication over https is actually quite
334safe because HTTPS guarantees that the password will not travel in
316safe because https guarantees that the password will not travel in
335the clear. Never-the-less, problems like easily guessable passwords
317clear. Never-the-less, problems like easily guessable passwords
336318remain. The client certificate method involves authentication of the
337client at the SSL level using a certificate. For this to work, both the
319client at SSL level using a certificate. For this to work, both the
338client and the server have certificates (which typically are
320client and the server will have certificates (which typically are
339321different) and private keys.
340322
341323=end original
342324
343場合によってはクライアントも認証する必要があります。
325場合によってはクライアントも認証する必要があります。2つの選択を
344二つの選択を利用できます: HTTP 基本認証とクライアント側の証明書です。
326利用することができます: http基本認証とクライアント側の証明書です。
345HTTPS がパスワードが平文で流れないことを保するので、HTTPS 越しの
327httpsがパスワードが平文で流れないことを保するので、https越しの
346基本認証は実際には非常に安全です。
328基本認証は実際には非常に安全です。しかし、そうであったとしても
347しかし、そうであったとしても簡単にわかるようなパスワードのような
329簡単にわかるようなパスワードのような問題は残ります。クライアント
348問題残ります。
330証明書の方法に証明書を使ったSSLレベルでのクライアントの認証を
349クライアント証明書の方法には証明書を使った SSL レベルでのクライアントの
331意味します。これが機能するためにはクライアントとサーバー両方が
350認証を意味します。
351これが機能するためにはクライアントとサーバの両方が
352332(典型的には異なる)証明書と秘密鍵を持つ必要があります。
353333
354334=begin original
355335
356336The API functions outlined above accept additional arguments that
357337allow one to supply the client side certificate and key files. The
358338format of these files is the same as used for server certificates and
359the caveat about encrypting private keys applies.
339the caveat about encrypting private key applies.
360340
361341=end original
362342
363上記で概説された API 関数は、クライアント側の証明書と鍵ファイルを
343上記で概説されたAPI関数は、クライアント側の証明書と鍵ファイルを
364提供することができる追加の引数を受け取ります。
344提供することができる追加の引数を受け取ります。これらのファイルの
365これらのファイルの形式はサーバ証明書で使われているものと同じです。
345形式はサーバ証明書で使われているものと同じです。そして秘密鍵の
366そして秘密鍵の暗号化に関する注意も当てはまります。
346暗号化に関する注意も当てはまります。
367347
368348 ($page, $result, %headers) = # 2c
369349 = get_https('www.bacus.pt', 443, '/protected.html',
370350 make_headers(Authorization =>
371351 'Basic ' . MIME::Base64::encode("$user:$pass",'')),
372352 '', $mime_type6, $path_to_crt7, $path_to_key8);
373353
374354 ($page, $response, %reply_headers)
375355 = post_https('www.bacus.pt', 443, '/foo.cgi', # 3b
376356 make_headers('Authorization' =>
377357 'Basic ' . MIME::Base64::encode("$user:$pass",'')),
378358 make_form(OK => '1', name => 'Sampo'),
379359 $mime_type6, $path_to_crt7, $path_to_key8);
380360
381361=begin original
382362
383Case 2c demonstrates getting a password protected page that also requires
363Case 2c demonstrates getting password protected page that also requires
384a client certificate, i.e. it is possible to use both authentication
364client certificate, i.e. it is possible to use both authentication
385365methods simultaneously.
386366
387367=end original
388368
389ケース 2c はクライアント証明書も必要とする、パスワードで保護された
369ケース 2cはクライアント証明書も必要とする、パスワードで保護された
390ページを取得することを示しています。
370ページを取得することを示しています。つまり両方の認証方法を同時に
391つまり両方の認証方法を同時に使うことも可能です。
371使うことも可能です。
392372
393373=begin original
394374
395Case 3b is a full blown POST to a secure server that requires both password
375Case 3b is full blown post to secure server that requires both password
396authentication and a client certificate, just like in case 2c.
376authentication and client certificate, just like in case 2c.
397377
398378=end original
399379
400ケース 3b は、ケース 2c とちょうど同じようにパスワード認証とクライアント
380ケース 3bは、ケース2cとちょうど同じようにパスワード認証とクライアント
401証明書の両方を必要とするセキュアなサーバへの完全に展開された POST です。
381証明書の両方を必要とするセキュアなサーバへの完全に展開された
382postです。
402383
403384=begin original
404385
405Note: The client will not send a certificate unless the server requests one.
386Note: Client will not send a certificate unless the server requests one.
406This is typically achieved by setting the verify mode to C<VERIFY_PEER> on the
387This is typically achieved by setting verify mode to VERIFY_PEER on the
407388server:
408389
409390=end original
410391
411注意: サーバが要求しなければ、クライアントは証明書を送信しません。
392注意: サーバが要求しなければ、クライアントは証明書を送信しません。
412これは典型的にはサーバで確認モードを C<VERIFY_PEER> に設定することにより
393これは典型的にはサーバで確認モードをVERIFY_PEERに設定することにより
413394実現されます:
414395
415396 Net::SSLeay::set_verify(ssl, Net::SSLeay::VERIFY_PEER, 0);
416397
417398=begin original
418399
419See C<perldoc ~openssl/doc/ssl/SSL_CTX_set_verify.pod> for a full description.
400See perldoc ~openssl/doc/ssl/SSL_CTX_set_verify.pod for full description.
420401
421402=end original
422403
423完全な説明については、C<perldoc ~openssl/doc/ssl/SSL_CTX_set_verify.pod>
404完全な説明については、perldoc ~openssl/doc/ssl/SSL_CTX_set_verify.pod をご覧ください。
424ご覧ください。
425405
426=head2 Working through a web proxy
406=head2 Working through Web proxy
427407
428(Web プロキシを通して動かす)
408(Webプロキシを通して動かす)
429409
430410=begin original
431411
432C<Net::SSLeay> can use a web proxy to make its connections. You need to
412Net::SSLeay can use a web proxy to make its connections. You need to
433first set the proxy host and port using C<set_proxy()> and then just
413first set the proxy host and port using set_proxy() and then just
434414use the normal API functions, e.g:
435415
436416=end original
437417
438C<Net::SSLeay> は接続を行うためにWebプロキシを利用することができます。
418Net::SSLeayは接続を行うためにWebプロキシを利用することができます。
439最初に C<set_proxy()> を使ってプロキシホストとポートを設定したら、
419最初にset_proxy()を使ってプロキシホストとポートを設定したら、
440後は通常のAPI関数を使うだけです。
420後は通常のAPI関数を使うだけです。例えば:
441例えば:
442421
443422 Net::SSLeay::set_proxy('gateway.myorg.com', 8080);
444423 ($page) = get_https('www.bacus.pt', 443, '/');
445424
446425=begin original
447426
448If your proxy requires authentication, you can supply a username and
427If your proxy requires authentication, you can supply username and
449428password as well
450429
451430=end original
452431
453あなたのプロキシが認証を必要とするのであれば、ユーザ名とパスワードも
432あなたのプロキシが認証を必要とするのであれば、ユーザ名とパスワードも
454433与えることができます
455434
456435 Net::SSLeay::set_proxy('gateway.myorg.com', 8080, 'joe', 'salainen');
457436 ($page, $result, %headers) =
458437 = get_https('www.bacus.pt', 443, '/protected.html',
459438 make_headers(Authorization =>
460439 'Basic ' . MIME::Base64::encode("susie:pass",''))
461440 );
462441
463442=begin original
464443
465This example demonstrates the case where we authenticate to the proxy as
444This example demonstrates case where we authenticate to the proxy as
466C<"joe"> and to the final web server as C<"susie">. Proxy authentication
445"joe" and to the final web server as "susie". Proxy authentication
467requires the C<MIME::Base64> module to work.
446requires MIME::Base64 module to work.
468447
469448=end original
470449
471この例は C<"joe"> でプロキシに、最終的なWebサーバには C<"susie"> で認証を
450この例は"joe"でプロキシに、最終的なWebサーバには"susie"で認証を
472行うケースを示しています。
451行うケースを示しています。プロキシーの認証はMIME::Base64が機能することを
473プロキシの認証は C<MIME::Base64> が機能することを必要とします。
452必要とします。
474453
475=head2 Certificate verification and Certificate Revoocation Lists (CRLs)
476
477(証明書の検証と証明書失効リスト(CRL))
478
479=begin original
480
481OpenSSL supports the ability to verify peer certificates. It can also
482optionally check the peer certificate against a Certificate Revocation
483List (CRL) from the certificates issuer. A CRL is a file, created by
484the certificate issuer that lists all the certificates that it
485previously signed, but which it now revokes. CRLs are in PEM format.
486
487=end original
488
489OpenSSL はピア証明書の検証に対応しています。
490オプションで、証明書発行者からの 証明書失効リスト (CRL) に対する
491ピア証明書のチェックもできます。
492CRL は、証明者の発行者によって作られた、以前に署名したけれども、
493今は廃止されている全ての証明書の一覧のファイルです。
494CRL は PEM 形式です。
495
496=begin original
497
498You can enable C<Net::SSLeay CRL> checking like this:
499
500=end original
501
502次のようにして C<Net::SSLeay CRL> チェックを有効にします:
503
504 &Net::SSLeay::X509_STORE_CTX_set_flags
505 (&Net::SSLeay::CTX_get_cert_store($ssl),
506 &Net::SSLeay::X509_V_FLAG_CRL_CHECK);
507
508=begin original
509
510After setting this flag, if OpenSSL checks a peer's certificate, then
511it will attempt to find a CRL for the issuer. It does this by looking
512for a specially named file in the search directory specified by
513CTX_load_verify_locations. CRL files are named with the hash of the
514issuer's subject name, followed by C<.r0>, C<.r1> etc. For example
515C<ab1331b2.r0>, C<ab1331b2.r1>. It will read all the .r files for the
516issuer, and then check for a revocation of the peer cerificate in all
517of them. (You can also force it to look in a specific named CRL
518file., see below). You can find out the hash of the issuer subject
519name in a CRL with
520
521=end original
522
523After setting this flag, if OpenSSL checks a peer's certificate, then
524it will attempt to find a CRL for the issuer. It does this by looking
525for a specially named file in the search directory specified by
526CTX_load_verify_locations. CRL files are named with the hash of the
527issuer's subject name, followed by C<.r0>, C<.r1> etc. For example
528C<ab1331b2.r0>, C<ab1331b2.r1>. It will read all the .r files for the
529issuer, and then check for a revocation of the peer cerificate in all
530of them. (You can also force it to look in a specific named CRL
531file., see below). You can find out the hash of the issuer subject
532name in a CRL with
533(TBT)
534
535 openssl crl -in crl.pem -hash -noout
536
537=begin original
538
539If the peer certificate does not pass the revocation list, or if no
540CRL is found, then the handshaking fails with an error.
541
542=end original
543
544ピア証明書が証明書失効リストを通過しなかった場合、
545あるいは CRL が見つからなかった場合、
546ハンドシェイクはエラー終了します。
547
548=begin original
549
550You can also force OpenSSL to look for CRLs in one or more arbitrarily
551named files.
552
553=end original
554
555また、任意の名前の一つまたは複数のファイルにある CRL を探させるように
556OpenSSL を強制できます。
557
558 my $bio = Net::SSLeay::BIO_new_file($crlfilename, 'r');
559 my $crl = Net::SSLeay::PEM_read_bio_X509_CRL($bio);
560 if ($crl) {
561 Net::SSLeay::X509_STORE_add_crl(Net::SSLeay::CTX_get_cert_store($ssl, $crl);
562 } else {
563 error reading CRL....
564 }
565
566454=head2 Convenience routines
567455
568456(便利なルーチン)
569457
570458=begin original
571459
572460To be used with Low level API
573461
574462=end original
575463
576低レベルで使うために:
464低レベルで使うために
577465
578466 Net::SSLeay::randomize($rn_seed_file,$additional_seed);
579467 Net::SSLeay::set_cert_and_key($ctx, $cert_path, $key_path);
580468 $cert = Net::SSLeay::dump_peer_certificate($ssl);
581469 Net::SSLeay::ssl_write_all($ssl, $message) or die "ssl write failure";
582470 $got = Net::SSLeay::ssl_read_all($ssl) or die "ssl read failure";
583471
584472 $got = Net::SSLeay::ssl_read_CRLF($ssl [, $max_length]);
585473 $got = Net::SSLeay::ssl_read_until($ssl [, $delimit [, $max_length]]);
586474 Net::SSLeay::ssl_write_CRLF($ssl, $message);
587475
588476=begin original
589477
590C<randomize()> seeds the openssl PRNG with C</dev/urandom> (see the top of C<SSLeay.pm>
478randomize() seeds the eay PRNG with /dev/urandom (see top of SSLeay.pm
591479for how to change or configure this) and optionally with user provided
592480data. It is very important to properly seed your random numbers, so
593481do not forget to call this. The high level API functions automatically
594call C<randomize()> so it is not needed with them. See also caveats.
482call randomize() so it is not needed with them. See also caveats.
595483
596484=end original
597485
598C<randomize()> C</dev/urandom> とオプションでユーザに与えられたデータで
486randomize()は/dev/urandomとオプションでユーザに与えられたデータで
599openssl PRNG に種設定し(これの変更あるいは設定のやり方については、
487eay PRNGを種付けし(これの変更あるいは設定のやり方については、
600C<SSLeay.pm> の先頭をご覧ください)
488SSLeay.pmの先頭をご覧ください適切に乱数の種付けをすることは非常に
601適切に乱数の種設定ことは非常に重要
489重要です。ですから、これ呼び出すことを忘れないください高レベルの
602ですから、これを呼び出すことを忘ないください。
490API関数は自動的にrandomize()を呼び出しま。そのためそ
603高レベルの API 関数は自動的に C<randomize()> を呼び出し
491必要ありせん。注意もご覧ください
604そのためそれらでは必要ありません。
605注意もご覧ください。
606492
607493=begin original
608494
609C<set_cert_and_key()> takes two file names as arguments and sets
495set_cert_and_key() takes two file names as arguments and sets
610496the certificate and private key to those. This can be used to
611497set either cerver certificates or client certificates.
612498
613499=end original
614500
615C<set_cert_and_key()> は引数としてつのファイル名を取り、
501set_cert_and_key()は引数として2つのファイル名を取り、
616それらを証明書と秘密鍵に設定します。
502それらを証明書と秘密鍵に設定します。これはサーバー証明書と
617これはサーバ証明書とクライアント証明書の両方に使ます。
503クライアント証明書の両方に使うことが出来ます。
618504
619505=begin original
620506
621C<dump_peer_certificate()> allows you to get a plaintext description of the
507dump_peer_certificate() allows you to get plaintext description of the
622certificate the peer (usually the server) presented to us.
508certificate the peer (usually server) presented to us.
623509
624510=end original
625511
626C<dump_peer_certificate()> は相手側(通常はサーバ)が提出した
512dump_peer_certificate()は相手側(通常はサーバ)が提出した
627513証明書の平文の説明を取得することを可能にします。
628514
629515=begin original
630516
631C<ssl_read_all()> and C<ssl_write_all()> provide true blocking semantics for
517ssl_read_all() and ssl_write_all() provide true blocking semantics for
632518these operations (see limitation, below, for explanation). These are
633519much preferred to the low level API equivalents (which implement BSD
634blocking semantics). The message argument to C<ssl_write_all()> can be
520blocking semantics). The message argument to ssl_write_all() can be
635a reference. This is helpful to avoid unnecessary copying when writing
521reference. This is helpful to avoid unnecessary copy when writing
636522something big, e.g:
637523
638524=end original
639525
640C<ssl_read_all()> C<ssl_write_all()> は、これらの処理のための
526ssl_read_all()とssl_write_all()は、これらの処理のための
641527本当のブロック化の意味論で提供します(説明については下記の制限を
642ご覧ください)。
528ご覧ください)。これらは低レベルAPIと同じものとして非常に好まれます
643これ低レベル API と同じものとして非常に好れま
529(これはBSDブロック化セマンティクを実装してます)。ssl_write_all()
644(これ BSD ブロック化セマティクを実装しています)
530へのmessage引数リファレスにすることができます。これは
645C<ssl_write_all()> へ message 引数はリファレンスにするがです。
531何か大きなもを出力するとき、不必要なコピーを避けるために便利です。
646これは何か大きなものを出力するとき、不必要なコピーを避けるために便利です。
647532例えば:
648533
649534 $data = 'A' x 1000000000;
650535 Net::SSLeay::ssl_write_all($ssl, \$data) or die "ssl write failed";
651536
652537=begin original
653538
654C<ssl_read_CRLF()> uses C<ssl_read_all()> to read in a line terminated with a
539ssl_read_CRLF() uses ssl_read_all() to read in a line terminated with a
655540carriage return followed by a linefeed (CRLF). The CRLF is included in
656541the returned scalar.
657542
658543=end original
659544
660C<ssl_read_CRLF()> C<ssl_read_all()> を使って改行が後ろについた
545ssl_read_CRLF() はssl_read_all()を使ってラインフィードが後ろについた
661復帰(CRLF)で終わる行を読み込みます。
546キャリッジ・リターン(CRLF)で終わる行を読み込みます。CRLFは返される
662CRLF は返されるスカラーに含まれます。
547スカラーに含まれます。
663548
664549=begin original
665550
666C<ssl_read_until()> uses C<ssl_read_all()> to read from the SSL input
551ssl_read_until() uses ssl_read_all() to read from the SSL input
667552stream until it encounters a programmer specified delimiter.
668If the delimiter is undefined, C<$/> is used. If C<$/> is undefined,
553If the delimiter is undefined, $/ is used. If $/ is undefined,
669C<\n> is used. One can optionally set a maximum length of bytes to read
554\n is used. One can optionally set a maximum length of bytes to read
670555from the SSL input stream.
671556
672557=end original
673558
674C<ssl_read_until()> C<ssl_read_all()> を使って SSL 入力から
559ssl_read_until() ssl_read_all()を使ってSSL入力インプットからプログラマに
675プログラマによって指定された区切り文字まで読み込みます。
560よって指定された区切り文字まで読み込みます。区切り文字が未定義であれば
676区切り文字が未定義であればC<$/> が使われます。
561$/使われます。$/が未定義であれば、\nが使われます。SSL入力ストリームからの
677C<$/> が未定義あれば、C<\n> 使われます。
562読み込む最大バイト長をオプション設定することできます。
678SSL入力ストリームからの読み込む最大バイト長をオプションで
679設定することができます。
680563
681564=begin original
682565
683C<ssl_write_CRLF()> writes C<$message> and appends CRLF to the SSL output stream.
566ssl_write_CRLF() writes $message and appends CRLF to the SSL output stream.
684567
685568=end original
686569
687C<ssl_write_CRLF()> SSL 出力ストリームに C<$message> を出力し、CRLF
570ssl_write_CRLF()はSSL出力ストリームに$messageを出力し、CRLFを追加します。
688追加します。
689571
690572=head2 Low level API
691573
692(低レベル API)
574(低レベルAPI)
693575
694576=begin original
695577
696578In addition to the high level functions outlined above, this module
697contains straight-forward access to SSL part of OpenSSL C api. Only the SSL
579contains straight forward access to SSL part of OpenSSL C api. Only the SSL
698580subpart of OpenSSL is implemented (if anyone wants to implement other
699581parts, feel free to submit patches).
700582
701583=end original
702584
703上記で説明した高レベル関数に加えて、このモジュールには OpenSSL C api
585上記で説明した高レベル関数に加えて、このモジュールにはOpenSSL C apiの
704SSL 部分にそのままアクセスすることもできます。
586SSL部分にそのままアクセスすることもできます。OpenSSLのSSLサブパートだけが
705OpenSSL の SSL サブパートだけが実装されています(他の部分も実装したければ、
587実装されています(他の部分も実装したければ、パッチを提供することをためらわない
706パッチを提供することをためらわないでください)。
588でください)。
707589
708590=begin original
709591
710See the C<ssl.h> header from OpenSSL C distribution for a list of low level
592See ssl.h header from OpenSSL C distribution for list of low lever
711SSLeay functions to call (check SSLeay.xs to see if some function has been
593SSLeay functions to call (to check if some function has been
712implemented). The module strips the initial C<"SSL_"> off of the SSLeay names. Generally you should use C<Net::SSLeay::> in its
594implemented see directly in SSLeay.xs). The module strips SSLeay names
595of the initial "SSL_", generally you should use Net::SSLeay:: in
713596place. For example:
714597
715598=end original
716599
717低レベル SSLeay 関数の呼び出し方の一覧については、OpenSSL C
600低レベルSSLeay関数の呼び出し方の一覧については、OpenSSL Cディストリビューション
718配布 C<ssl.h> ヘッダをご覧ください(関数が
601のssl.hヘッダをご覧ください(関数が実装されているかをチェックするためには、直接
719実装されているかをチェックするためには、SSLeay.xs をご覧ください)。
602SSLeay.xlをご覧ください)。このモジュールではSSLeayの名前から先頭の"SSL_"を
720このモジュールで SSLeay の名前から先頭の C<"SSL_"> はずしてい
603ずしています。一般的にはその場所にNet::SSLeayを使わなければなりせん
721一般的にはその場所に C<Net::SSLeay::> を使わなければなりません。
722604例えば:
723605
724606=begin original
725607
726608In C:
727609
728610=end original
729611
730C では:
612Cでは:
731613
732 #include <ssl.h>
614=begin original
733615
616 #include <ssl.h>
617
734618 err = SSL_set_verify (ssl, SSL_VERIFY_CLIENT_ONCE,
735619 &your_call_back_here);
620
621In perl:
736622
737=begin original
738
739In Perl:
740
741623=end original
742624
743Perl では:
625 #include <ssl.h>
626
627 err = SSL_set_verify (ssl, SSL_VERIFY_CLIENT_ONCE,
628 &your_call_back_here);
629
630perlでは:
744631
745632 use Net::SSLeay;
746633
747634 $err = Net::SSLeay::set_verify ($ssl,
748 Net::SSLeay::VERIFY_CLIENT_ONCE,
635 &Net::SSLeay::VERIFY_CLIENT_ONCE,
749636 \&your_call_back_here);
750637
751638=begin original
752639
753If the function does not start with C<SSL_> you should use the full
640If the function does not start by SSL_ you should use the full
754641function name, e.g.:
755642
756643=end original
757644
758C<SSL_> で始まらない関数では、関数名全体を使わなければなりません。
645SSL_で始まらない関数では、関数名全体を使わなければなりません。例えば:
759例えば:
760646
761 $err = Net::SSLeay::ERR_get_error;
647 $err = &Net::SSLeay::ERR_get_error;
762648
763649=begin original
764650
765The following new functions behave in perlish way:
651Following new functions behave in perlish way:
766652
767653=end original
768654
769以下の新しい関数は perl 的に振舞います:
655以下の新しい関数はperl的に振舞います:
770656
771657=begin original
772658
773659 $got = Net::SSLeay::read($ssl);
774660 # Performs SSL_read, but returns $got
775661 # resized according to data received.
776662 # Returns undef on failure.
777663
778664=end original
779665
780666 $got = Net::SSLeay::read($ssl);
781 # SSL_read を行いますが、受データに
667 # SSL_readを行いますが、受け取られたデータに
782 # 従って大きさが変更された $got を返します
668 # 従って大きさが変更された$gotを返します
783 # 失敗したときには undef を返します。
669 # 失敗したときにはundefを返します。
784670
785671=begin original
786672
787673 Net::SSLeay::write($ssl, $foo) || die;
788674 # Performs SSL_write, but automatically
789675 # figures out the size of $foo
790676
791677=end original
792678
793679 Net::SSLeay::write($ssl, $foo) || die;
794 # SSL_write を実行します。しかし自動的に
680 # SSL_writeを実行します。しかし自動的に
795 # $foo の大きさを計算します。
681 # $fooの大きさを計算します。
796682
797683=begin original
798684
799685In order to use the low level API you should start your programs with
800the following incantation:
686the following encantation:
801687
802688=end original
803689
804低レベル API を使うためには、あなたのプログラムは以下のように始まらなければ
690低レベルAPIを使うためには、あなたのプログラムは以下のように始まらなければ
805691なりません:
806692
807693=begin original
808694
809695 use Net::SSLeay qw(die_now die_if_ssl_error);
810696 Net::SSLeay::load_error_strings();
811 Net::SSLeay::SSLeay_add_ssl_algorithms(); # Important!
697 Net::SSLeay::SSLeay_add_ssl_algorithms(); # Important!
812 Net::SSLeay::ENGINE_load_builtin_engines(); # If you want built-in engines
813 Net::SSLeay::ENGINE_register_all_complete(); # If you want built-in engines
814698 Net::SSLeay::randomize();
815699
816700=end original
817701
818702 use Net::SSLeay qw(die_now die_if_ssl_error);
819703 Net::SSLeay::load_error_strings();
820 Net::SSLeay::SSLeay_add_ssl_algorithms(); # 重要!
704 Net::SSLeay::SSLeay_add_ssl_algorithms(); # 重要!
821 Net::SSLeay::ENGINE_load_builtin_engines(); # 組み込みエンジンが必要なら
822 Net::SSLeay::ENGINE_register_all_complete(); # 組み込みエンジンが必要なら
823705 Net::SSLeay::randomize();
824706
825707=begin original
826708
827C<die_now()> and C<die_if_ssl_error()> are used to conveniently print the SSLeay error stack when something goes wrong, thusly:
709die_now() and die_if_ssl_error() are used to conveniently print SSLeay error
710stack when something goes wrong, thusly:
828711
829712=end original
830713
831C<die_now()> C<die_if_ssl_error()> は、以下のように何かがおかしくなったとき
714die_now()とdie_if_ssl_error()は、以下のように何かがおかしくなったとき
832簡単に SSLeay エラースタックを出力するために使用されます:
715簡単にSSLeayエラースタックを出力するために使用されます:
833716
834 Net::SSLeay::connect($ssl) or die_now("Failed SSL connect ($!)");
717 Net::SSLeay:connect($ssl) or die_now("Failed SSL connect ($!)");
835718 Net::SSLeay::write($ssl, "foo") or die_if_ssl_error("SSL write ($!)");
836719
837720=begin original
838721
839You can also use C<Net::SSLeay::print_errs()> to dump the error stack without
722You can also use Net::SSLeay::print_errs() to dump the error stack without
840723exiting the program. As can be seen, your code becomes much more readable
841if you import the error reporting functions into your main name space.
724if you import the error reporting functions to your main name space.
842725
843726=end original
844727
845728プログラムを終了させることなくエラースタックをダンプさせるために
846C<Net::SSLeay::print_errs()> を使うことも出来ます。
729Net::SSLeay::print_errs()を使うことも出来ます。今見たように、main名前空間に
847今見たように、main 名前空間にエラー報告関数をインポートすれば、
730エラー報告関数をインポートすれば、あなたのコードは、さらにとても読みやすく
848あなたのコードは、さらにとても読みやすくなります。
731なります。
849732
850733=begin original
851734
852I can not emphasize the need to check for error enough. Use these
735I can not emphasize enough the need to check error returns. Use these
853functions even in the most simple programs, they will reduce debugging
736functions even in most simple programs, they will reduce debugging
854time greatly. Do not ask questions on the mailing list without having
737time greatly. Do not ask questions in mailing list without having
855738first sprinkled these in your code.
856739
857740=end original
858741
859742エラーの戻り値をチェックする必要性はいくら強調しても足りません。
860743非常に単純なプログラムであっても、これらの関数を使ってください。
861これらはデバッグにかかる時間を大幅に削減します。
744これらはデバッグにかかる時間を大幅に削減します。先にこれらのものを
862先にこれらのものをあなたコードのあちこちに入れることなく、
745あなたコードのあちこちに入れることなく、メーリングリストに質問しないで
863メーリングリストに質問しないでください。
746ください。
864747
865748=head2 Sockets
866749
867750(ソケット)
868751
869752=begin original
870753
871Perl uses file handles for all I/O. While SSLeay has a quite flexible BIO
754Perl uses file handles for all I/O. While SSLeay has quite flexible BIO
872mechanism and perl has an evolved PerlIO mechanism, this module still
755mechanism and perl has evolved PerlIO mechanism, this module still
873sticks to using file descriptors. Thus to attach SSLeay to a socket you
756sticks to using file descriptors. Thus to attach SSLeay to socket you
874should use C<fileno()> to extract the underlying file descriptor:
757should use fileno() to extract the underlying file descriptor:
875758
876759=end original
877760
878Perl は全ての I/O にファイルハンドルを使います。
761Perlは全てのI/Oにファイルハンドルを使います。SSLeayは非常に柔軟性のある
879SSLeay は非常に柔軟性のある BIO 機構を持っていますし、perl PerlIO 機構を
762BIO機構を持っていますし、perlはPerlIO機構を進化させていますが、
880進化させていますが、
881763このモジュールはファイル記述子を使うことにこだわっています。
882このため SSLeay をソケットにつけるためには、元になっているファイル記述子を
764このためSSLeayをソケットにつけるためには、元になっているファイル記述子を
883取り出すために C<fineno()> を使わなければなりません:
765取り出すためにfineno()を使わなければなりません:
884766
885767=begin original
886768
887769 Net::SSLeay::set_fd($ssl, fileno(S)); # Must use fileno
888770
889771=end original
890772
891 Net::SSLeay::set_fd($ssl, fileno(S)); # fineno を使わなければなりません
773 Net::SSLeay::set_fd($ssl, fileno(S)); # finenoを使わなければなりません
892774
893775=begin original
894776
895You should also set C<$|> to 1 to eliminate STDIO buffering so you do not
777You should also use "$|=1;" to eliminate STDIO buffering so you do not
896778get confused if you use perl I/O functions to manipulate your socket
897779handle.
898780
899781=end original
900782
901あなたのソケットハンドルを操作するために perl I/O 関数を使のであれば、
783あなたのソケットハンドルを操作するためにperlのI/O関数を使のであれば、
902混乱しないよう、STDIO のバッファリングを止めさせるためには、C<$|> に 1
784混乱しないよう、STDIOのバッファリングを止めさせるためには、"$|=1;"
903設定しなければなりません。
785使わなければなりません。
904786
905787=begin original
906788
907If you need to C<select(2)> on the socket, go right ahead, but be warned
789If you need to select(2) on the socket, go right ahead, but be warned
908790that OpenSSL does some internal buffering so SSL_read does not always
909return data even if the socket selected for reading (just keep on
791return data even if socket selected for reading (just keep on
910selecting and trying to read). C<Net::SSLeay> is no different from the
792selecting and trying to read). Net::SSLeay.pm is no different from the
911793C language OpenSSL in this respect.
912794
913795=end original
914796
915ソケットに C<select(2)> する必要があれば、すぐに行ってください。
797ソケットにselect(2)する必要があれば、すぐに行ってください。ただし
916ただし OpenSSL は内部バッファリングを行っていて、そのためソケットが読み込みの
798OpenSSLは内部バッファリングを行っていて、そのためソケットが読み込みの
917799ために選択されているときでも(単に選択し、読み込もうとし続けるだけ)、
918常にデータを返すわけではないことに注意してください。
800常にデータを返すわけではないことに注意してください。この点で
919この点で C<Net::SSLeay> C 言語 OpenSSL とは違います。
801Net::SSLeay.pmはC言語OpenSSLとは違います。
920802
921803=head2 Callbacks
922804
923805(コールバック)
924806
925807=begin original
926808
927You can establish a per-context verify callback function something like this:
809WARNING: as of 1.04 the callbacks have changed and have not been tested.
928810
929811=end original
930812
931以下のようなンテキスト単位の検証コールバック関数を設定できす:
813警告: 1.04で、コールバックは変更され、テストされていせん。
932814
933 sub verify {
934 my ($ok, $x509_store_ctx) = @_;
935 print "Verifying certificate...\n";
936 ...
937 return $ok;
938 }
939
940815=begin original
941816
942It is used like this:
817At this moment the implementation of verify_callback is crippeled in
818the sense that at any given time there can be only one call back which
819is shared by all SSL contexts, sessions and connections. This is
820due to having to keep the reference to the perl call back in a
821static variable so that the callback C glue can find it. To remove
822this restriction would require either a more complex data structure
823(like a hash?) in XSUB to map the call backs to their owners or,
824cleaner, adding a context pointer in the SSL structure. This context would
825then be passed to the C callback, which in our case would be the glue
826to look up the proper Perl function from the context and call it.
943827
944828=end original
945829
946これ以下よう使われます:
830今の時点で、全てコンテキスト、セッション、接続よって
831共有されている1つのコールバックしかないときにはいつでも、
832verify_callbackの実装は台無しになってしまいます。これは
833コールバックのCのグルーがそれを見つけられるように、スタティックな
834変数にperlコールバックへのリファレンスを入れておくためです。
835この制限を取り除くためには、SSL構造体でのコンテキスト・ポインタに加えて、
836その所有者とコールバックを対応付けるためにXSUBの中での、
837さらに複雑なデータ構造体(ハッシュのような?)を持つか、後始末をするものが必要です。
838そのときには、このコンテキストはコ−ルバックに渡されます。それは私たちのケースでは
839コンテキストから適切なPerl関数を探し出す、呼び出すための仲介役となります。
947840
948 Net::SSLeay::set_verify ($ssl, Net::SSLeay::VERIFY_PEER, \&verify);
949
950841=begin original
951842
952Per-context callbacks for decrypting private keys are implemented.
843---- inaccurate ----
844The verify call back looks like this in C:
953845
954846=end original
955847
956復号化するための秘密鍵のためのコンテキスト単位のコールバックは
848---- 不正確 ----
957実装されています
849verifyコールバックはCでは以下のようになります:
958850
959 Net::SSLeay::CTX_set_default_passwd_cb($ctx, sub { "top-secret" });
851 int (*callback)(int ok,X509 *subj_cert,X509 *issuer_cert,
960 Net::SSLeay::CTX_use_PrivateKey_file($ctx, "key.pem",
852 int depth,int errorcode,char *arg,STACK *cert_chain)
961 Net::SSLeay::FILETYPE_PEM)
962 or die "Error reading private key";
963 Net::SSLeay::CTX_set_default_passwd_cb($ctx, undef);
964853
965854=begin original
966855
967If Hello Extensions are supported by your OpenSSL,
856The corresponding Perl function should be something like this:
968a session secret callback can be set up to be called when a session secret is set
969by openssl.
970857
971858=end original
972859
973あなたの OpenSSL が Hello Extensions に対応しているなら、
860対応Perl関数は以下のようにものにります:
974セッションシークレットコールバックは、
975セッションシークレットが openssl によって設定されたときに
976呼び出されるように設定できます。
977861
862 sub verify {
863 my ($ok, $subj_cert, $issuer_cert, $depth, $errorcode,
864 $arg, $chain) = @_;
865 print "Verifying certificate...\n";
866 ...
867 return $ok;
868 }
869
978870=begin original
979871
980Establish it like this:
872It is used like this:
981 Net::SSLeay::set_session_secret_cb($ssl, \&session_secret_cb, $somedata);
982873
983874=end original
984875
985のようにしてこを確立します:
876こrは以下のように使われます:
986 Net::SSLeay::set_session_secret_cb($ssl, \&session_secret_cb, $somedata);
987877
878 Net::SSLeay::set_verify ($ssl, Net::SSLeay::VERIFY_PEER, \&verify);
879
988880=begin original
989881
990It will be called like this:
882Callbacks for decrypting private keys are implemented, but have the
883same limitation as the verify_callback implementation (one password
884callback shared between all contexts.) You might use it something
885like this:
991886
992887=end original
993888
994これは次ようにして呼び出されます:
889復号化するため秘密鍵のためのコールバックは実装されています。しかし
890verify_callbackの実装と同じ制限を持ちます(全てのコンテキストで
891共有されている1つのパスワード・コールバック)。以下のように使うことが
892できるでしょう:
995893
996 sub session_secret_cb
894 Net::SSLeay::CTX_set_default_passwd_cb($ctx, sub { "top-secret" });
997 {
895 Net::SSLeay::CTX_use_PrivateKey_file($ctx, "key.pem",
998 my ($secret, \@cipherlist, \$preferredcipher, $somedata) = @_;
896 Net::SSLeay::FILETYPE_PEM)
999 }
897 or die "Error reading private key";
1000898
1001899=begin original
1002900
1003901No other callbacks are implemented. You do not need to use any
1004902callback for simple (i.e. normal) cases where the SSLeay built-in
1005903verify mechanism satisfies your needs.
904---- end inaccurate ----
1006905
1007906=end original
1008907
1009その他のコールバックは実装されていません。
908その他のコールバックは実装されていません。SSLeay組込の確認機構があなたの
1010SSLeay 組み込みの確認機構があなたのニーズを満足させているところでは、
909ニーズを満足させているところでは、単純な(つまり通常の)ケースでは
1011単純な(つまり通常の)ケースでは何もコールバックを使う必要はありません。
910何もコールバックを使う必要はありません。
911---- 不正確 ここまで ----
1012912
1013913=begin original
1014914
1015It is required to reset these callbacks to undef immediately after use to prevent
1016memory leaks, thread safety problems and crashes on exit that
1017can occur if different threads set different callbacks.
1018
1019=end original
1020
1021異なるスレッドが異なるコールバックを持つ場合に起きるかもしれない
1022メモリリーク、スレッドセーフ性問題、終了時のクラッシュを防ぐために、
1023これらのコールバックは使用後直ちに未定義にリセットする必要があります。
1024
1025=begin original
1026
1027915If you want to use callback stuff, see examples/callback.pl! Its the
1028916only one I am able to make work reliably.
1029917
1030918=end original
1031919
1032コールバックを使いたければ、examples/callback.pl をご覧ください!
920コールバックを使いたければ、examples/callback.plをご覧ください!それは
1033それは私が信頼して動かすことができる唯一のものです。
921私が信頼して動かすことができる唯一のものです。
1034922
1035923=head2 X509 and RAND stuff
1036924
1037925(X509 と RAND について)
1038926
1039927=begin original
1040928
1041929This module largely lacks interface to the X509 and RAND routines, but
1042930as I was lazy and needed them, the following kludges are implemented:
1043931
1044932=end original
1045933
1046このモジュールでは X509 RAND ルーチンへのインターフェースが大きく
934このモジュールではX509とRANDルーチンへのインターフェースが大きく欠けて
1047欠けていますが、私は怠け者で、それらを必要としていました;
935いますが、私は怠け者で、それらを必要としていました。以下のものが実装
1048以下のものが実装されています:
936されています:
1049937
938=begin original
939
1050940 $x509_name = Net::SSLeay::X509_get_subject_name($x509_cert);
1051941 $x509_name = Net::SSLeay::X509_get_issuer_name($x509_cert);
1052942 print Net::SSLeay::X509_NAME_oneline($x509_name);
1053 $text = Net::SSLeay::X509_NAME_get_text_by_NID($name, $nid);
1054
1055 ($type1, $subject1, $type2, $subject2, ...) =
1056 Net::SSLeay::X509_get_subjectAltNames($x509_cert)
1057
1058 subjectAltName types as per x509v3.h GEN_*, for example
1059 GEN_DNS or GEN_IPADD which can be imported.
1060
1061=begin original
1062
1063943 Net::SSLeay::RAND_seed($buf); # Perlishly figures out buf size
1064 Net::SSLeay::RAND_bytes($buf, $num);
1065 Net::SSLeay::RAND_pseudo_bytes($buf, $num);
1066 Net::SSLeay::RAND_add($buf, $num, $entropy);
1067 Net::SSLeay::RAND_poll();
1068 Net::SSLeay::RAND_status();
1069944 Net::SSLeay::RAND_cleanup();
1070 Net::SSLeay::RAND_file_name($num);
1071945 Net::SSLeay::RAND_load_file($file_name, $how_many_bytes);
1072946 Net::SSLeay::RAND_write_file($file_name);
1073947 Net::SSLeay::RAND_egd($path);
1074 Net::SSLeay::RAND_egd_bytes($path, $bytes);
948 $text = Net::SSLeay::X509_NAME_get_text_by_NID($name, $nid);
1075949
1076950=end original
1077951
1078 Net::SSLeay::RAND_seed($buf); # Perl 的に大きさを計算します
952 $x509_name = Net::SSLeay::X509_get_subject_name($x509_cert);
1079 Net::SSLeay::RAND_bytes($buf, $num);
953 $x509_name = Net::SSLeay::X509_get_issuer_name($x509_cert);
1080 Net::SSLeay::RAND_pseudo_bytes($buf, $num);
954 print Net::SSLeay::X509_NAME_oneline($x509_name);
1081 Net::SSLeay::RAND_add($buf, $num, $entropy);
955 Net::SSLeay::RAND_seed($buf); # Perl的に大きさを計算します
1082 Net::SSLeay::RAND_poll();
1083 Net::SSLeay::RAND_status();
1084956 Net::SSLeay::RAND_cleanup();
1085 Net::SSLeay::RAND_file_name($num);
1086957 Net::SSLeay::RAND_load_file($file_name, $how_many_bytes);
1087958 Net::SSLeay::RAND_write_file($file_name);
1088959 Net::SSLeay::RAND_egd($path);
1089 Net::SSLeay::RAND_egd_bytes($path, $bytes);
960 $text = Net::SSLeay::X509_NAME_get_text_by_NID($name, $nid);
1090961
1091962=begin original
1092963
1093964Actually you should consider using the following helper functions:
1094965
1095966=end original
1096967
1097968実際には、以下のヘルパー関数を使うことを考えるべきです:
1098969
1099970 print Net::SSLeay::dump_peer_certificate($ssl);
1100971 Net::SSLeay::randomize();
1101972
1102973=head2 RSA interface
1103974
1104975(RSA インターフェース)
1105976
1106977=begin original
1107978
1108979Some RSA functions are available:
1109980
1110981=end original
1111982
1112いくつかの RSA 関数を利用できます:
983いくつかのRSA関数を利用することができます:
1113984
1114 $rsakey = Net::SSLeay::RSA_generate_key();
985$rsakey = Net::SSLeay::RSA_generate_key();
1115 Net::SSLeay::CTX_set_tmp_rsa($ctx, $rsakey);
986Net::SSLeay::CTX_set_tmp_rsa($ctx, $rsakey);
1116 Net::SSLeay::RSA_free($rsakey);
987Net::SSLeay::RSA_free($rsakey);
1117988
1118=head2 Digests
1119
1120(ダイジェスト)
1121
1122=begin original
1123
1124Some Digest functions are available if supported by the underlying
1125library. These may include MD2, MD4, MD5, and RIPEMD160:
1126
1127=end original
1128
1129基となるライブラリが対応していれば、いくつかのダイジェスト関数が
1130利用できます。
1131MD2, MD4, MD5, RIPEMD160 があります:
1132
1133 $hash = Net::SSLeay::MD5($foo);
1134 print unpack('H*', $hash);
1135
1136989=head2 BIO interface
1137990
1138991(BIO インターフェース)
1139992
1140993=begin original
1141994
1142995Some BIO functions are available:
1143996
1144997=end original
1145998
1146いくつかの BIO 関数を利用することができます:
999いくつかのBIO関数を利用することができます:
11471000
1148 Net::SSLeay::BIO_s_mem();
1001 Net::SSLeay::BIO_s_mem();
1149 $bio = Net::SSLeay::BIO_new(BIO_s_mem())
1002 $bio = Net::SSLeay::BIO_new(BIO_s_mem())
1150 $bio = Net::SSLeay::BIO_new_file($filename, $mode);
1003 $bio = Net::SSLeay::BIO_new_file($filename, $mode);
1151 Net::SSLeay::BIO_free($bio)
1004 Net::SSLeay::BIO_free($bio)
1152 $count = Net::SSLeay::BIO_write($data);
1005 $count = Net::SSLeay::BIO_write($data);
1153 $data = Net::SSLeay::BIO_read($bio);
1006 $data = Net::SSLeay::BIO_read($bio);
1154 $data = Net::SSLeay::BIO_read($bio, $maxbytes);
1007 $data = Net::SSLeay::BIO_read($bio, $maxbytes);
1155 $is_eof = Net::SSLeay::BIO_eof($bio);
1008 $is_eof = Net::SSLeay::BIO_eof($bio);
1156 $count = Net::SSLeay::BIO_pending($bio);
1009 $count = Net::SSLeay::BIO_pending($bio);
1157 $count = Net::SSLeay::BIO_wpending ($bio);
1010 $count = Net::SSLeay::BIO_wpending ($bio);
11581011
11591012=head2 Low level API
11601013
11611014(低レベル API)
11621015
11631016=begin original
11641017
11651018Some very low level API functions are available:
11661019
11671020=end original
11681021
1169いくつかの非常に低レベルの API 関数を使うことが出来ます:
1022いくつかの非常に低レベルのAPI関数を使うことが出来ます:
11701023
1171 $client_random = Net::SSLeay::get_client_random($ssl);
1024 $client_random = &Net::SSLeay::get_client_random($ssl);
1172 $server_random = Net::SSLeay::get_server_random($ssl);
1025 $server_random = &Net::SSLeay::get_server_random($ssl);
1173 $session = Net::SSLeay::get_session($ssl);
1026 $session = &Net::SSLeay::get_session($ssl);
1174 $master_key = Net::SSLeay::SESSION_get_master_key($session);
1027 $master_key = &Net::SSLeay::SESSION_get_master_key($session);
1175 Net::SSLeay::SESSION_set_master_key($session, $master_secret);
1176 $keyblocksize = Net::SSLeay::get_keyblock_size($session);
11771028
1178=head2 HTTP (without S) API
1179
1180(HTTP (S なし) API)
1181
1182=begin original
1183
1184Over the years it has become clear that it would be convenient to use
1185the light-weight flavour API of C<Net::SSLeay> for normal HTTP as well (see
1186C<LWP> for the heavy-weight object-oriented approach). In fact it would be
1187nice to be able to flip https on and off on the fly. Thus regular HTTP
1188support was evolved.
1189
1190=end original
1191
1192Over the years it has become clear that it would be convenient to use
1193the light-weight flavour API of C<Net::SSLeay> for normal HTTP as well (see
1194C<LWP> for the heavy-weight object-oriented approach).
1195In fact it would be nice to be able to flip https on and off on the fly.
1196Thus regular HTTP support was evolved.
1197(TBT)
1198
1199 use Net::SSLeay qw(get_http post_http tcpcat
1200 get_httpx post_httpx tcpxcat
1201 make_headers make_form);
1202
1203 ($page, $result, %headers) =
1204 = get_http('www.bacus.pt', 443, '/protected.html',
1205 make_headers(Authorization =>
1206 'Basic ' . MIME::Base64::encode("$user:$pass",''))
1207 );
1208
1209 ($page, $response, %reply_headers)
1210 = post_http('www.bacus.pt', 443, '/foo.cgi', '',
1211 make_form(OK => '1',
1212 name => 'Sampo'
1213 ));
1214
1215 ($reply, $err) = tcpcat($host, $port, $request);
1216
1217 ($page, $result, %headers) =
1218 = get_httpx($usessl, 'www.bacus.pt', 443, '/protected.html',
1219 make_headers(Authorization =>
1220 'Basic ' . MIME::Base64::encode("$user:$pass",''))
1221 );
1222
1223 ($page, $response, %reply_headers)
1224 = post_httpx($usessl, 'www.bacus.pt', 443, '/foo.cgi', '',
1225 make_form(OK => '1', name => 'Sampo' ));
1226
1227 ($reply, $err, $server_cert) = tcpxcat($usessl, $host, $port, $request);
1228
1229=begin original
1230
1231As can be seen, the C<"x"> family of APIs takes as the first argument a flag
1232which indicates whether SSL is used or not.
1233
1234=end original
1235
1236ここで見られるように、API の C<"x"> ファミリーは、最初の引数として、
1237SSL が使われているかどうかを示すフラグを取ります。
1238
12391029=head1 EXAMPLES
12401030
12411031=begin original
12421032
1243One very good example to look at is the implementation of C<sslcat()> in the
1033One very good example is to look at the implementation of sslcat() in the
1244C<SSLeay.pm> file.
1034SSLeay.pm file.
12451035
12461036=end original
12471037
1248つの非常に素晴らしい例は、C<SSLeay.pm> ファイルにある C<sslcat()> の実装を
10381つの非常に素晴らしい例は、SSLeay.pmファイルにあるsslcat()の実装を
12491039見ることです。
12501040
12511041=begin original
12521042
1253The following is a simple SSLeay client (with too little error checking :-(
1043Following is a simple SSLeay client (with too little error checking :-(
12541044
12551045=end original
12561046
1257(あまりにもエラーチェックが少ない :-( ) 簡単な SSLeay クライアントを以下に
1047(あまりにもエラーチェックが少ない :-()簡単なSSLeayクライアントを以下に
12581048示します:
12591049
12601050 #!/usr/local/bin/perl
12611051 use Socket;
12621052 use Net::SSLeay qw(die_now die_if_ssl_error) ;
12631053 Net::SSLeay::load_error_strings();
12641054 Net::SSLeay::SSLeay_add_ssl_algorithms();
12651055 Net::SSLeay::randomize();
12661056
12671057=begin original
12681058
12691059 ($dest_serv, $port, $msg) = @ARGV; # Read command line
12701060 $port = getservbyname ($port, 'tcp') unless $port =~ /^\d+$/;
12711061 $dest_ip = gethostbyname ($dest_serv);
12721062 $dest_serv_params = sockaddr_in($port, $dest_ip);
1063
1064 socket (S, &AF_INET, &SOCK_STREAM, 0) or die "socket: $!";
1065 connect (S, $dest_serv_params) or die "connect: $!";
1066 select (S); $| = 1; select (STDOUT); # Eliminate STDIO buffering
1067
1068 # The network connection is now open, lets fire up SSL
12731069
12741070=end original
12751071
12761072 ($dest_serv, $port, $msg) = @ARGV; # コマンドラインを読み込みます
12771073 $port = getservbyname ($port, 'tcp') unless $port =~ /^\d+$/;
12781074 $dest_ip = gethostbyname ($dest_serv);
12791075 $dest_serv_params = sockaddr_in($port, $dest_ip);
1076
1281=begin original
1282
12831077 socket (S, &AF_INET, &SOCK_STREAM, 0) or die "socket: $!";
12841078 connect (S, $dest_serv_params) or die "connect: $!";
1285 select (S); $| = 1; select (STDOUT); # Eliminate STDIO buffering
1079 select (S); $| = 1; select (STDOUT); # STDIOへのバッファリングの抑止
1080
1081 # ネットワークへの接続が今、開きました。SSLeayに火をつけましょう...
12861082
1287=end original
1288
1289 socket (S, &AF_INET, &SOCK_STREAM, 0) or die "socket: $!";
1290 connect (S, $dest_serv_params) or die "connect: $!";
1291 select (S); $| = 1; select (STDOUT); # STDIO へのバッファリングの抑止
1292
12931083=begin original
12941084
1295 # The network connection is now open, lets fire up SSL
1296
1297=end original
1298
1299 # ネットワークへの接続が今、開きました。SSLeayを起動しましょう
1300
1301=begin original
1302
13031085 $ctx = Net::SSLeay::CTX_new() or die_now("Failed to create SSL_CTX $!");
13041086 Net::SSLeay::CTX_set_options($ctx, &Net::SSLeay::OP_ALL)
13051087 and die_if_ssl_error("ssl ctx set options");
13061088 $ssl = Net::SSLeay::new($ctx) or die_now("Failed to create SSL $!");
13071089 Net::SSLeay::set_fd($ssl, fileno(S)); # Must use fileno
13081090 $res = Net::SSLeay::connect($ssl) and die_if_ssl_error("ssl connect");
13091091 print "Cipher `" . Net::SSLeay::get_cipher($ssl) . "'\n";
1092
1311=end original
1312
1313 $ctx = Net::SSLeay::CTX_new() or die_now("Failed to create SSL_CTX $!");
1314 Net::SSLeay::CTX_set_options($ctx, &Net::SSLeay::OP_ALL)
1315 and die_if_ssl_error("ssl ctx set options");
1316 $ssl = Net::SSLeay::new($ctx) or die_now("Failed to create SSL $!");
1317 Net::SSLeay::set_fd($ssl, fileno(S)); # fileno を使わなければなりません
1318 $res = Net::SSLeay::connect($ssl) and die_if_ssl_error("ssl connect");
1319 print "Cipher `" . Net::SSLeay::get_cipher($ssl) . "'\n";
1320
1321=begin original
1322
13231093 # Exchange data
1094
1325=end original
1326
1327 # データの交換
1328
1329=begin original
1330
13311095 $res = Net::SSLeay::write($ssl, $msg); # Perl knows how long $msg is
13321096 die_if_ssl_error("ssl write");
13331097 CORE::shutdown S, 1; # Half close --> No more output, sends EOF to server
13341098 $got = Net::SSLeay::read($ssl); # Perl returns undef on failure
13351099 die_if_ssl_error("ssl read");
13361100 print $got;
1101
1338=end original
1339
1340 $res = Net::SSLeay::write($ssl, $msg); # Perl は $msgの 長さがわかります
1341 die_if_ssl_error("ssl write");
1342 CORE::shutdown S, 1; # 半分クローズ --> 出力終わり、サーバに EOF を送信
1343 $got = Net::SSLeay::read($ssl); # Perl は失敗時 undef を返します
1344 die_if_ssl_error("ssl read");
1345 print $got;
1346
1347=begin original
1348
13491102 Net::SSLeay::free ($ssl); # Tear down connection
13501103 Net::SSLeay::CTX_free ($ctx);
13511104 close S;
13521105
13531106=end original
13541107
1108 $ctx = Net::SSLeay::CTX_new() or die_now("Failed to create SSL_CTX $!");
1109 Net::SSLeay::CTX_set_options($ctx, &Net::SSLeay::OP_ALL)
1110 and die_if_ssl_error("ssl ctx set options");
1111 $ssl = Net::SSLeay::new($ctx) or die_now("Failed to create SSL $!");
1112 Net::SSLeay::set_fd($ssl, fileno(S)); # filenoを使わなければなりません
1113 $res = Net::SSLeay::connect($ssl) and die_if_ssl_error("ssl connect");
1114 print "Cipher `" . Net::SSLeay::get_cipher($ssl) . "'\n";
1115
1116 # データの交換
1117
1118 $res = Net::SSLeay::write($ssl, $msg); # Perlは$msgの長さがわかります
1119 die_if_ssl_error("ssl write");
1120 CORE::shutdown S, 1; # 半分クローズ --> 出力はありません、サーバーにEOFを送信します
1121 $got = Net::SSLeay::read($ssl); # Perlは失敗するとundefを返します
1122 die_if_ssl_error("ssl read");
1123 print $got;
1124
13551125 Net::SSLeay::free ($ssl); # 接続を終了させます
13561126 Net::SSLeay::CTX_free ($ctx);
13571127 close S;
13581128
13591129=begin original
13601130
1361The following is a simple SSLeay echo server (non forking):
1131Following is a simple SSLeay echo server (non forking):
13621132
13631133=end original
13641134
1365簡単な SSLeay echo サーバ(fork なし)を以下に示します:
1135簡単なSSLeay echoサーバ(forkなし)を以下に示します:
13661136
1137=begin original
1138
13671139 #!/usr/local/bin/perl -w
13681140 use Socket;
13691141 use Net::SSLeay qw(die_now die_if_ssl_error);
13701142 Net::SSLeay::load_error_strings();
13711143 Net::SSLeay::SSLeay_add_ssl_algorithms();
13721144 Net::SSLeay::randomize();
1145
1374=begin original
1375
13761146 $our_ip = "\0\0\0\0"; # Bind to all interfaces
13771147 $port = 1235;
13781148 $sockaddr_template = 'S n a4 x8';
13791149 $our_serv_params = pack ($sockaddr_template, &AF_INET, $port, $our_ip);
13801150
13811151=end original
13821152
1153 #!/usr/local/bin/perl -w
1154 use Socket;
1155 use Net::SSLeay qw(die_now die_if_ssl_error);
1156 Net::SSLeay::load_error_strings();
1157 Net::SSLeay::SSLeay_add_ssl_algorithms();
1158 Net::SSLeay::randomize();
1159
13831160 $our_ip = "\0\0\0\0"; # 全てのインターフェースにバインド
13841161 $port = 1235;
13851162 $sockaddr_template = 'S n a4 x8';
13861163 $our_serv_params = pack ($sockaddr_template, &AF_INET, $port, $our_ip);
13871164
13881165 socket (S, &AF_INET, &SOCK_STREAM, 0) or die "socket: $!";
13891166 bind (S, $our_serv_params) or die "bind: $!";
13901167 listen (S, 5) or die "listen: $!";
13911168 $ctx = Net::SSLeay::CTX_new () or die_now("CTX_new ($ctx): $!");
13921169 Net::SSLeay::CTX_set_options($ctx, &Net::SSLeay::OP_ALL)
13931170 and die_if_ssl_error("ssl ctx set options");
13941171
1395=begin original
1396
13971172 # Following will ask password unless private key is not encrypted
13981173 Net::SSLeay::CTX_use_RSAPrivateKey_file ($ctx, 'plain-rsa.pem',
13991174 &Net::SSLeay::FILETYPE_PEM);
14001175 die_if_ssl_error("private key");
14011176 Net::SSLeay::CTX_use_certificate_file ($ctx, 'plain-cert.pem',
14021177 &Net::SSLeay::FILETYPE_PEM);
14031178 die_if_ssl_error("certificate");
1179
1180 while (1) {
1181 print "Accepting connections...\n";
1182 ($addr = accept (NS, S)) or die "accept: $!";
1183 select (NS); $| = 1; select (STDOUT); # Piping hot!
1184
1185 ($af,$client_port,$client_ip) = unpack($sockaddr_template,$addr);
1186 @inetaddr = unpack('C4',$client_ip);
1187 print "$af connection from " .
1188 join ('.', @inetaddr) . ":$client_port\n";
1189
1190 # We now have a network connection, lets fire up SSLeay...
14041191
1192=begin original
1193
1194 $ssl = Net::SSLeay::new($ctx) or die_now("SSL_new ($ssl): $!");
1195 Net::SSLeay::set_fd($ssl, fileno(NS));
1196
1197 $err = Net::SSLeay::accept($ssl) and die_if_ssl_error('ssl accept');
1198 print "Cipher `" . Net::SSLeay::get_cipher($ssl) . "'\n";
1199
1200 # Connected. Exchange some data.
1201
1202 $got = Net::SSLeay::read($ssl); # Returns undef on fail
1203 die_if_ssl_error("ssl read");
1204 print "Got `$got' (" . length ($got) . " chars)\n";
1205
1206 Net::SSLeay::write ($ssl, uc ($got)) or die "write: $!";
1207 die_if_ssl_error("ssl write");
1208
1209 Net::SSLeay::free ($ssl); # Tear down connection
1210 close NS;
1211 }
1212
14051213=end original
14061214
1407 # 以下の行は秘密鍵が暗号化なければ、パスワードを尋ねます
1215 # 以下の行は秘密鍵が暗号化されてないということがなければ、パスワードを尋ねます
14081216 Net::SSLeay::CTX_use_RSAPrivateKey_file ($ctx, 'plain-rsa.pem',
14091217 &Net::SSLeay::FILETYPE_PEM);
14101218 die_if_ssl_error("private key");
14111219 Net::SSLeay::CTX_use_certificate_file ($ctx, 'plain-cert.pem',
14121220 &Net::SSLeay::FILETYPE_PEM);
14131221 die_if_ssl_error("certificate");
1222
1415=begin original
1416
14171223 while (1) {
14181224 print "Accepting connections...\n";
14191225 ($addr = accept (NS, S)) or die "accept: $!";
1420 select (NS); $| = 1; select (STDOUT); # Piping hot!
1421
1422=end original
1423
1424 while (1) {
1425 print "Accepting connections...\n";
1426 ($addr = accept (NS, S)) or die "accept: $!";
14271226 select (NS); $| = 1; select (STDOUT); # パイプがホット!
1227
14291228 ($af,$client_port,$client_ip) = unpack($sockaddr_template,$addr);
14301229 @inetaddr = unpack('C4',$client_ip);
14311230 print "$af connection from " .
14321231 join ('.', @inetaddr) . ":$client_port\n";
1232
1233 # これでネットワーク接続を持っています、SSLeayに火をつけましょう...
14331234
1434=begin original
1435
1436 # We now have a network connection, lets fire up SSLeay...
1437
1438=end original
1439
1440 # これでネットワーク接続を持っています、SSLeay を起動しましょう...
1441
14421235 $ssl = Net::SSLeay::new($ctx) or die_now("SSL_new ($ssl): $!");
14431236 Net::SSLeay::set_fd($ssl, fileno(NS));
1237
14451238 $err = Net::SSLeay::accept($ssl) and die_if_ssl_error('ssl accept');
14461239 print "Cipher `" . Net::SSLeay::get_cipher($ssl) . "'\n";
1240
1448=begin original
1449
1450 # Connected. Exchange some data.
1451
1452=end original
1453
14541241 # 接続しました。データを交換しましょう。
1242
1456=begin original
1243 $got = Net::SSLeay::read($ssl); # 失敗したときにはundefを返します
1457
1458 $got = Net::SSLeay::read($ssl); # Returns undef on fail
14591244 die_if_ssl_error("ssl read");
14601245 print "Got `$got' (" . length ($got) . " chars)\n";
1246
1462=end original
1463
1464 $got = Net::SSLeay::read($ssl); # 失敗時は undef を返します
1465 die_if_ssl_error("ssl read");
1466 print "Got `$got' (" . length ($got) . " chars)\n";
1467
14681247 Net::SSLeay::write ($ssl, uc ($got)) or die "write: $!";
14691248 die_if_ssl_error("ssl write");
1249
1471=begin original
1472
1473 Net::SSLeay::free ($ssl); # Tear down connection
1474 close NS;
1475 }
1476
1477=end original
1478
14791250 Net::SSLeay::free ($ssl); # 接続を終了させます
14801251 close NS;
14811252 }
14821253
14831254=begin original
14841255
1485Yet another echo server. This one runs from C</etc/inetd.conf> so it avoids
1256Yet another echo server. This one runs from /etc/inetd.conf so it avoids
1486all the socket code overhead. Only caveat is opening an rsa key file -
1257all the socket code overhead. Only caveat is opening rsa key file -
14871258it had better be without any encryption or else it will not know where
1488to ask for the password. Note how C<STDIN> and C<STDOUT> are wired to SSL.
1259to ask for the password. Note how STDIN and STDOUT are wired to SSL.
14891260
14901261=end original
14911262
1492echo サーバをもうつ。
1263echoサーバをもう1。今度のものは/etc/inetd.confから走ります
1493今度は C</etc/inetd.conf> から走ります。
1264ためソケット・コードオーバーヘッドを全て回避します。唯一の注意は、
1494そのためソケットコードのオーバーヘッド全て回避します。
1265rsa鍵ファイル開くことです - 暗号化をないほうがよりうまくいきます。
1495唯一の注意は、rsa 鍵ファイル開くす - 暗号化をしな
1266そうでなければパスワードこで聞けばいのかわかりません。どのよ
1496よりうまくいきます
1267STDINとSTDOUTがSSLにつながれるかに注意してださい。
1497そうでなければパスワードをどこで聞けばいいのかわかりません。
1498どのように C<STDIN> と C<STDOUT> が SSL につながれるかに注意してください。
14991268
15001269 #!/usr/local/bin/perl
15011270 # /etc/inetd.conf
15021271 # ssltst stream tcp nowait root /path/to/server.pl server.pl
15031272 # /etc/services
15041273 # ssltst 1234/tcp
15051274
15061275 use Net::SSLeay qw(die_now die_if_ssl_error);
15071276 Net::SSLeay::load_error_strings();
15081277 Net::SSLeay::SSLeay_add_ssl_algorithms();
15091278 Net::SSLeay::randomize();
15101279
15111280=begin original
15121281
15131282 chdir '/key/dir' or die "chdir: $!";
15141283 $| = 1; # Piping hot!
15151284 open LOG, ">>/dev/console" or die "Can't open log file $!";
15161285 select LOG; print "server.pl started\n";
1286
1287 $ctx = Net::SSLeay::CTX_new() or die_now "CTX_new ($ctx) ($!)";
1288 $ssl = Net::SSLeay::new($ctx) or die_now "new ($ssl) ($!)";
1289 Net::SSLeay::set_options($ssl, &Net::SSLeay::OP_ALL)
1290 and die_if_ssl_error("ssl set options");
15171291
15181292=end original
15191293
15201294 chdir '/key/dir' or die "chdir: $!";
15211295 $| = 1; # パイプがホット!
15221296 open LOG, ">>/dev/console" or die "Can't open log file $!";
15231297 select LOG; print "server.pl started\n";
15241298
15251299 $ctx = Net::SSLeay::CTX_new() or die_now "CTX_new ($ctx) ($!)";
15261300 $ssl = Net::SSLeay::new($ctx) or die_now "new ($ssl) ($!)";
15271301 Net::SSLeay::set_options($ssl, &Net::SSLeay::OP_ALL)
15281302 and die_if_ssl_error("ssl set options");
15291303
1530 $ctx = Net::SSLeay::CTX_new() or die_now "CTX_new ($ctx) ($!)";
1531 $ssl = Net::SSLeay::new($ctx) or die_now "new ($ssl) ($!)";
1532 Net::SSLeay::set_options($ssl, &Net::SSLeay::OP_ALL)
1533 and die_if_ssl_error("ssl set options");
1534
15351304=begin original
15361305
15371306 # We get already open network connection from inetd, now we just
15381307 # need to attach SSLeay to STDIN and STDOUT
15391308 Net::SSLeay::set_rfd($ssl, fileno(STDIN));
15401309 Net::SSLeay::set_wfd($ssl, fileno(STDOUT));
15411310
15421311=end original
15431312
1544 # inetd からネットワーク接続は既にオープンしてあるので、
1313 # inetdからネットワーク接続は既にオープンしてあるので、
1545 # STDIN STDOUT SSLeay をつける必要があるだけです
1314 # STDINとSTDOUTにSSLeayをつける必要があるだけです
15461315 Net::SSLeay::set_rfd($ssl, fileno(STDIN));
15471316 Net::SSLeay::set_wfd($ssl, fileno(STDOUT));
15481317
15491318 Net::SSLeay::use_RSAPrivateKey_file ($ssl, 'plain-rsa.pem',
1550 Net::SSLeay::FILETYPE_PEM);
1319 &Net::SSLeay::FILETYPE_PEM);
15511320 die_if_ssl_error("private key");
15521321 Net::SSLeay::use_certificate_file ($ssl, 'plain-cert.pem',
1553 Net::SSLeay::FILETYPE_PEM);
1322 &Net::SSLeay::FILETYPE_PEM);
15541323 die_if_ssl_error("certificate");
15551324
15561325 Net::SSLeay::accept($ssl) and die_if_ssl_err("ssl accept: $!");
15571326 print "Cipher `" . Net::SSLeay::get_cipher($ssl) . "'\n";
1327
15591328 $got = Net::SSLeay::read($ssl);
15601329 die_if_ssl_error("ssl read");
15611330 print "Got `$got' (" . length ($got) . " chars)\n";
15621331
15631332 Net::SSLeay::write ($ssl, uc($got)) or die "write: $!";
15641333 die_if_ssl_error("ssl write");
15651334
15661335=begin original
15671336
15681337 Net::SSLeay::free ($ssl); # Tear down the connection
15691338 Net::SSLeay::CTX_free ($ctx);
15701339 close LOG;
15711340
15721341=end original
15731342
15741343 Net::SSLeay::free ($ssl); # 接続を終わらせます
15751344 Net::SSLeay::CTX_free ($ctx);
15761345 close LOG;
15771346
15781347=begin original
15791348
15801349There are also a number of example/test programs in the examples directory:
15811350
15821351=end original
15831352
1584examples ディレクトリにも例/テストプログラムがたくさん入っています:
1353examplesディレクトリにも例/テストプログラムがたくさん入っています:
15851354
15861355=begin original
15871356
15881357 sslecho.pl - A simple server, not unlike the one above
15891358 minicli.pl - Implements a client using low level SSLeay routines
15901359 sslcat.pl - Demonstrates using high level sslcat utility function
15911360 get_page.pl - Is a utility for getting html pages from secure servers
15921361 callback.pl - Demonstrates certificate verification and callback usage
15931362 stdio_bulk.pl - Does SSL over Unix pipes
15941363 ssl-inetd-serv.pl - SSL server that can be invoked from inetd.conf
15951364 httpd-proxy-snif.pl - Utility that allows you to see how a browser
15961365 sends https request to given server and what reply
15971366 it gets back (very educative :-)
15981367 makecert.pl - Creates a self signed cert (does not use this module)
15991368
16001369=end original
16011370
1602 sslecho.pl - 上記のものと違わない簡単なサーバ
1371 sslecho.pl - 上記のものと違わない簡単なサーバ
1603 minicli.pl - 低レベル SSLeay ルーチンを使ったクライアントを実装
1372 minicli.pl - 低レベルSSLeayルーチンを使ったクライアントを実装しています
1604 sslcat.pl - 高レベル sslcat ユーティリティ関数の使い方の例
1373 sslcat.pl - 高レベルsslcatユーティリティ関数の使い方を示しています
1605 get_page.pl - セキュアなサーバから HTML ページを取り出すためのユーティリティ
1374 get_page.pl - セキュアなサーバからHTMLページを取り出すためのユーティリティ
1606 callback.pl - 証明書の確認とコールバックの使い方の例
1375 callback.pl - 証明書の確認とコールバックの使い方を示しています
1607 stdio_bulk.pl - Unix パイプ越しに SSL を行
1376 stdio_bulk.pl - Unixパイプ越しにSSLを行います
1608 ssl-inetd-serv.pl - inetd.conf から呼び出 SSL サーバ
1377 ssl-inetd-serv.pl - inetd.confから呼び出すことができるSSLサーバ
1609 httpd-proxy-snif.pl - ブラウザがサーバにどのように https リクエストを送信するのか、
1378 httpd-proxy-snif.pl - ブラウザが与えられたどのようにhttpsリクエストを送信するのか、
1610 そして応答として何を受け取ったのかを見えるようにする
1379 そして応答として何を受け取ったのかを見えるようにするユーティリティ
1611 ユーティリティ (とっても教育的 :-)
1380 (とっても教育的 :-)
1612 makecert.pl - 自分で署名した証明書を作成(このモジュールを使いません)
1381 makecert.pl - 自分で署名した証明書を作成します(このモジュールを使いません)
16131382
16141383=head1 LIMITATIONS
16151384
16161385(制約)
16171386
16181387=begin original
16191388
1620C<Net::SSLeay::read()> uses an internal buffer of 32KB, thus no single read
1389Net::SSLeay::read uses internal buffer of 32KB, thus no single read
16211390will return more. In practice one read returns much less, usually
16221391as much as fits in one network packet. To work around this,
16231392you should use a loop like this:
16241393
16251394=end original
16261395
1627C<Net::SSLeay::read()> 32KB の内部バッファを利用しています。
1396Net::SSLeay::readは32KBの内部バッファを利用しています。そのため1回の読み込みは、それ以上、
1628そのため 1 回の読み込みは、それ以上、多く返すことはありません。
1397多く返すことはありません。実際、通常通り1つのネットワーク・パケットに収まっているかぎり、
1629実際通常通一つのネットワークパケットに収まっている
13981回の読み込みはこれよ少なく返します。これを回避するためには以下のように
16301 回の読み込みは、これよりもかなり少なく返します。
1631これを回避するためには以下のように
16321399ループを使わなければなりません:
16331400
16341401 $reply = '';
16351402 while ($got = Net::SSLeay::read($ssl)) {
1636 last if print_errs('SSL_read');
1403 last if print_errs('SSL_read');
1637 $reply .= $got;
1404 $reply .= $got;
16381405 }
16391406
16401407=begin original
16411408
1642Although there is no built-in limit in C<Net::SSLeay::write()>, the network
1409Although there is no built-in limit in Net::SSLeay::write, the network
16431410packet size limitation applies here as well, thus use:
16441411
16451412=end original
16461413
1647C<Net::SSLeay::write()> には組み込まれた制約はありませんが、
1414Net::SSLeay::writeには組み込まれた制約はありませんが、ネットワーク・パケット
1648ネットワークパケットサイズの制限は、ここでも当てはまります。
1415サイズの制限は、ここでも当てはまります。そこで以下のようにしてください:
1649そこで以下のようにしてください:
16501416
16511417 $written = 0;
16521418
16531419 while ($written < length($message)) {
1654 $written += Net::SSLeay::write($ssl, substr($message, $written));
1420 $written += Net::SSLeay::write($ssl, substr($message, $written));
1655 last if print_errs('SSL_write');
1421 last if print_errs('SSL_write');
16561422 }
16571423
16581424=begin original
16591425
1660Or alternatively you can just use the following convenience functions:
1426Or alternatively you can just use the following convinence functions:
16611427
16621428=end original
16631429
16641430あるいは、代わりに単に以下の便利な関数を使うことも出来ます:
16651431
16661432 Net::SSLeay::ssl_write_all($ssl, $message) or die "ssl write failure";
16671433 $got = Net::SSLeay::ssl_read_all($ssl) or die "ssl read failure";
16681434
16691435=head1 KNOWN BUGS AND CAVEATS
16701436
16711437(既知のバグと注意)
16721438
16731439=begin original
16741440
1675Autoloader emits a
1441Autoloader emits
16761442
16771443=end original
16781444
1679Autoloader は:
1445die_if_ssl_errorがautoload可能であると、Autoloader 以下の警告を吐き出します
16801446
16811447 Argument "xxx" isn't numeric in entersub at blib/lib/Net/SSLeay.pm'
16821448
16831449=begin original
16841450
16851451warning if die_if_ssl_error is made autoloadable. If you figure out why,
16861452drop me a line.
16871453
16881454=end original
16891455
1690die_if_ssl_error が autoload 可能であると、このの警告を吐き出します。
16911456なぜだかわかったら、私に連絡してください。
16921457
16931458=begin original
16941459
1695Callback set using C<SSL_set_verify()> does not appear to work. This may
1460Callback set using SSL_set_verify() does not appear to work. This may
1696well be an openssl problem (e.g. see C<ssl/ssl_lib.c> line 1029). Try using
1461well be eay problem (e.g. see ssl/ssl_lib.c line 1029). Try using
1697C<SSL_CTX_set_verify()> instead and do not be surprised if even this stops
1462SSL_CTX_set_verify() instead and do not be surprised if even this stops
16981463working in future versions.
16991464
17001465=end original
17011466
1702C<SSL_set_verify()> を使って設定されたコールバックが動かないようです。
1467SSL_set_verify()を使って設定されたコールバックが動かないようです。
1703これは openssl の問題かもしれません(例えば C<ssl/ssl_lib.c> 1029 行を
1468これはeayの問題かもしれません(例えばssl/ssl_lib.cの1029行をご覧ください)。
1704ご覧ください)
1469代わりにSSL_CTX_set_verify()を使ってみてください。そして将来のバージョンで
1705代わり C<SSL_CTX_set_verify()> を使ってみてください。
1470これが動かないようっても驚かないでください。
1706そして将来のバージョンでこれが動かないようになっても驚かないでください。
17071471
17081472=begin original
17091473
17101474Callback and certificate verification stuff is generally too little tested.
17111475
17121476=end original
17131477
1714コールバックと証明書の確認に関しては、一般的に余りにもほとんどテストされて
1478コールバックと証明書の確認に関しては、一般的に余りにも少ししかテストされて
17151479いません。
17161480
17171481=begin original
17181482
17191483Random numbers are not initialized randomly enough, especially if you
1720do not have C</dev/random> and/or C</dev/urandom> (such as in Solaris
1484do not have /dev/random and/or /dev/urandom (such as in Solaris
1721platforms - but I've been suggested that cryptorand daemon from the SUNski
1485platforms - but I've been suggested that cryptorand daemon from SUNski
17221486package solves this). In this case you should investigate third party
17231487software that can emulate these devices, e.g. by way of a named pipe
17241488to some program.
17251489
17261490=end original
17271491
1728(Solaris プラットホームのように - かし私SUNski パッケージからの
1492特に/dev/random て/あるい/dev/urandom を持っていなければ、
1729cryptorand デモンが、これを解決するとい提案を受けたことがあります)
1493(Solarisプラットホムのよに - しかし私はSUNskiパッケージからの
1730特に C</dev/random> や C</dev/urandom> 持ってれば、
1494cryptorandデーモンが、これ解決するとう提案を受たことがあります)
1731乱数は十分にランダムに初期化されません。
1495乱数は十分にランダムに初期化されません。この場合、これらのデバイスを
1732この場合、これらのデバイスをエミュレートすることができる
1496エミュレートすることができるサード・パーティのソフトウェア、例えば
1733サードパーティのソフトウェア、例えばあるプログラムへの
1497あるプログラムへの名前付きパイプによる方法などを調査する必要があります。
1734名前付きパイプによる方法などを調査する必要があります。
17351498
17361499=begin original
17371500
17381501Another gotcha with random number initialization is randomness
17391502depletion. This phenomenon, which has been extensively discussed in
17401503OpenSSL, Apache-SSL, and Apache-mod_ssl forums, can cause your
1741script to block if you use C</dev/random> or to operate insecurely
1504script to block if you use /dev/random or to operate insecurely
1742if you use C</dev/urandom>. What happens is that when too much
1505if you use /dev/urandom. What happens is that when too much
17431506randomness is drawn from the operating system's randomness pool
1744then randomness can temporarily be unavailable. C</dev/random> solves
1507then randomness can temporarily be unavailable. /dev/random solves
17451508this problem by waiting until enough randomness can be gathered - and
17461509this can take a long time since blocking reduces activity in the
17471510machine and less activity provides less random events: a vicious circle.
1748C</dev/urandom> solves this dilemma more pragmatically by simply returning
1511/dev/urandom solves this dilemma more pragmatically by simply returning
1749predictable "random" numbers. SomeC< /dev/urandom> emulation software
1512predictable "random" numbers. Some /dev/urandom emulation software
1750however actually seems to implement C</dev/random> semantics. Caveat emptor.
1513however actually seems to implement /dev/random semantics. Caveat emptor.
17511514
17521515=end original
17531516
1754乱数の初期化に関して、もうつわかっていることは乱数が枯渇することです。
1517乱数の初期化に関して、もう1つわかっていることは乱数が枯渇することです。
1755OpenSSL、Apache-SSL、そして Apache-mod_ssl フォーラムで
1518OpenSSL、Apache-SSL、そしてApache-mod_sslフォーラムで
1756広く議論されていますが、この現象は、C</dev/random> を使うならば、あなたの
1519広く議論されていますが、この現象は、/dev/randomを使うならば、あなたの
1757スクリプトをブロックすることを、あるいは C</dev/urandom> を使うならば、
1520スクリプトをブロックすることを、あるいは/dev/urandomを使うならば、
17581521セキュアでなく操作することを引き起こすかもしれません。
17591522発生していることは、あまりにも多くの乱数がシステムの乱数プールから
17601523引っ張られたとき、乱数が一時的に利用不能になることがあります。
1761C</dev/random> はこの問題は、十分な乱数が集められるまで待つことにより
1524/dev/randomはこの問題は、十分な乱数が集められるまで待つことにより解決
1762解決します - そしてこれには長い時間がかかることがあります。
1525します - そしてこれには長い時間がかかることがあります。ブロックすること
1763ブロックすることがマシンでの活動を減らしてしまい、活動が少なくなると
1526がマシンでの活動を減らしてしまい、活動が少なくなると乱数イベントも
1764乱数イベントも少なくなるためです:悪循環です。
1527少なくなるためです:悪循環です。/dev/urandomは、このジレンマをより
1765C</dev/urandom> は、このジレンマをより実用的に簡単に予測できる
1528実用的に簡単に予測できる"ランダムな"数を返すことにより解決します。
1766"ランダムな"数を返すことにより解決ます。
1529かしながら、いくつかの/dev/urandomエミュレーション・ソフトウェアは
1767しかしながら、いくつかの C</dev/urandom> エミュレーショソフトウェアは
1530実際には/dev/randomのセマティクを実装しているようです。
1768実際には C</dev/random> の意味論を実装しているようです。
17691531利用者はご注意を(Caveat emptor)。
17701532
17711533=begin original
17721534
17731535I've been pointed to two such daemons by Mik Firestone <mik@@speed.stdio._com>
1774who has used them on Solaris 8:
1536who has used them on Solaris 8
17751537
17761538=end original
17771539
1778私は Solaris 8 でそれらを使っている
1540私はSolaris 8でそれらを使っているMik Firestone <mik@@speed.stdio._com>から、
1779Mik Firestone <mik@@speed.stdio._com> から、
1541そのような2つのデーモンを指摘されました。
1780そのような二つのデーモンを指摘されました:
17811542
1782=over
1543 1. Entropy Gathering Daemon (EGD) at http://www.lothar.com/tech/crypto/
1544 2. Pseudo-random number generating daemon (PRNGD) at
1545 http://www.aet.tu-cottbus.de/personen/jaenicke/postfix_tls/prngd.html
17831546
1784=item 1
1785
1786L<http://www.lothar.com/tech/crypto/> の
1787Entropy Gathering Daemon (EGD)
1788
1789=item 2
1790
1791L<http://www.aet.tu-cottbus.de/personen/jaenicke/postfix_tls/prngd.html> の
1792Pseudo-random number generating daemon (PRNGD)
1793
1794=back
1795
17961547=begin original
17971548
17981549If you are using the low level API functions to communicate with other
17991550SSL implementations, you would do well to call
18001551
18011552=end original
18021553
1803他の SSL 実装と通信するために低レベル API 関数を使っているのであれば、
1554他のSSL実装と通信するために低レベルAPI関数を使っているのであれば、
1804以下のようにして、他のいくるかの SSL 実装での、よく知られているバグをうまく
1555以下のようにして、他のいくるかのSSL実装での、よく知られているバグをうまく
1805処理するよう、以下のように呼び出すとうまくいきます:
1556処理するよう、以下のように呼び出すとうまくいきます
18061557
18071558 Net::SSLeay::CTX_set_options($ctx, &Net::SSLeay::OP_ALL)
18081559 and die_if_ssl_error("ssl ctx set options");
18091560
18101561=begin original
18111562
18121563to cope with some well know bugs in some other SSL
18131564implementations. The high level API functions always set all known
18141565compatibility options.
18151566
18161567=end original
18171568
1818高レベル API 関数は常に全てのわかっている互換性オプションを設定します。
1569高レベルAPI関数は常に全てのわかっている互換性オプションを設定します。
18191570
18201571=begin original
18211572
1822Sometimes C<sslcat()> (and the high level HTTPS functions that build on it)
1573Sometimes sslcat (and the high level https functions that build on it)
1823is too fast in signaling the EOF to legacy HTTPS servers. This causes
1574is too fast in signaling the EOF to legacy https servers. This causes
18241575the server to return empty page. To work around this problem you can
1825set the global variable
1576set global variable
18261577
18271578=end original
18281579
1829時折、C<sslcat()> (そしてそれを基に構築された高レベル HTTPS 関数)が、
1580時折、sslcat(そしてそれを基に構築された高レベルhttps関数)が、
1830レガシーな HTTPS サーバに EOF の合図を出すのが速すぎることがあります。
1581レガシーなhttpsサーバにEOFの合図を出すのが速すぎることがあります。
1831これによりサーバが空のページを返してしまいます。
1582これによりサーバが空のページを返してしまいます。この問題を回避する
1832この問題を回避するためには、グローバル変数を設定することができます
1583ためには、グローバル変数を設定することができます
18331584
18341585=begin original
18351586
18361587 $Net::SSLeay::slowly = 1; # Add sleep so broken servers can keep up
18371588
18381589=end original
18391590
1840 $Net::SSLeay::slowly = 1; # 壊れたサーバでも保持できるよう sleep を追加
1591 $Net::SSLeay::slowly = 1; # 壊れたサーバでも保持できるようsleepを追加します
18411592
18421593=begin original
18431594
1844HTTP/1.1 is not supported. Specifically this module does not know to
1595http/1.1 is not supported. Specifically this module does not know to
18451596issue or serve multiple http requests per connection. This is a serious
1846shortcoming, but using the SSL session cache on your server helps to
1597short coming, but using SSL session cache on your server helps to
18471598alleviate the CPU load somewhat.
18481599
18491600=end original
18501601
1851HTTP/1.1 はサポートされていません。
1602http/1.1はサポートされていません。明確に、このモジュールは
1852明確に、このモジュールは接続ごとに複数の http リクエストを発行したり、
1603接続ごとに複数のhttpリクエストを発行したり、それをサービスすることを
1853それをサービスすることを知りません。
1604知りません。これは重大な短所です。しかしサーバーでSSLセッション・キャッシュを
1854これは重大な短所です。
1605使うとがCPUの負荷をいくぶん軽くすることを助けてくす。
1855しかしサーバで SSL セッションキャッシュを使うことが CPU の負荷を
1856いくぶん軽くすることを助けてくれます。
18571606
18581607=begin original
18591608
18601609As of version 1.09 many newer OpenSSL auxiliary functions were
1861added (from C<REM_AUTOMATICALLY_GENERATED_1_09> onwards in C<SSLeay.xs>).
1610added (from REM_AUTOMATICALLY_GENERATED_1_09 onwards in SSLeay.xs).
18621611Unfortunately I have not had any opportunity to test these. Some of
18631612them are trivial enough that I believe they "just work", but others
18641613have rather complex interfaces with function pointers and all. In these
18651614cases you should proceed wit great caution.
18661615
18671616=end original
18681617
1869バージョン 1.09 では多くの新しい OpenSSL 補助関数が追加されました
1618バージョン1.09では多くの新しいOpenSSL補助関数が追加されました(
1870(C<SSLeay.xs> では C<REM_AUTOMATICALLY_GENERATED_1_09> が前に付いています)
1619SSLeayxsではREM_AUTOMATICALLY_GENERATED_1_09が前に付いています
18711620残念ながらこれらをテストする機会を持つことができていません。
18721621それらのいくつかは私が"動くだけ"だと思うに十分なほどささいなものです。
18731622しかし他のものは機能ポインタや全てで、どちらかといえば複雑な
1874インターフェースを持っています。
1623インターフェースを持っています。これらの場合には、大いに注意する
1875これらの場合には、大いに注意する必要があります。
1624必要があります。
18761625
18771626=begin original
18781627
18791628This module defaults to using OpenSSL automatic protocol negotiation
18801629code for automatically detecting the version of the SSL protocol
18811630that the other end talks. With most web servers this works just
18821631fine, but once in a while I get complaints from people that the module
18831632does not work with some web servers. Usually this can be solved
18841633by explicitly setting the protocol version, e.g.
18851634
18861635=end original
18871636
1888このモジュールはデフォルトで、自動的にもう一方が話す SSL プロトコルコードの
1637このモジュールはデフォルトで、自動的にもう一方が話すSSLプロトコルコードの
1889バージョンを検出するための OpenSSL 自動プロトコルネゴシエションの
1638バージョンを検出するためのOpenSSL自動プロトコルネゴシエションの
1890コードを使います。
1639コードを使います。ほとんどのWebサーバーでは、これはうまく機能します。
1891ほとんどのWebサーバでは、これはまく機能します。
1640しかし私は時折、モジュールがある種のWebサーバでは動かないとい
1892しかし私時折モジューがある種の Web サーでは動かないという
1641苦情を受けます。通常これは、明示的にプロトコージョンを
1893苦情を受けます。
1642設定することにより解決することができます。例えば
1894通常これは、明示的にプロトコルバージョンを
1895設定することにより解決することができます。
1896例えば:
18971643
18981644=begin original
18991645
19001646 $Net::SSLeay::ssl_version = 2; # Insist on SSLv2
19011647 $Net::SSLeay::ssl_version = 3; # Insist on SSLv3
19021648 $Net::SSLeay::ssl_version = 10; # Insist on TLSv1
19031649
19041650=end original
19051651
1906 $Net::SSLeay::ssl_version = 2; # SSLv2 を要求します
1652 $Net::SSLeay::ssl_version = 2; # SSLv2を要求します
1907 $Net::SSLeay::ssl_version = 3; # SSLv3 を要求します
1653 $Net::SSLeay::ssl_version = 3; # SSLv3を要求します
1908 $Net::SSLeay::ssl_version = 10; # TLSv1 を要求します
1654 $Net::SSLeay::ssl_version = 10; # TLSv1を要求します
19091655
19101656=begin original
19111657
19121658Although the autonegotiation is nice to have, the SSL standards
19131659do not formally specify any such mechanism. Most of the world has
19141660accepted the SSLeay/OpenSSL way of doing it as the de facto standard. But
19151661for the few that think differently, you have to explicitly speak
19161662the correct version. This is not really a bug, but rather a deficiency
19171663in the standards. If a site refuses to respond or sends back some
1918nonsensical error codes (at the SSL handshake level), try this option
1664nonsensical error codes (at SSL handshake level), try this option
19191665before mailing me.
19201666
19211667=end original
19221668
1923自動ネゴシエションは素晴らしいのですが、SSL 標準では公式には
1669自動ネゴシエションは素晴らしいのですが、SSL標準では公式には
1924そのような機能を規定していません。
1670そのような機能を規定していません。世界中のほとんどがSSLeay/OpenSSLの
1925世界中のほとんどが SSLeay/OpenSSL のやり方を
1671やり方をデファクト・スダンダードとして受け入れています。しかし
1926デファクトスダンダードとて受ています。
1672中には違う考えを持つ人には、明示的に正いバージョンを話さなけれ
1927しかし中に違う考えを持つ人に、明示的に正しいージョンを
1673なりません。これ本当はバグではありません。むしろ標準での欠落です。
1928話さなければなりません。
1929これは本当はバグではありません。
1930むしろ標準での欠落です。
19311674もしサイトが応答を拒絶したり、無意味なエラーコードを送り返してきたら、
19321675私にメールする前に、このオプションを試してみてください。
19331676
19341677=begin original
19351678
19361679The high level API returns the certificate of the peer, thus allowing
19371680one to check what certificate was supplied. However, you will only be
19381681able to check the certificate after the fact, i.e. you already sent
19391682your form data by the time you find out that you did not trust them,
19401683oops.
19411684
19421685=end original
19431686
1944高レベル API は相手側の証明書を返します。
1687高レベルAPIは相手側の証明書を返します。これにより、どんな証明書が
1945これにより、どんな証明書が提供されたかをチェックすることができます。
1688提供されたかをチェックすることができます。しかしその事の後にだけ、
1946しかしその事の後にだけ、証明書をチェックすることができます。
1689証明書をチェックすることができます。つまり
1947つまり彼らを信頼しないことがわかったときには、あなたは既にあなたの
1690彼らを信頼しないことがわかったときには、あなたは既にあなたの
1948フォームデータを送信しているのです;
1691フォームデータを送信しているのです。アリャマ。
1949アリャマ。
19501692
19511693=begin original
19521694
19531695So, while being able to know the certificate after the fact is surely
19541696useful, the security minded would still choose to do the connection
1955and certificate verification first and only then exchange data
1697and certificate verification first and only after that exchange data
19561698with the site. Currently none of the high level API functions do
19571699this, thus you would have to program it using the low level API. A
1958good place to start is to see how the C<Net::SSLeay::http_cat()> function
1700good place to start is to see how Net::SSLeay::http_cat() function
19591701is implemented.
19601702
19611703=end original
19621704
19631705そこで、その事が後に証明書を知ることができることが便利だとしても、
19641706セキュリティを気にする人たちは、先に接続し証明書の確認を行い、
19651707その後にだけそのサイトとデータを交換することを選択するでしょう。
1966現在、これを行う高レベルの API 関数はありません。
1708現在、これを行う高レベルのAPI関数はありません。このため低レベルの
1967このため低レベルの API を使ってプログラムしなければなりません。
1709APIを使ってプログラムしなければなりません。
1968C<Net::SSLeay::http_cat()> 関数がどのように実装されているかを見ることから
1710Net::SSLeay::http_cat()関数がどのように実装されているかを見ることから
19691711はじめるといいでしょう。
19701712
1971=begin original
1972
1973The high level API functions use a global file handle C<SSLCAT_S>
1974internally. This really should not be a problem because there is no
1975way to interleave the high level API functions, unless you use threads
1976(but threads are not very well supported in perl anyway (as of version
19775.6.1). However, you may run into problems if you call undocumented
1978internal functions in an interleaved fashion.
1979
1980=end original
1981
1982高レベル API 関数は内部でグローバルファイルハンドル C<SSLCAT_S> を使います。
1983高レベル API 関数をインターリーブする方法はないので、
1984スレッドを使わない限り、実際に問題になることはないはずです
1985(しかし (バージョン 5.6.1 から) どちらにしても perl はスレッドに
1986うまく対応していません))。
1987しかし、インターリーブされた方法で文書化されていない内部関数を呼び出すと、
1988問題に突き当たるかもしれません。
1989
19901713=head1 DIAGNOSTICS
19911714
19921715(診断情報)
19931716
1994=over
1995
1996=item Random number generator not seeded!!!
1997
19981717=begin original
19991718
2000B<(W)> This warning indicates that C<randomize()> was not able to read
1719"Random number generator not seeded!!!"
2001C</dev/random> or C</dev/urandom>, possibly because your system does not
1720 This warning indicates that randomize() was not able to read
2002have them or they are differently named. You can still use SSL, but
1721 /dev/random or /dev/urandom, possibly because your system does not
2003the encryption will not be as strong.
1722 have them or they are differently named. You can still use SSL, but
1723 the encryption will not be as strong.
20041724
20051725=end original
20061726
2007B<(W)> この警告は C<randomize()> が C</dev/random> あるいは
1727"Random number generator not seeded!!!"
2008C</dev/urandom> を読むことできなかったことをしめしす。
1728 (日本語訳:"乱数発生装置種付けされていせん!!!")
2009おそらくあなたシステムそれらを持ってないか、
1729警告はrandomize()/dev/random あるは /dev/urandomを
2010別の名前にっているらでょう
1730 読むことができなかったことをめしますおそらくあなたのシステムが
2011これでも SSL 使うことは出来ます。
1731 それらを持っていないか、別の名前になっているからでしょう。これでもSSLを
2012しかし暗号化はあまり強力ではありません。
1732 使うことは出来ます。しかし暗号化はあまり強力ではありません。
20131733
2014=item open_tcp_connection: destination host not found:`server' (port 123) ($!)
2015
20161734=begin original
20171735
2018Name lookup for host named C<server> failed.
1736"open_tcp_connection: destination host not found:`server' (port 123) ($!)"
1737 Name lookup for host named `server' failed.
20191738
20201739=end original
20211740
2022C<server> 名前のホストの名前検索が失敗しました。
1741"open_tcp_connection: destination host not found:`server' (port 123) ($!)"
1742 (日本語訳:"open_tcp_connection: 出力先ホストが見つかりませんでした:`server' (ポート 123) ($!)"
1743 `server'名前のホストの名前検索が失敗しました。
20231744
2024=item open_tcp_connection: failed `server', 123 ($!)
2025
20261745=begin original
20271746
2028The name was resolved, but establising the TCP connection failed.
1747"open_tcp_connection: failed `server', 123 ($!)"
1748 The name was resolved, but establising the TCP connection failed.
20291749
20301750=end original
20311751
2032名前は解決されましたが、TCP 接続の確立が失敗しました。
1752"open_tcp_connection: failed `server', 123 ($!)"
1753 (日本語訳:"open_tcp_connection: 失敗:`server' (ポート 123) ($!)"
1754 名前は解決されましたが、TCP接続の確立が失敗しました。
20331755
2034=item msg 123: 1 - error:140770F8:SSL routines:SSL23_GET_SERVER_HELLO:unknown proto
2035
20361756=begin original
20371757
2038SSLeay error string. The first number (123) is the PID, the second number
1758"msg 123: 1 - error:140770F8:SSL routines:SSL23_GET_SERVER_HELLO:unknown proto"
2039(1) indicates the position of the error message in SSLeay error stack.
1759 SSLeay error string. First (123) number is PID, second number (1) indicates
2040You often see a pile of these messages as errors cascade.
1760 the position of the error message in SSLeay error stack. You often see
1761 a pile of these messages as errors cascade.
20411762
20421763=end original
20431764
2044SSLeay エラー文字列。
1765"msg 123: 1 - error:140770F8:SSL routines:SSL23_GET_SERVER_HELLO:unknown proto"
2045最初の (123) 番号は PID、2 番目の数字 (1) SSLeay エラスタックでの
1766 (日本語訳:"msg 123: 1 - error:140770F8:SSLチン:SSL23_GET_SERVER_HELLO:proto不明")
2046エラーメッセージの位置を示します
1767 SSLeayエラー文字列最初の(123)番号はPID、2番目の数字(1)はSSLeayエラー
2047階段状になったエラーで、これらのメッセージが重なったものを、しばしば
1768 スタックでのエラーメッセージの位置を示します。階段状になったエラーで、これらの
2048目にするでしょう。
1769 メッセージが重なったものを、しばしば目にするでしょう。
20491770
2050=item msg 123: 1 - error:02001002::lib(2) :func(1) :reason(2)
2051
20521771=begin original
20531772
2054The same as above, but you didn't call load_error_strings() so SSLeay
1773"msg 123: 1 - error:02001002::lib(2) :func(1) :reason(2)"
2055couldn't verbosely explain the error. You can still find out what it
1774 The same as above, but you didn't call load_error_strings() so SSLeay
2056means with this command:
1775 couldn't verbosely explain the error. You can still find out what it
1776 means with this command:
20571777
20581778=end original
20591779
2060上記と同じ。
1780"msg 123: 1 - error:02001002::lib(2) :func(1) :reason(2)"
2061しかし load_error_strings() を呼ばなかったので、SSLeay
1781 (日本語訳:"msg 123: 1 - error:02001002::lib(2) :関数(1) :理由(2)")
2062多くの言葉でエラーを説明するこができませんでした
1782 上記同じ。かしload_error_strings()を呼ばなかっので、SSLeayは
2063それでも、それがどんな意味かは以下コマンドにより知ることができます:
1783 多く言葉でエラーを説明することができませんでした。それでも、
1784 それがどんな意味かは以下のコマンドにより知ることができます:
20641785
2065 /usr/local/ssl/bin/ssleay errstr 02001002
1786 /usr/local/ssl/bin/ssleay errstr 02001002
20661787
2067=item Password is being asked for private key
2068
2069(秘密鍵のためのパスワードを聞かれる)
2070
20711788=begin original
20721789
2073This is normal behaviour if your private key is encrypted. Either
1790Password is being asked for private key
2074you have to supply the password or you have to use an unencrypted
1791 This is normal behaviour if your private key is encrypted. Either
2075private key. Scan OpenSSL.org for the FAQ that explains how to
1792 you have to supply the password or you have to use unencrypted
2076do this (or just study examples/makecert.pl which is used
1793 private key. Scan OpenSSL.org for the FAQ that explains how to
2077during C<make test> to do just that).
1794 do this (or just study examples/makecert.pl which is used
1795 during `make test' to do just that).
20781796
20791797=end original
20801798
2081あなたの秘密鍵が暗号化されていれば、これは通常動作です。
1799秘密鍵のためのパスワードを聞かれる
2082パスワードを与えるか、暗号化されていない秘密鍵を使うか
1800 あなたの秘密鍵が暗号化されていれば、これは通常動きです。パスワードを
2083どちらかをする必要があります。
1801 与えるか、暗号化されていない秘密鍵を使うかのどちらかをする必要があります。
2084これをどのように行うかの FAQ については OpenSSL.org をよく見てください。
1802 これをどのように行うかのFAQについてはOpenSSL.orgをよく見てください。
2085(あるいは単純に、C<make test> の時、それを行うためだけに使われる
1803 (あるいは単純に、`make test'の時、それを行うためだけに使われる
2086examples/makecert.pl 研究してください)
1804 examples/makecert.plを勉強してください)
20871805
2088=back
1806=head1 REPORTING BUGS AND SUPPORT
20891807
2090=head1 BUGS AND SUPPORT
1808(バグの報告とサポート)
20911809
2092(バグ報告とサポート)
2093
20941810=begin original
20951811
2096Please report any bugs or feature requests to
1812Please see README for full bug reporting instructions. In general I do
2097C<bug-Net-SSLeay at rt.cpan.org>, or through the web interface at
1813not answer for free stupid questions or questions where you did not
2098L<http://rt.cpan.org/Public/Dist/Display.html?Name=Net-SSLeay>.
1814do your home work.
2099I will be notified, and then you'll automatically be notified of progress on
2100your bug as I make changes.
21011815
21021816=end original
21031817
2104バグや機能リクエスト
1818完全なバグ報告の手順READMEをご覧ください。一般的に、私は只では、
2105C<bug-Net-SSLeay at rt.cpan.org> か、
1819馬鹿げた質問やあなたが宿題をやっていない質問について回答しません。
2106L<http://rt.cpan.org/Public/Dist/Display.html?Name=Net-SSLeay>
2107の web インターフェースで報告してください。
2108私には通知が届き、私が変更するとバグに関する進展について
2109自動的にあなたに通知されます。
21101820
21111821=begin original
21121822
2113Subversion access to the latest source code etc can be obtained at
1823Commercial support for Net::SSLeay may be obtained from
2114L<http://alioth.debian.org/projects/net-ssleay>
21151824
21161825=end original
21171826
2118最新ソースコードなどへの Subversion アクセスは、
1827Net::SSLeayの商用サポートは、以下のところで得られるでしょう
2119L<http://alioth.debian.org/projects/net-ssleay> で得られます。
21201828
2121=begin original
1829 Symlabs (netssleay@symlabs.com)
1830 Tel: +351-214.222.630
1831 Fax: +351-214.222.637
21221832
2123The developer mailing list (for people interested in contributing
1833=head1 VERSION
2124to the source code) can be found at
2125L<http://lists.alioth.debian.org/mailman/listinfo/net-ssleay-devel>
21261834
2127=end original
1835(バージョン)
21281836
2129(ソースコードに貢献することに興味のある人々のための)
2130開発者メーリングリストは
2131L<http://lists.alioth.debian.org/mailman/listinfo/net-ssleay-devel> に
2132あります。
2133
21341837=begin original
21351838
2136You can find documentation for this module with the C<perldoc> command.
1839This man page documents version 1.14, released on 25.3.2002.
21371840
21381841=end original
21391842
2140このジュールの文書を C<perldoc> コマドで読むことができ
1843このmanペー・ドキメントは バージョ1.14、2002.3.25にリリースされした
21411844
2142 perldoc Net::SSLeay
2143
21441845=begin original
21451846
2146You can also look for information at:
1847There are currently two perl modules for using OpenSSL C
1848library: Net::SSLeay (maintaned by me) and SSLeay (maintained by OpenSSL
1849team). This module is the Net::SSLeay variant.
21471850
21481851=end original
21491852
2150場所の情報見ることもできます:
1853現在2つperlモジュールがOpenSSL Cライブラリ使っています:
1854Net::SSLeay (私によってメンテされています)とSSLeay(OpenSSLチームにより
1855メンテされています)。このモジュールはNet::SSLeayの一種です。
21511856
2152=over 4
1857=begin original
21531858
2154=item * AnnoCPAN: Annotated CPAN documentation
1859At the time of making this release, Eric's module was still quite
1860sketchy and could not be used for real work, thus I felt motivated to
1861make this maintenance release. This module is not planned to evolve to
1862contain any further functionality, i.e. I will concentrate on just
1863making a simple SSL connection over TCP socket. Presumably Eric's own
1864module will offer full SSLeay API one day.
21551865
2156L<http://annocpan.org/dist/Net-SSLeay>
1866=end original
21571867
2158=item * CPAN Ratings
1868このリリースを作成している辞典では、Ericのモジュールはまだ非常に不完全で、
1869実務に使うことは出来ませんでした。そのためこのメンテナンス・リリースを作る
1870気になりました。このモジュールはさらなる機能を入れるように進化する計画は
1871ありません。つまり私はTCPソケット越しの単純なSSL接続を作ることだけに
1872集中するつもりです。いつか、Eric自身のモジュールがSSLeay APIの全てを提供
1873するでしょう。
21591874
2160L<http://cpanratings.perl.org/d/Net-SSLeay>
2161
2162=item * Search CPAN
2163
2164L<http://search.cpan.org/dist/Net-SSLeay>
2165
2166=back
2167
21681875=begin original
21691876
2170Commercial support for Net::SSLeay may be obtained from
1877This module uses OpenSSL-0.9.6c. It does not work with any earlier
1878version and there is no guarantee that it will work with later
1879versions either, though as long as C API does not change, it
1880should. This module requires perl5.005, or 5.6.0 (or better?) though I
1881believe it would build with any perl5.002 or newer.
21711882
21721883=end original
21731884
2174Net::SSLeay の商用サポート、以下ところ得られるでしょう
1885このモジュールはOpenSSL-0.9.6cを使っています。これバージョン
1886動きません。そしてこの後のバージョンでも動くという保障はありません。
1887しかしC APIが変更されない限り、動くはずです。このモジュールはperl5.005
1888あるいは5.6.0(それ以上?)を必要とします。しかし私はperl5.002以降でビルド
1889できると思っています。
21751890
2176 Symlabs (netssleay@symlabs.com)
2177 Tel: +351-214.222.630
2178 Fax: +351-214.222.637
2179
21801891=head1 AUTHOR
21811892
21821893(作者)
21831894
2184Maintained by Mike McCauley and Florian Ragwitz since November 2005
1895Sampo Kellomaki <sampo@symlabs.com>
21851896
2186Originally written by Sampo KellomE<auml>ki <sampo@symlabs.com>
1897=begin original
21871898
2188=head1 COPYRIGHT
1899Please send bug reports to the above address. General questions should be
1900sent either to me or to the mailing list (subscribe by sending mail
1901to openssl-users-request@openssl.org or using web interface at
1902http://www.openssl.org/support/).
21891903
2190Copyright (c) 1996-2003 Sampo KellomE<auml>ki <sampo@symlabs.com>
1904=end original
21911905
2192Copyright (C) 2005-2006 Florian Ragwitz <rafl@debian.org>
1906バグレポートは上記のアドレスの送ってください。一般的な質問は私あるいは
1907メーリングリスト(openssl-users-request@openssl.org にメールを送るか
1908http://www.openssl.org/support/ にあるWebインターフェースによって
1909参加してください)
21931910
2194Copyright (C) 2005 Mike McCauley <mikem@open.com.au>
1911=head1 COPYRIGHT
21951912
1913Copyright (c) 1996-2002 Sampo Kellomaki <sampo@symlabs.com>
21961914All Rights Reserved.
21971915
21981916Distribution and use of this module is under the same terms as the
21991917OpenSSL package itself (i.e. free, but mandatory attribution; NO
22001918WARRANTY). Please consult LICENSE file in the root of the OpenSSL
22011919distribution.
22021920
22031921While the source distribution of this perl module does not contain
22041922Eric's or OpenSSL's code, if you use this module you will use OpenSSL
22051923library. Please give Eric and OpenSSL team credit (as required by
22061924their licenses).
22071925
22081926And remember, you, and nobody else but you, are responsible for
22091927auditing this module and OpenSSL library for security problems,
22101928backdoors, and general suitability for your application.
22111929
22121930=head1 SEE ALSO
22131931
22141932=begin original
22151933
22161934 Net::SSLeay::Handle - File handle interface
2217 ./examples - Example servers and a clients
1935 ./Net_SSLeay/examples - Example servers and a clients
1936 <http://symlabs.com/Net_SSLeay/index.html> - Net::SSLeay.pm home
1937 <http://symlabs.com/Net_SSLeay/smime.html> - Another module using OpenSSL
22181938 <http://www.openssl.org/> - OpenSSL source, documentation, etc
22191939 openssl-users-request@openssl.org - General OpenSSL mailing list
2220 <http://www.ietf.org/rfc/rfc2246.txt> - TLS 1.0 specification
1940 <http://home.netscape.com/newsref/std/SSL.html> - SSL Draft specification
22211941 <http://www.w3c.org> - HTTP specifications
22221942 <http://www.ietf.org/rfc/rfc2617.txt> - How to send password
22231943 <http://www.lothar.com/tech/crypto/> - Entropy Gathering Daemon (EGD)
22241944 <http://www.aet.tu-cottbus.de/personen/jaenicke/postfix_tls/prngd.html>
22251945 - pseudo-random number generating daemon (PRNGD)
22261946 perl(1)
22271947 perlref(1)
22281948 perllol(1)
22291949 perldoc ~openssl/doc/ssl/SSL_CTX_set_verify.pod
22301950
22311951=end original
22321952
2233 Net::SSLeay::Handle - ファイルハンドルのインターフェース
1953 Net::SSLeay::Handle - ファイルハンドルのインターフェース
2234 ./examples - サーバとクライアントの例
1954 ./Net_SSLeay/examples - サーバとクライアントの例
1955 <http://symlabs.com/Net_SSLeay/index.html> - Net::SSLeay.pm ホーム
1956 <http://symlabs.com/Net_SSLeay/smime.html> - OpenSSLを使っている別のモジュール
22351957 <http://www.openssl.org/> - OpenSSL ソース、ドキュメントなど
2236 openssl-users-request@openssl.org - 一般的な OpenSSL メーリングリスト
1958 openssl-users-request@openssl.org - 一般的なOpenSSLメーリングリスト
2237 <http://www.ietf.org/rfc/rfc2246.txt> - TLS 1.0 仕様
1959 <http://home.netscape.com/newsref/std/SSL.html> - SSL ドラフトの仕様
2238 <http://www.w3c.org> - HTTP 仕様
1960 <http://www.w3c.org> - HTTP仕様
22391961 <http://www.ietf.org/rfc/rfc2617.txt> - パスワードの送信方法
22401962 <http://www.lothar.com/tech/crypto/> - Entropy Gathering Daemon (EGD)
22411963 <http://www.aet.tu-cottbus.de/personen/jaenicke/postfix_tls/prngd.html>
2242 - 疑似乱数生成デーモン (PRNGD)
1964 - pseudo-random number generating daemon (PRNGD)
22431965 perl(1)
22441966 perlref(1)
22451967 perllol(1)
22461968 perldoc ~openssl/doc/ssl/SSL_CTX_set_verify.pod
2247
2248=begin meta
2249
2250Translate: hippo2000
2251Update: SHIRAKATA Kentaro <argrath@ub32.org> (1.36-)
2252Status: in progress
2253
2254=end meta
22551969
22561970=cut