Statement on glibc/iconv Vulnerability

openssl_cipher_key_length

(PHP 8 >= 8.2.0)

openssl_cipher_key_length暗号鍵の長さを取得する

説明

openssl_cipher_key_length(string $cipher_algo): int|false

暗号鍵の長さを取得します。

パラメータ

cipher_algo

暗号化方式。指定できる値は openssl_get_cipher_methods() を参照ください。

戻り値

成功した場合は暗号の長さを返します。 失敗した場合に false を返します.

エラー / 例外

暗号アルゴリズムが未知の場合、 E_WARNING レベルのエラーが発生します。

例1 openssl_cipher_key_length() の例

<?php
$method
= 'AES-128-CBC';

var_dump(openssl_cipher_key_length($method));
?>

上の例の出力は、 たとえば以下のようになります。

int(16)
add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top