-
Notifications
You must be signed in to change notification settings - Fork 79
doc-enの差分を反映(4) #142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
doc-enの差分を反映(4) #142
Changes from all commits
aa3ed3a
45691b0
274a909
2c24f96
ecb8841
b77a8b6
b916e14
07a4521
1255d65
4e8c268
5106895
cc5fee6
8c21ff0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- $Revision$ --> | ||
<!-- EN-Revision: 5bc68add3da3cd18c40f851e944b15095d3a26aa Maintainer: hirokawa Status: ready --> | ||
<!-- EN-Revision: 730fd5c3dd1523bb9330762084ce016d4e58e946 Maintainer: hirokawa Status: ready --> | ||
<!-- CREDITS: takagi,mumumu --> | ||
<refentry xml:id="function.openssl-open" xmlns="http://docbook.org/ns/docbook"> | ||
<refnamediv> | ||
|
@@ -20,14 +20,14 @@ | |
<methodparam choice="opt"><type class="union"><type>string</type><type>null</type></type><parameter>iv</parameter><initializer>&null;</initializer></methodparam> | ||
</methodsynopsis> | ||
<para> | ||
<function>openssl_open</function> は、キー ID | ||
<parameter>private_key</parameter> およびエンベロープキー | ||
<parameter>encrypted_key</parameter> に関連する公開鍵を使用して、 | ||
<function>openssl_open</function> は、 <parameter>private_key</parameter> を使用して | ||
<parameter>encrypted_key</parameter> から復号されたエンベロープキーによって | ||
<parameter>data</parameter> をオープン(復号)します。 | ||
その上で、<parameter>output</parameter> を復号化したデータで埋めます。 | ||
エンベロープキーは、データがシール(暗号化)された際に生成され、特定の | ||
一つの公開鍵でのみ使用することが可能です。詳細な情報については、 | ||
<function>openssl_seal</function> を参照ください。 | ||
復号は <parameter>cipher_algo</parameter> と <parameter>iv</parameter> を使用して行なわれます。 | ||
IV は暗号方式が要求する場合にのみ必要です。復号されたデータは <parameter>output</parameter> に | ||
格納されます。エンベロープキーは通常、秘密鍵に関連付けられた公開鍵を用いてデータがシール(暗号化) | ||
されたときに生成されます。 | ||
詳細は <function>openssl_seal</function> を参照ください。 | ||
</para> | ||
</refsect1> | ||
|
||
|
@@ -39,39 +39,42 @@ | |
<term><parameter>data</parameter></term> | ||
<listitem> | ||
<para> | ||
シール(暗号化)されたデータ。 | ||
</para> | ||
</listitem> | ||
</varlistentry> | ||
<varlistentry> | ||
<term><parameter>output</parameter></term> | ||
<listitem> | ||
<para> | ||
成功した場合、オープンしたデータをここに返します。 | ||
成功した場合、オープンしたデータをこのパラメータのリファレンス変数として返します。 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 原文
「のリファレンス変数として」は原文にはない表現を補っている。 |
||
</para> | ||
</listitem> | ||
</varlistentry> | ||
<varlistentry> | ||
<term><parameter>encrypted_key</parameter></term> | ||
<listitem> | ||
<para> | ||
<parameter>private_key</parameter> を用いて復号できる暗号化された対称鍵。 | ||
</para> | ||
</listitem> | ||
</varlistentry> | ||
<varlistentry> | ||
<term><parameter>private_key</parameter></term> | ||
<listitem> | ||
<para> | ||
<parameter>encrypted_key</parameter>の復号に用いられる秘密鍵。 | ||
</para> | ||
</listitem> | ||
</varlistentry> | ||
<varlistentry> | ||
<term><parameter>cipher_algo</parameter></term> | ||
<listitem> | ||
<para> | ||
暗号化方式 | ||
<parameter>data</parameter>の復号に使用される暗号化方式。 | ||
<caution> | ||
<simpara> | ||
デフォルト値 (<literal>'RC4'</literal>) はセキュアでない値です。 | ||
PHP 8.0 より前のデフォルト値 (<literal>'RC4'</literal>) は安全ではありません。 | ||
明示的にセキュアな暗号化方式を指定することを強く推奨します。 | ||
</simpara> | ||
</caution> | ||
|
@@ -82,7 +85,9 @@ | |
<term><parameter>iv</parameter></term> | ||
<listitem> | ||
<para> | ||
初期化ベクトル。 | ||
<parameter>data</parameter>の復号に用いられる初期化ベクトル。暗号方式が IV を要求する場合に必要です。 | ||
これは <parameter>cipher_algo</parameter> で <function>openssl_cipher_iv_length</function> | ||
を呼び出すことで確認できます。 | ||
</para> | ||
</listitem> | ||
</varlistentry> | ||
|
@@ -139,24 +144,19 @@ | |
<programlisting role="php"> | ||
<![CDATA[ | ||
<?php | ||
// $sealed および $env_key に暗号化されたデータおよびエンベロープキー | ||
// が含まれていると仮定。共にシール元(暗号化側)から与えられる。 | ||
|
||
// ファイルから公開鍵を取得し、使用可能とする | ||
$fp = fopen("/src/openssl-0.9.6/demos/sign/key.pem", "r"); | ||
$priv_key = fread($fp, 8192); | ||
fclose($fp); | ||
$pkeyid = openssl_get_privatekey($priv_key); | ||
// $sealed, $env_key および $iv に暗号化されたデータおよびエンベロープキーと | ||
// IV が含まれていると仮定。すべてシール元(暗号化側)から与えられる。 | ||
|
||
// private_key.pem に置かれたファイルから公開鍵を取得する | ||
$pkey = openssl_get_privatekey("file://private_key.pem"); | ||
|
||
// データを復号化し、$open に保存 | ||
if (openssl_open($sealed, $open, $env_key, $pkeyid)) { | ||
echo "here is the opened data: ", $open; | ||
if (openssl_open($sealed, $open, $env_key, $pkey, 'AES256', $iv)) { | ||
echo "Here is the opened data: ", $open; | ||
} else { | ||
echo "failed to open data"; | ||
echo "Failed to open data"; | ||
} | ||
|
||
// 公開鍵をメモリから開放 | ||
openssl_free_key($pkeyid); | ||
?> | ||
]]> | ||
</programlisting> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- $Revision$ --> | ||
<!-- EN-Revision: 5bc68add3da3cd18c40f851e944b15095d3a26aa Maintainer: takagi Status: ready --> | ||
<!-- EN-Revision: 5136ca8abac85850155a0ae7375124a52917b240 Maintainer: takagi Status: ready --> | ||
<!-- Credits: mumumu --> | ||
|
||
<refentry xml:id="function.openssl-pbkdf2" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> | ||
|
@@ -40,7 +40,7 @@ | |
<term><parameter>salt</parameter></term> | ||
<listitem> | ||
<para> | ||
PBKDF2 は、暗号化のソルトとして、少なくとも64ビット(8バイト)を推奨しています。 | ||
PBKDF2 は、暗号化のソルトとして、少なくとも128ビット(16バイト)を推奨しています。 | ||
</para> | ||
</listitem> | ||
</varlistentry> | ||
|
@@ -56,8 +56,11 @@ | |
<term><parameter>iterations</parameter></term> | ||
<listitem> | ||
<para> | ||
イテレーションの回数。 | ||
<link xlink:href="https://pages.nist.gov/800-63-3/sp800-63b.html#sec5">NIST は少なくとも10000を推奨しています</link>. | ||
反復回数。 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. #142 (review) で「イテレーションの回数」を維持しようか悩んだが、 #131 で変更されている中では「反復回数」と訳されていたので、この期に統一。 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ほかに「イテレーション」がこの意味で使われている箇所は残っていなさそう |
||
<link xlink:href="https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf"> | ||
NIST は最低でも1000を推奨</link>しています。 | ||
2023 年の時点で、OWASP は PBKDF2-HMAC-SHA256 に対して 600,000 回、 | ||
PBKDF2-HMAC-SHA512 に対して 210,000 回の反復を推奨しています。 | ||
</para> | ||
</listitem> | ||
</varlistentry> | ||
|
@@ -67,7 +70,7 @@ | |
<para> | ||
オプションのハッシュまたはダイジェストアルゴリズム。 | ||
アルゴリズムの一覧は、<function>openssl_get_md_methods</function> で得られます。 | ||
デフォルトは SHA-1 です。 | ||
デフォルトは SHA-1 ですが、SHA-256 または SHA-512 を推奨しています。 | ||
</para> | ||
</listitem> | ||
</varlistentry> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
若干の意訳。
https://github.com/php/doc-en/blob/e5ab2937efd9b1d7184993e0fdfa957893f7f827/reference/openssl/functions/openssl-decrypt.xml#L58-L60
直訳すると「名前が示唆するように、パスフレーズには鍵導出関数は使用されません。」
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
読者が暗号の専門家とは限らないということを意識して、「鍵導出関数」をそのまま使っていない (括弧書きで残してもいいが)