From 87dc20492409ed672ad5a1f2c1bc378456b75e64 Mon Sep 17 00:00:00 2001 From: Takashi Kojo Date: Sun, 11 Jan 2026 18:46:22 +0900 Subject: [PATCH 1/2] update wolfCLU --- wolfCLU/Makefile | 1 + wolfCLU/create-pdf.sh | 2 +- wolfCLU/mkdocs-ja.yml | 1 + wolfCLU/mkdocs.yml | 1 + wolfCLU/src-ja/ca.md | 137 +++++++++++++++++++--- wolfCLU/src-ja/crl.md | 96 ++++++++++++++-- wolfCLU/src-ja/dgst.md | 125 ++++++++++++++++---- wolfCLU/src-ja/genkey.md | 220 +++++++++++++++++++++++++++++++++-- wolfCLU/src-ja/hash.md | 106 ++++++++++++++--- wolfCLU/src-ja/pkey.md | 90 +++++++++++++-- wolfCLU/src-ja/req.md | 129 ++++++++++++++++++--- wolfCLU/src-ja/rsa.md | 129 +++++++++++++++++++-- wolfCLU/src-ja/s_client.md | 147 ++++++++++++++++++++++-- wolfCLU/src-ja/s_server.md | 140 +++++++++++++++++++++++ wolfCLU/src-ja/verify.md | 110 ++++++++++++++++-- wolfCLU/src-ja/x509.md | 139 ++++++++++++++++++++-- wolfCLU/src/ca.md | 137 +++++++++++++++++++--- wolfCLU/src/crl.md | 93 +++++++++++++-- wolfCLU/src/dgst.md | 126 ++++++++++++++++---- wolfCLU/src/genkey.md | 228 +++++++++++++++++++++++++++++++++++-- wolfCLU/src/hash.md | 105 +++++++++++++++-- wolfCLU/src/pkey.md | 91 +++++++++++++-- wolfCLU/src/req.md | 127 ++++++++++++++++++--- wolfCLU/src/rsa.md | 132 +++++++++++++++++++-- wolfCLU/src/s_client.md | 98 ++++++++++++++-- wolfCLU/src/s_server.md | 142 +++++++++++++++++++++++ wolfCLU/src/verify.md | 110 ++++++++++++++++-- wolfCLU/src/x509.md | 129 +++++++++++++++++++-- 28 files changed, 2823 insertions(+), 268 deletions(-) create mode 100644 wolfCLU/src-ja/s_server.md create mode 100644 wolfCLU/src/s_server.md diff --git a/wolfCLU/Makefile b/wolfCLU/Makefile index add73469..1780f70a 100644 --- a/wolfCLU/Makefile +++ b/wolfCLU/Makefile @@ -26,6 +26,7 @@ SOURCES = Intro.md \ rsa.md \ sha.md \ s_client.md \ + s_server.md \ verify.md \ x509.md \ base64.md diff --git a/wolfCLU/create-pdf.sh b/wolfCLU/create-pdf.sh index a29a13d1..30c11e6b 100755 --- a/wolfCLU/create-pdf.sh +++ b/wolfCLU/create-pdf.sh @@ -1,3 +1,3 @@ #!/bin/bash -pandoc -s header.txt src/Intro.md src/build.md src/command_list.md src/bench.md src/ca.md src/crl.md src/dsaparam.md src/dhparam.md src/dgst.md src/ecparam.md src/enc.md src/genkey.md src/hash.md src/md5.md src/sha.md src/pkcs12.md src/pkey.md src/rand.md src/req.md src/rsa.md src/s_client.md src/verify.md src/x509.md --toc -o wolfCLU_Manual.pdf +pandoc -s header.txt src/Intro.md src/build.md src/command_list.md src/bench.md src/ca.md src/crl.md src/dsaparam.md src/dhparam.md src/dgst.md src/ecparam.md src/enc.md src/genkey.md src/hash.md src/md5.md src/sha.md src/pkcs12.md src/pkey.md src/rand.md src/req.md src/rsa.md src/s_client.md d src/s_server.md src/verify.md src/x509.md --toc -o wolfCLU_Manual.pdf diff --git a/wolfCLU/mkdocs-ja.yml b/wolfCLU/mkdocs-ja.yml index 17273b10..e1d23077 100644 --- a/wolfCLU/mkdocs-ja.yml +++ b/wolfCLU/mkdocs-ja.yml @@ -28,6 +28,7 @@ nav: - "RSA コマンド": rsa.md - "SHA コマンド": sha.md - "S_CLIENT コマンド": s_client.md + - "S_SERVER コマンド": s_server.md - "VERIFY コマンド": verify.md - "X509 コマンド": x509.md - "BASE64 コマンド": base64.md diff --git a/wolfCLU/mkdocs.yml b/wolfCLU/mkdocs.yml index ed80b6c0..d3a83156 100644 --- a/wolfCLU/mkdocs.yml +++ b/wolfCLU/mkdocs.yml @@ -23,6 +23,7 @@ nav: - "REQ Command": req.md - "RSA Command": rsa.md - "S_CLIENT Command": s_client.md + - "S_SERVER Command": s_server.md - "VERIFY Command": verify.md - "X509 Command": x509.md - "BASE64 Command": base64.md diff --git a/wolfCLU/src-ja/ca.md b/wolfCLU/src-ja/ca.md index 02288f0b..53aceb89 100644 --- a/wolfCLU/src-ja/ca.md +++ b/wolfCLU/src-ja/ca.md @@ -1,21 +1,128 @@ -### CA コマンド -証明書への署名に使用されます。このコマンドはコンフィグレーションファイルを指定し、そのファイルから基本的なコンフィグレーション内容を取得することが可能です。 +### CA コマンド — 認証局による署名および証明書発行 -指定可能な引数: +`wolfssl ca` コマンドは、 +**証明書署名要求(Certificate Signing Request: CSR)** を署名し、 +X.509 証明書を発行するための、基本的な **認証局(Certificate Authority: CA)** +機能を提供します。 -- [-in] 入力となるCSRファイル -- [-out] 出力先ファイル -- [-keyfile] 秘密鍵ファイル -- [-cert] CA証明書ファイル -- [-extensions] コンフィグレーションファイル内の解析すべきセクション -- [-md] ハッシュタイプ(sha, sha256, ...) -- [-inform] CSRファイル形式(PEM/DER) -- [-config] コンフィグレーションファイル -- [-days] 証明書に与える有効期間(日数) -- [-selfsign] 自己署名する +本コマンドは OpenSSL の `openssl ca` コマンドと類似した機能を持ちますが、 +一般的な証明書署名処理に焦点を当てた、簡易的な機能セットとなっています。 +CA 証明書とその秘密鍵を用いた CSR の署名に加え、 +自己署名証明書の生成もサポートしています。 -使用例: +主な用途は以下のとおりです。 +- CA の秘密鍵を用いて CSR を署名し、X.509 証明書を発行 +- 設定ファイルから証明書拡張を適用 +- 証明書の有効期間および署名アルゴリズムの制御 +- テスト用途や内部利用のための自己署名証明書の生成 + +--- + +#### 機能概要 + +`ca` コマンドは CSR を入力として受け取り、 +署名済みの X.509 証明書を生成します。 + +指定されたオプションに応じて、以下の動作モードをサポートします。 + +- **CA 署名証明書の生成** + - CA 証明書およびそれに対応する秘密鍵を使用して CSR を署名 +- **自己署名証明書の生成** + - 入力証明書に対応する秘密鍵を使用して証明書を署名(`-selfsign`) + +本コマンドは、証明書拡張やその他の証明書関連パラメータを +設定ファイルから読み取って処理します。 + +--- + +#### 入出力 + +- **入力** + - 証明書署名要求(CSR) +- **出力** + - X.509 証明書(PEM または DER) + +--- + +#### 共通オプション + +| オプション | 説明 | +|------|-------------| +| `-in ` | 入力 CSR ファイル | +| `-out ` | 生成される証明書の出力先 | +| `-inform PEM \| DER` | CSR の入力形式 | +| `-outform PEM \| DER` | 証明書の出力形式 | +| `-config ` | 証明書パラメータを定義した設定ファイル | +| `-days ` | 証明書の有効日数 | +| `-md ` | 署名に使用するメッセージダイジェストアルゴリズム(例: `sha256`) | + +--- + +#### CA 鍵および証明書オプション + +以下のオプションは、証明書署名に使用する CA の認証情報を指定します。 + +| オプション | 説明 | +|------|-------------| +| `-keyfile ` | 証明書署名に使用する秘密鍵 | +| `-cert ` | 上記秘密鍵に対応する CA 証明書 | + +--- + +#### 拡張処理オプション + +| オプション | 説明 | +|------|-------------| +| `-extensions
` | 設定ファイル内で証明書拡張を読み取るセクション名 | + +--- + +#### 自己署名証明書オプション + +| オプション | 説明 | +|------|-------------| +| `-selfsign` | 入力証明書に対応する秘密鍵を使用して自己署名する | + +> **注意:** +> `-selfsign` を指定した場合、証明書は独立した CA 鍵ではなく、 +> 自身の鍵を用いて署名されます。 + +--- + +#### 注意事項 + +- `-in` で指定する入力ファイルは、有効な CSR である必要があります。 +- CA 署名証明書を生成する場合、`-keyfile` と `-cert` の両方を指定する必要があります。 +- 拡張情報の解析は、基本的な設定ファイル処理に限定されています。 +- OpenSSL の完全な `ca` コマンドとは異なり、 + 本コマンドは証明書データベースやシリアル番号ファイルの管理は行いません。 + +--- + +#### 例 + +CA 証明書と秘密鍵を用いて CSR を署名する例: + +```sh +wolfssl ca \ + -config ca.conf \ + -in server.csr \ + -out server-cert.pem \ + -cert ca-cert.pem \ + -keyfile ca-key.pem \ + -md sha256 \ + -days 365 ``` -wolfssl ca -config ca.conf -in test.csr -out test.pem -md sha256 -selfsign -keyfile ./key + +自己署名証明書を生成する例: + +```sh +wolfssl ca \ + -config selfsign.conf \ + -in server.csr \ + -out server-cert.pem \ + -selfsign \ + -md sha256 \ + -days 365 ``` diff --git a/wolfCLU/src-ja/crl.md b/wolfCLU/src-ja/crl.md index 74dd6b24..193c428e 100644 --- a/wolfCLU/src-ja/crl.md +++ b/wolfCLU/src-ja/crl.md @@ -1,17 +1,89 @@ -### CRL コマンド -CA を指定して CRL ファイルを検証するために使用されます。 または、CRL を フォーマット変換 [DER|PEM] することもできます。-out が指定されておらず、-noout が使用されていない場合、このコマンドは CRL を stdout に出力します。 検証が成功すると「OK」を出力します。 +### CRL コマンド — 証明書失効リスト(CRL)の処理および内容確認 -引数: +`wolfssl crl` コマンドは、 +**証明書失効リスト(Certificate Revocation List: CRL)** を +読み込み、内容確認、形式変換、および表示するために使用されます。 -- [-CAfile] CA証明書ファイル -- [-inform] 入力フォーマット:pem あるいは der -- [-in] the CRLファイル -- [-outform] 出力フォーマット:pem あるいは der -- [-out] 出力ファイル -- [-noout] 指定がある場合には出力しません +本コマンドは OpenSSL の `openssl crl` コマンドと同様の機能を提供し、 +CRL の内容を確認したり、エンコード形式を変換したりする用途を想定しています。 -使用例: +主な用途は以下のとおりです。 +- CRL の内容を人間可読形式で表示 +- CRL の PEM / DER 形式変換 +- CA 証明書に基づく CRL 発行者情報の確認 +- 更新時刻や失効証明書一覧など、CRL メタデータの確認 + +--- + +#### 機能概要 + +`crl` コマンドは、既存の証明書失効リスト(CRL)を対象として、 +以下の操作をサポートします。 + +- PEM または DER 形式の CRL の読み込み +- CRL の PEM / DER 形式変換 +- CRL 内容の人間可読形式での表示 +- 内容確認のみを行う場合の、エンコード済み出力の抑制 + +本コマンドは CRL の生成は行わず、 +CRL の確認および形式変換のみを目的としています。 + +--- + +#### 入出力 + +- **入力** + - PEM または DER 形式の証明書失効リスト(CRL) +- **出力** + - PEM または DER 形式の CRL、または人間可読形式の CRL 情報 + +--- + +#### 共通オプション + +| オプション | 説明 | +|------|-------------| +| `-CAfile ` | CRL 発行者を検証するための CA 証明書 | +| `-in ` | 入力 CRL ファイル | +| `-inform pem \| der` | CRL の入力形式 | +| `-out ` | CRL の出力先ファイル | +| `-outform pem \| der` | CRL の出力形式 | +| `-noout` | エンコード済み CRL を出力しない | +| `-text` | CRL の内容を人間可読形式で出力 | + +--- + +#### 注意事項 + +- `-in` オプションには、有効な CRL ファイルを指定する必要があります。 +- `-CAfile` オプションを使用することで、 + CRL を信頼された CA に関連付けて確認することができます。 +- `-text` を指定した場合、発行者、更新時刻、 + および失効証明書エントリなどの詳細情報が表示されます。 +- `-noout` を指定すると、エンコードされた CRL の出力は抑制されますが、 + `-text` による表示は抑制されません。 +- 本コマンドは CRL を自動取得する機能は持たず、 + ローカルに提供されたファイルのみを処理します。 + +--- + +#### 例 + +CRL の内容を人間可読形式で表示する例: + +```sh +wolfssl crl -in crl.pem -text +``` + +CRL を PEM 形式から DER 形式に変換する例: + +```sh +wolfssl crl -in crl.pem -inform pem -outform der -out crl.der +``` + +エンコード済み CRL を出力せずに内容のみ確認する例: + +```sh +wolfssl crl -in crl.pem -text -noout ``` -wolfssl crl -CAfile ./certs/ca-cert.pem -in ./certs/crl.der -inform DER -noout -``` \ No newline at end of file diff --git a/wolfCLU/src-ja/dgst.md b/wolfCLU/src-ja/dgst.md index d4a120bf..8f6afdf5 100644 --- a/wolfCLU/src-ja/dgst.md +++ b/wolfCLU/src-ja/dgst.md @@ -1,34 +1,115 @@ -### DGST コマンド -署名を検証することが可能です。最後の引数は署名対象となったデータです。 +### DGST コマンド — メッセージダイジェストおよびデジタル署名操作 -サポートしているハッシュアルゴリズム: +`wolfssl dgst` コマンドは、暗号学的メッセージダイジェスト(ハッシュ)の計算、 +および入力データに対する **デジタル署名の生成および検証** を行うために使用されます。 -- [-sha] -- [-sha224] -- [-sha256] -- [-sha384] -- [-sha512] +本コマンドは OpenSSL の `openssl dgst` コマンドと同様の機能を提供します。 +コマンドラインの **最後の引数** には、ハッシュ化または署名対象となる入力データを指定します。 -**署名** +主な用途は以下のとおりです。 -引数: +- 入力データのメッセージダイジェスト(ハッシュ)計算 +- 秘密鍵を用いたデジタル署名の生成 +- 公開鍵または証明書を用いたデジタル署名の検証 -- [-sign] 署名作成に必要な鍵 -- [-out] 署名出力先のファイル +--- -使用例: -``` -wolfssl dgst -sign keyPrivate.pem -out test.sig testfile -``` +#### 機能概要 + +`dgst` コマンドは任意の入力データを対象として動作し、 +複数のハッシュアルゴリズムをサポートします。 + +指定されるオプションに応じて、以下の操作を行います。 + +- **ダイジェスト計算** + - 入力データに対するハッシュ値を計算 +- **署名生成** + - 秘密鍵を使用して入力データに対するデジタル署名を生成 +- **署名検証** + - 公開鍵または証明書を使用してデジタル署名を検証 + +入力データは、コマンドラインの **最後の引数** として指定します。 + +--- + +#### サポートされているハッシュアルゴリズム + +以下のメッセージダイジェストアルゴリズムがサポートされています。 + +- `-md5` +- `-sha` +- `-sha224` +- `-sha256` +- `-sha384` +- `-sha512` + +ハッシュアルゴリズムが明示的に指定されていない場合、 +ビルド構成に応じてデフォルトのアルゴリズムが使用されることがあります。 + +--- + +#### 共通オプション + +| オプション | 説明 | +|------|-------------| +| `-inform pem \| der` | 鍵ファイルまたは署名ファイルの入力形式 | +| `-out ` | 生成された署名またはダイジェストの出力先 | + +--- + +#### 署名生成オプション -**検証** +以下のオプションは、デジタル署名を生成する場合に使用します。 -引数: +| オプション | 説明 | +|------|-------------| +| `-sign ` | 署名生成に使用する秘密鍵 | -- [-verify] 署名を検証する為に使用する鍵 -- [-signature] 署名を含んだファイル +`-sign` が指定された場合、入力データに対して署名が生成され、 +`-out` で指定されたファイルに出力されます。 -使用例: +--- + +#### 署名検証オプション + +以下のオプションは、既存のデジタル署名を検証する場合に使用します。 + +| オプション | 説明 | +|------|-------------| +| `-signature ` | 検証対象となる署名ファイル | +| `-verify ` | 検証に使用する公開鍵または証明書 | + +`-signature` と `-verify` の両方が指定された場合、 +入力データに対して署名の検証が行われます。 + +--- + +#### 注意事項 + +- ハッシュ化または署名対象となる入力データは、 + コマンドラインの **最後の引数** として指定する必要があります。 +- `-sign` と `-verify` オプションは同時に指定できません。 +- 署名検証時の結果は標準出力に表示されます。 +- 鍵ファイルおよび署名ファイルの形式は、 + `-inform` で指定した形式と一致している必要があります。 + +--- + +#### 例 + +秘密鍵を使用してデジタル署名を生成する例: + +```sh +wolfssl dgst -sha256 -sign keyPrivate.pem -out data.sig data.txt ``` -wolfssl dgst -verify keyPublic.pem -signature test.sig testfile + +デジタル署名を検証する例: + +```sh +wolfssl dgst -sha256 -signature data.sig -verify keyPublic.pem data.txt +``` +メッセージダイジェストを計算する例: + +```sh +wolfssl dgst -sha256 data.txt ``` diff --git a/wolfCLU/src-ja/genkey.md b/wolfCLU/src-ja/genkey.md index eb0ad421..e62178e8 100644 --- a/wolfCLU/src-ja/genkey.md +++ b/wolfCLU/src-ja/genkey.md @@ -1,18 +1,214 @@ -### GENKEY コマンド -RSA、ECC、ED25519、および DSA 鍵の生成に使用されます。 `-output KEY`を使用すると、-out 引数で与えたファイル名に .priv が追加された秘密鍵ファイルあるいは.pub が追加された公開鍵ファイルが作成されます。 ED25519 鍵を生成する場合には、wolfSSL を --enable-ed25519 でコンパイルしておく必要があります。 +### GENKEY コマンド — 暗号鍵の生成 -指定可能な引数: +`wolfssl genkey` コマンドは、対応する暗号アルゴリズムについて、 +公開鍵/秘密鍵のペア、または個別の公開鍵・秘密鍵を生成するために使用されます。 -- [-out] 出力先ファイル -- [rsa | ecc | ed25519] 生成する鍵のタイプ -- [-inkey] 入力ファイル -- [-size] 生成する鍵のサイズ(ビット数) -- [-outform] 出力形式(DER あるいは PEM)(デフォルト: DER) -- [-output] 生成する鍵(PUB, PRIV あるいは KEYPAIR)(デフォルト:KEYPAIR) -- [-exponent] RSA指数サイズ +本コマンドは OpenSSL の `genpkey` や関連コマンドと同様の思想に基づいた、 +鍵生成のための統一インタフェースを提供しますが、 +オプション体系はより簡潔かつ明示的になっています。 -使用例: +サポートされる鍵種別は wolfSSL のビルド構成に依存します。 +デフォルト構成では、以下の鍵種別が利用可能です。 +- `rsa` +- `ecc` +- `ed25519` +- `dilithium` +- `xmssmt` +- `xmss` + +--- + +#### 機能概要 + +`genkey` コマンドは、以下の鍵生成操作をサポートします。 + +- 公開鍵/秘密鍵ペアの生成 +- 秘密鍵のみの生成 +- 公開鍵のみの生成 +- 鍵の PEM / DER 形式での出力 + +鍵ペアを生成する場合、公開鍵と秘密鍵は別々のファイルとして出力され、 +ファイル名のサフィックスによって区別されます。 + +--- + +#### サポートされている鍵種別 + +| 鍵種別 | 説明 | +|---------|-------------| +| `rsa` | RSA 公開鍵/秘密鍵ペア | +| `ecc` | 楕円曲線暗号(ECC)鍵 | +| `ed25519` | Ed25519 署名鍵 | + +> **注意:** +> 利用可能な鍵種別は、wolfSSL の構成およびビルド方法に依存します。 + +--- + +#### 共通オプション + +| オプション | 説明 | +|------|-------------| +| `` | 生成する鍵の種別(`rsa`, `ecc`, `ed25519`) | +| `-size ` | 鍵サイズ(ビット単位、RSA のみ、任意) | +| `-out ` | 出力ファイルのベース名 | +| `-outform PEM \| DER` | 生成される鍵の出力形式 | +| `-output ` | 生成する鍵の種類を指定 | + +--- + +#### 出力仕様 + +出力されるファイルは、`-output` オプションの値によって決定されます。 + +| `-output` の値 | 生成されるファイル | +|----------------|--------------------| +| `KEYPAIR` | `.priv` および `.pub` | +| `PRIV` | `.priv` | +| `PUB` | `.pub` | + +ファイル拡張子は、`-out` で指定されたベース名に自動的に付与されます。 + +--- + +#### 注意事項 + +- `-size` が指定されていない場合、適用可能な場合にはデフォルトの鍵サイズが使用されます。 +- `-size` オプションは RSA 鍵にのみ適用されます。 +- ECC および Ed25519 鍵では、使用される曲線はビルド構成または内部のデフォルト設定によって決定されます。 +- 生成された鍵はファイルに直接出力され、対話的な入力は行われません。 + +--- + +#### 例 + +DER 形式で RSA 鍵ペアを生成する例: + +```sh +wolfssl genkey rsa -size 2048 -out mykey -outform der -output KEYPAIR ``` -wolfssl genkey rsa -size 2048 -out mykey -outform pem -output KEYPAIR + +#### RSA 固有オプション + +以下のオプションは、RSA 鍵生成時にのみ有効です。 + +| オプション | 説明 | +|------|-------------| +| `-exponent ` | RSA 公開指数を指定します(例: `65537`) | + +> **注意:** +> `-exponent` オプションは RSA 鍵生成時にのみ適用されます。 +> 指定されていない場合は、デフォルトの公開指数が使用されます。 + +##### 例 + +カスタム公開指数を指定して RSA 鍵ペアを生成する例: + +```sh +wolfssl genkey rsa -size 2048 -exponent 65537 -out mykey -outform pem -output KEYPAIR +``` + +#### 耐量子およびハッシュベース鍵種別 + +ビルド構成によっては、`genkey` コマンドは +**耐量子暗号(Post-Quantum Cryptography: PQC)** および +**ハッシュベース署名アルゴリズム** をサポートします。 + +これらの鍵種別は、量子計算機の出現を想定した将来耐性を目的としており、 +従来の公開鍵暗号とは異なる特性と運用上の注意点を持ちます。 + +--- + +##### Dilithium(耐量子署名) + +Dilithium は、格子暗号に基づく耐量子署名アルゴリズムです。 + +| オプション | 説明 | +|------|-------------| +| `dilithium` | Dilithium 耐量子署名鍵を生成 | +| `-level <2 \| 3 \| 5>` | Dilithium 鍵のセキュリティレベル | + +サポートされるセキュリティレベルは以下のとおりです。 + +- レベル 2 +- レベル 3 +- レベル 5 + +指定されたレベルにより、セキュリティ強度および鍵サイズが決定されます。 +一般に、レベルが高くなるほど安全性は向上しますが、 +鍵サイズおよび計算コストも増加します。 + +--- + +##### XMSSMT(マルチツリー XMSS) + +XMSSMT は、ハッシュベース署名方式である XMSS を +マルチツリー構造に拡張したアルゴリズムです。 + +| オプション | 説明 | +|------|-------------| +| `xmssmt` | XMSS マルチツリー(XMSSMT)鍵を生成 | +| `-height <20 \| 40 \| 60>` | ツリー全体の高さ | +| `-layer ` | マルチツリー構造におけるレイヤ数 | + +`-layer` に指定可能な値は、選択したツリー高さに依存します。 + +- 高さ 20 または 40 の場合: `2`, `4`, `8` +- 高さ 60 の場合: `3`, `6`, `12` + +> **注意:** +> ツリー全体の高さは、レイヤ数で割り切れる必要があります。 + +--- + +##### XMSS(シングルツリー XMSS) + +XMSS は、単一ツリー構造を持つハッシュベース署名アルゴリズムです。 + +| オプション | 説明 | +|------|-------------| +| `xmss` | シングルツリー XMSS 鍵を生成 | +| `-height <10 \| 16 \| 20>` | ツリーの高さ | + +サポートされるツリー高さは以下のとおりです。 + +- 10 +- 16 +- 20 + +ツリーの高さは、1 つの XMSS 鍵で生成可能な +**署名回数の上限** を決定します。 + +--- + +#### 耐量子鍵生成に関する注意事項 + +- 耐量子暗号およびハッシュベース署名アルゴリズムの利用可否は、 + wolfSSL のビルド構成および有効化された機能に依存します。 +- ツリー高さやセキュリティレベルを大きくすると、 + 鍵サイズが増大し、計算コストも増加します。 +- XMSS および XMSSMT 鍵は **生成可能な署名回数に上限がある** ため、 + 鍵の再利用回数を厳密に管理し、鍵枯渇を防ぐ必要があります。 + +--- + +##### 例 + +Dilithium レベル 3 の鍵ペアを生成する例: + +```sh +wolfssl genkey dilithium -level 3 -out pqkey -outform pem -output KEYPAIR +``` + +高さ 40、レイヤ数 4 の XMSSMT 鍵を生成する例: + +```sh +wolfxsl genkey xmssmt -height 40 -layer 4 -out xmssmtkey -outform pem -output KEYPAIR +``` + +高さ 16 の XMSS 鍵を生成する例: + +```sh +wolfssl genkey xmss -height 16 -out xmsskey -outform pem -output KEYPAIR ``` diff --git a/wolfCLU/src-ja/hash.md b/wolfCLU/src-ja/hash.md index d1c59344..184ff13f 100644 --- a/wolfCLU/src-ja/hash.md +++ b/wolfCLU/src-ja/hash.md @@ -1,19 +1,99 @@ -### HASH コマンド -入力データのハッシュを生成します。 +### HASH コマンド — ハッシュ計算およびエンコード処理 -サポートしているハッシュアルゴリズム: +`wolfssl hash` コマンドは、ファイルに対して +**暗号学的ハッシュ計算** や **エンコード/デコード処理** を行うための +シンプルなユーティリティです。 -- md5 -- sha -- sha256 -- sha384 -- sha512 -- base64enc -- base64dec +本コマンドは、指定されたアルゴリズムを用いて入力ファイルを処理し、 +結果を標準出力に表示します。 +OpenSSL の `openssl dgst` や `openssl enc` の一部機能に相当する、 +軽量で分かりやすいインタフェースを提供します。 +--- -使用例: +#### 機能概要 +`hash` コマンドは、以下の処理をサポートします。 + +- 暗号学的ハッシュ値の計算 +- Base64 エンコード +- Base64 デコード + +処理対象のファイルは `-in` オプションで指定します。 + +--- + +#### サポートされているアルゴリズム + +現在のビルド構成で利用可能なアルゴリズムは以下のとおりです。 + +- `md5` +- `sha` +- `sha256` +- `sha384` +- `sha512` +- `blake2b` +- `base64enc` +- `base64dec` + +> **注意:** +> 利用可能なアルゴリズムは、wolfSSL のビルド構成によって異なります。 + +--- + +#### コマンド構文 + +```sh +wolfssl hash <-algorithm> -in +``` + +#### 共通オプション + +| オプション | 説明 | +|------|-------------| +| `-in ` | 処理対象となる入力ファイル | +| `` | 使用するハッシュまたはエンコード/デコードアルゴリズム | + +--- + +#### 注意事項 + +- ハッシュ計算結果やエンコード/デコード結果は標準出力に表示されます。 +- 本コマンドは署名や検証処理は行いません。 + デジタル署名や署名検証を行う場合は `dgst` コマンドを使用してください。 +- `base64enc` および `base64dec` は暗号処理ではなく、 + データ表現の変換を目的とした機能です。 + +--- + +#### 例 + +SHA-1 ハッシュを計算する例: + +```sh +wolfssl hash sha -in data.txt +``` + +SHA-256 ハッシュを計算する例: + +```sh +wolfssl hash sha256 -in data.txt +``` + +BLAKE2b ハッシュを計算する例: + +```sh +wolfssl hash blake2b -in data.txt +``` + +Base64 エンコードを行う例: + +```sh +wolfssl hash base64enc -in data.bin +``` + +Base64 デコードを行う例: + +```sh +wolfssl hash base64dec -in data.b64 ``` -wolfssl -hash sha -in -``` \ No newline at end of file diff --git a/wolfCLU/src-ja/pkey.md b/wolfCLU/src-ja/pkey.md index fc4646b6..63c3ef5d 100644 --- a/wolfCLU/src-ja/pkey.md +++ b/wolfCLU/src-ja/pkey.md @@ -1,15 +1,87 @@ -### PKEY コマンド -一般的な鍵操作を処理するために使用されます。 読み込まれた鍵を stdout に出力します。 +### PKEY コマンド — 公開鍵/秘密鍵の汎用処理 -引数: +`wolfssl pkey` コマンドは、暗号鍵ファイルを対象として +**読み込み、内容確認、形式変換、および公開鍵の抽出** を行うための +**汎用的な鍵処理ユーティリティ**です。 -- [-in] 入力される鍵ファイル -- [-inform] 入力ファイル形式:pem あるいは der (デフォルト:pem) -- [-pubout] 公開鍵のみプリントアウトする -- [-pubin] 公開鍵を入力として期待する +RSA 鍵専用の `rsa` コマンドとは異なり、 +`pkey` コマンドは **複数の鍵種別** を単一のインタフェースで扱えるよう設計されています。 -使用例: +本コマンドは OpenSSL の `openssl pkey` コマンドと同様の機能を提供します。 +主な用途は以下のとおりです。 + +- 鍵の PEM / DER 形式変換 +- 秘密鍵から公開鍵の抽出 +- 単一コマンドによる複数鍵種別の処理 +- 鍵データの再エンコードや簡易確認 + +--- + +#### 機能概要 + +`pkey` コマンドは、既存の暗号鍵を対象として以下の操作をサポートします。 + +- 公開鍵または秘密鍵の読み込み +- 鍵エンコード形式の変換(PEM ↔ DER) +- 秘密鍵から公開鍵の出力 +- 鍵種別に依存しない汎用的な鍵処理 + +コマンドの挙動は、入力鍵が公開鍵か秘密鍵か、 +および指定されたオプションによって決まります。 + +--- + +#### 入出力 + +- **入力** + - 公開鍵または秘密鍵(PEM または DER) +- **出力** + - 公開鍵または秘密鍵(PEM または DER) + +--- + +#### 共通オプション + +| オプション | 説明 | +|------|-------------| +| `-in ` | 鍵を含む入力ファイル | +| `-out ` | 出力ファイル(省略時は標準出力) | +| `-inform pem \| der` | 入力鍵の形式 | +| `-outform pem \| der` | 出力鍵の形式 | +| `-pubin` | 入力が公開鍵であることを指定 | +| `-pubout` | 秘密鍵の代わりに公開鍵を出力 | + +--- + +#### 注意事項 + +- `-pubin` が指定されていない場合、入力は秘密鍵であると仮定されます。 +- `-pubout` が指定された場合、秘密鍵から公開鍵が抽出され、 + 指定された出力先に書き込まれます。 +- `pkey` コマンドは鍵の生成は行いません。 + 鍵生成には `genkey` コマンドを使用してください。 +- RSA モジュラスの表示など、アルゴリズム固有の詳細情報の表示には対応していません。 + 必要に応じて `rsa` などのアルゴリズム専用コマンドを使用してください。 + +--- + +#### 例 + +秘密鍵から公開鍵を抽出する例: + +```sh +wolfssl pkey -in key.pem -pubout -out pubkey.pem +``` + +鍵を PEM 形式から DER 形式に変換する例: + +```sh +wolfssl pkey -in key.pem -inform pem -outform der -out key.der ``` -./wolfssl pkey -in ./certs/server-key.pem -inform pem -pubout + +公開鍵を読み込み、出力する例: + +```sh +wolfssl pkey -pubin -in pubkey.pem -outform pem ``` diff --git a/wolfCLU/src-ja/req.md b/wolfCLU/src-ja/req.md index b332afb2..2139b561 100644 --- a/wolfCLU/src-ja/req.md +++ b/wolfCLU/src-ja/req.md @@ -1,22 +1,121 @@ -### REQ コマンド -証明書要求または自己署名証明書の作成に使用されます。 証明書をセットアップするための .conf ファイルのいくつかの基本的な解析を処理できます。 構成ファイルが使用されていない場合、stdin は証明書情報の入力を求められます。 +### REQ コマンド — 証明書要求および自己署名証明書の生成 +`wolfssl req` コマンドは、 +**証明書署名要求(Certificate Signing Request: CSR)** の生成および処理、ならびに +オプションとして **自己署名 X.509 証明書** を生成するために使用されます。 -指定可能な引数: +本コマンドは OpenSSL の `openssl req` コマンドと同様の機能を提供し、 +主に以下の用途を想定しています。 -- [-in] 入力ファイル -- [-out] 出力先ファイル(デフォルト:stdout) -- [-key] 証明書要求に含める公開鍵ファイル -- [-inform] 入力ファイル形式:pem あるいは der (デフォルト:pem) -- [-outform] 出力ファイル形式:pem あるいは der (デフォルト:pem) -- [-config] 証明書のコンフィグレーションファイル -- [-days] 有効期間(日数) -- [-x509] 自己署名証明書を生成する +- 新しい証明書署名要求(CSR)の生成 +- CSR に使用する秘密鍵の生成 +- 自己署名 X.509 証明書の生成 +- 既存 CSR の検証および内容確認 -使用例: +コマンドの挙動は指定されるオプションの組み合わせ、 +特に `-newkey`、`-inkey`、`-x509` によって決まります。 +--- + +#### 機能概要 + +`req` コマンドは、以下の主なユースケースをサポートします。 + +- **CSR の生成** + - 既存の秘密鍵を使用 + - リクエスト生成時に新しい秘密鍵を生成 +- **自己署名証明書の生成** + - CSR に基づいて X.509 証明書を直接生成 +- **CSR の確認および検証** + - CSR 内容の表示 + - CSR に付与された署名の検証 + +証明書の Subject 情報および拡張情報は、 +対話的入力または設定ファイルのいずれかで指定できます。 + +--- + +### 共通オプション + +| オプション | 説明 | +|------|-------------| +| `-in ` | 読み込む入力ファイル | +| `-out ` | 出力先ファイル(省略時は標準出力) | +| `-inform der \| pem` | `-in` で指定した入力ファイルの形式 | +| `-outform der \| pem` | `-out` で指定した出力形式 | +| `-config ` | 証明書要求の設定を記述した設定ファイル | +| `-subj ` | コマンドラインで Subject 名を指定 | +| `-text` | CSR を人間可読形式で出力 | +| `-noout` | エンコードされた CSR または証明書を出力しない | + +--- + +#### 鍵および CSR 生成関連オプション + +これらのオプションは、秘密鍵および CSR の生成方法を制御します。 + +| オプション | 説明 | +|------|-------------| +| `-newkey ` | リクエスト用の新しい秘密鍵を生成 | +| `-keyout ` | 新しく生成した秘密鍵の出力先 | +| `-nodes` | 出力される秘密鍵を暗号化しない | +| `-inkey ` | 既存の秘密鍵を使用 | +| `-key ` | 証明書要求に含める公開鍵 | + +--- + +#### 自己署名証明書関連オプション + +| オプション | 説明 | +|------|-------------| +| `-x509` | CSR の代わりに自己署名 X.509 証明書を生成 | +| `-days ` | 証明書の有効日数 | +| `-extensions
` | 設定ファイル内で使用する拡張定義セクション | + +--- + +#### 検証関連オプション + +| オプション | 説明 | +|------|-------------| +| `-verify` | CSR に付与された署名を検証 | + +--- + +#### 注意事項 + +- `-x509` を指定した場合、出力は CSR ではなく X.509 証明書になります。 +- `-newkey` オプションは、新しい秘密鍵を生成し、それを CSR に関連付けます。 +- `-newkey` と `-inkey` のいずれも指定されていない場合、 + コマンドは他の手段で鍵が提供されることを前提とします。 +- CSR を CA 鍵で署名する場合は、`x509 -req` コマンドを使用してください。 + +--- + +#### 例 + +新しい CSR と秘密鍵を生成する例: + +```sh +wolfssl req -newkey rsa:2048 -keyout server.key -out server.csr +``` + +自己署名証明書を生成する例: + +```sh +wolfssl req -x509 -newkey rsa:2048 -days 365 \ + -keyout server.key -out server.crt +``` + +既存 CSR の内容を表示する例: + +```sh +wolfssl req -in server.csr -text ``` -wolfssl ecparam -genkey -out ecc.key -name secp384r1 -wolfssl req -new -x509 -days 3650 -config selfsigned.conf -key ecc.key -out ecc.cert \ --outform der -sha256 + +CSR の署名を検証する例: + +```sh +wolfssl req -in server.csr -verify ``` + diff --git a/wolfCLU/src-ja/rsa.md b/wolfCLU/src-ja/rsa.md index 6611aacf..8d196a7c 100644 --- a/wolfCLU/src-ja/rsa.md +++ b/wolfCLU/src-ja/rsa.md @@ -1,14 +1,121 @@ -### RSA コマンド +### RSA コマンド — RSA 鍵の処理および内容確認 -RSA操作を行います。 RSA鍵の読み取り、RSA鍵またはモジュラスの出力、暗号化された PEM ファイルの読み取りが含まれます。 入力と出力の DER と PEM 形式の両方を処理できます。 +`wolfssl rsa` コマンドは、RSA 鍵の **読み込み、内容確認、形式変換、および情報抽出** +を行うために使用されます。 -引数: +本コマンドは OpenSSL の `openssl rsa` コマンドと同様の機能を提供し、 +PEM または DER 形式の RSA 秘密鍵および公開鍵の両方をサポートします。 -- [-in] 入力となる鍵ファイル -- [-inform] 入力ファイル形式:PEM あるいは DER (デフォルト:PEM) -- [-out] 出力ファイル(デフォルト:stdout) -- [-outform] 出力ファイル形式:PEM あるいは DER (デフォルト:PEM) -- [-passin] PEM形式の暗号化されたファイルのパスワード -- [-noout] 鍵をプリントアウトしない -- [-modulus] RSA modulus (n value)をプリントする -- [-RSAPublicKey_in] 公開鍵入力を期待する +主な用途は以下のとおりです。 + +- RSA 鍵の PEM / DER 形式変換 +- RSA 鍵構成要素の表示 +- RSA モジュラスの抽出 +- 暗号化された PEM 形式秘密鍵の処理 +- 公開鍵および秘密鍵の表現変換 + +--- + +#### 機能概要 + +`rsa` コマンドは、既存の RSA 鍵を対象として以下の操作をサポートします。 + +- RSA 秘密鍵または公開鍵の読み込み +- 鍵エンコード形式の変換(PEM ↔ DER) +- 秘密鍵から公開鍵を出力 +- モジュラスなどの RSA パラメータの表示 +- パスワードで保護された PEM 形式秘密鍵の処理 + +コマンドの挙動は、入力された鍵が秘密鍵か公開鍵か、 +および指定されたオプションによって決まります。 + +--- + +#### 入出力 + +- **入力** + - RSA 秘密鍵または公開鍵(PEM または DER) +- **出力** + - RSA 秘密鍵または公開鍵(PEM または DER)、または指定された鍵情報 + +--- + +#### 共通オプション + +| オプション | 説明 | +|------|-------------| +| `-in ` | RSA 鍵を含む入力ファイル | +| `-inform PEM \| DER` | 入力鍵の形式 | +| `-out ` | 出力ファイル(省略時は標準出力) | +| `-outform PEM \| DER` | 出力鍵の形式 | +| `-passin ` | 暗号化された PEM 秘密鍵のパスワード | +| `-noout` | 鍵本体を出力しない | + +--- + +#### 公開鍵・秘密鍵の取り扱いオプション + +以下のオプションは、入力鍵および出力鍵の扱い方を制御します。 + +| オプション | 説明 | +|------|-------------| +| `-RSAPublicKey_in` | RSAPublicKey 形式の RSA 公開鍵が入力されることを指定 | +| `-pubin` | 公開鍵が入力されることを指定 | +| `-pubout` | 秘密鍵の代わりに公開鍵を出力 | + +> **注意:** +> `-RSAPublicKey_in` および `-pubin` は、 +> 入力が公開鍵であることを明示的に指定するために使用されます。 + +--- + +#### RSA パラメータ出力オプション + +| オプション | 説明 | +|------|-------------| +| `-modulus` | RSA モジュラス(`n` 値)を表示 | + +`-modulus` が指定された場合、モジュラス値は +16 進数形式で表示されます。 + +--- + +#### 注意事項 + +- `-pubin` および `-RSAPublicKey_in` のいずれも指定されていない場合、 + 入力は RSA 秘密鍵であると仮定されます。 +- 暗号化された PEM 形式の秘密鍵を処理する場合、 + `-passin` オプションの指定が必要です。 +- `-noout` オプションを指定すると、 + 鍵本体の出力は抑制されますが、 + `-modulus` などのパラメータ出力は可能です。 +- 本コマンドは RSA 鍵の生成は行いません。 + 鍵生成には `genkey` コマンドを使用してください。 + +--- + +#### 例 + +PEM 形式の RSA 秘密鍵を DER 形式に変換する例: + +```sh +wolfssl rsa -in rsa-key.pem -inform PEM -outform DER -out rsa-key.der +``` + +RSA モジュラスを表示する例: + +```sh +wolfssl rsa -in rsa-key.pem -modulus -noout +``` + +秘密鍵から公開鍵を抽出する例: + +```sh +wolfssl rsa -in rsa-key.pem -pubout -out rsa-pub.pem +``` + +RSA 公開鍵を読み込み、出力する例: + +```sh +wolfssl rsa -pubin -in rsa-pub.pem -outform PEM +``` diff --git a/wolfCLU/src-ja/s_client.md b/wolfCLU/src-ja/s_client.md index 2d5cce87..d04a21af 100644 --- a/wolfCLU/src-ja/s_client.md +++ b/wolfCLU/src-ja/s_client.md @@ -1,14 +1,147 @@ -### S_CLIENT コマンド -基本的なTLS接続がサポートされています。 現在、ピアを検証していません。-CAfile オプションはまだ完了していません。 +### S_CLIENT コマンド — TLS クライアント接続および診断 +`wolfssl s_client` コマンドは、リモートサーバに対して +**TLS/SSL クライアント接続を確立し、その挙動を確認・診断するためのユーティリティ** +です。 -引数: +本コマンドは OpenSSL の `openssl s_client` コマンドと同様の機能を提供し、 +以下のような用途で広く使用されます。 -- [-connect] ipアドレス:port番号 +- サーバへの TLS 接続性の確認 +- サーバ証明書および証明書チェーンの確認 +- CA 証明書を用いたサーバ証明書検証 +- TLS ハンドシェイクや STARTTLS 動作のデバッグ +--- -使用例 : +#### 機能概要 +`s_client` コマンドは、指定されたサーバに接続し、 +TLS ハンドシェイクを実行します。 + +指定されたオプションに応じて、以下の動作をサポートします。 + +- TCP エンドポイントへの直接的な TLS 接続 +- SMTP などのプロトコルに対する STARTTLS による TLS 接続 +- CA 証明書を用いたサーバ証明書の検証 +- 証明書検証失敗時の即時接続終了 + +本コマンドは、**対話的なテストや診断用途**を目的としており、 +本番システムでの自動接続用途を想定したものではありません。 + +--- + +#### 接続先の指定 + +接続先は `-connect` オプションで指定します。 +IPv4 および IPv6 アドレスの両方がサポートされています。 + +IPv6 アドレスを指定する場合は、角括弧(`[]`)で囲む必要があります。 + +例: + +```sh +-connect 127.0.0.1:443 +-connect '[::1]:11111' +-connect '[fe80::63:57c0:9b88:77ca%en0]:11111' +-connect '[2001:4860:4860::8888]:443' ``` -wolfssl s_client -connect 127.0.0.1:11111 -``` \ No newline at end of file + +#### STARTTLS サポート + +`-starttls` オプションを指定することで、 +平文通信から TLS に切り替える **STARTTLS** を使用することができます。 + +STARTTLS は、SMTP などの一部アプリケーションプロトコルにおいて、 +初期接続は平文で行い、その後の明示的な要求によって +通信を TLS にアップグレードする仕組みです。 + +`s_client` コマンドでは、STARTTLS を有効にすると、 +以下の流れで通信が行われます。 + +1. 指定されたサーバおよびポートに平文で接続 +2. プロトコル固有の STARTTLS コマンドを送信 +3. サーバが STARTTLS を受け入れたことを確認 +4. TLS ハンドシェイクを開始 + +--- + +##### サポートされているプロトコル + +現在、`s_client` コマンドで STARTTLS がサポートされている +プロトコルの例は以下のとおりです。 + +- `smtp` + +> **注意:** +> サポートされる STARTTLS プロトコルは、 +> wolfSSL のビルド構成および実装状況によって異なります。 + +--- + +##### 使用例 + +SMTP サーバに対して STARTTLS を使用する例: + +```sh +wolfssl s_client -connect mail.example.com:25 -starttls smtp +``` + +この場合、SMTP プロトコルに従い、以下の手順で通信が行われます。 + +1. クライアントが SMTP サーバに平文で接続します。 +2. クライアントが `EHLO` コマンドを送信し、サーバの拡張機能を確認します。 +3. サーバが `STARTTLS` 拡張をサポートしていることを応答で確認します。 +4. クライアントが `STARTTLS` コマンドを送信します。 +5. サーバが `STARTTLS` 要求を受け入れると、平文の SMTP セッションは終了します。 +6. その後、TLS ハンドシェイクが開始され、通信は暗号化されます。 + + +### 共通オプション + +| オプション | 説明 | +|------|-------------| +| `-connect ` | 接続先サーバのアドレスおよびポート番号 | +| `-starttls ` | 指定したプロトコルで STARTTLS を有効化(例: `smtp`) | +| `-CAfile ` | サーバ証明書検証に使用する信頼済み CA 証明書 | +| `-verify_return_error` | 証明書検証に失敗した場合、直ちに接続を終了 | +| `-disable_stdin_check` | セッション中の標準入力の状態チェックを無効化 | + +--- + +### 注意事項 + +- `-connect` オプションは IPv4 および IPv6 アドレスの両方に対応しています。 + IPv6 アドレスを指定する場合は、角括弧(`[]`)で囲む必要があります。 +- `-starttls` オプションは、SMTP など、平文通信から TLS に + アップグレードするプロトコルで使用します。 +- `-verify_return_error` を指定しない場合、証明書検証に失敗しても、 + 設定によっては接続が継続されることがあります。 +- `-disable_stdin_check` は、非対話的な実行やスクリプト用途を + 想定したオプションです。 + +--- + +### 例 + +TLS サーバへ接続する例: + +```sh +wolfssl s_client -connect example.com:443 +``` + +SMTP で STARTTLS を使用する例: + +```sh +wolfssl s_client -connect mail.example.com:25 -starttls smtp +``` + +証明書検証を行い、失敗時に接続を終了する例: + +```sh +wolfssl s_client -connect example.com:443 \ + -CAfile ca-cert.pem \ + -verify_return_error +``` + + diff --git a/wolfCLU/src-ja/s_server.md b/wolfCLU/src-ja/s_server.md new file mode 100644 index 00000000..e94fae00 --- /dev/null +++ b/wolfCLU/src-ja/s_server.md @@ -0,0 +1,140 @@ +### S_SERVER コマンド — TLS サーバ起動および動作確認 + +`wolfssl s_server` コマンドは、指定した証明書と秘密鍵を用いて +**簡易的な TLS/SSL サーバを起動するための診断用ユーティリティ**です。 + +本コマンドは OpenSSL の `openssl s_server` コマンドと同様の用途を持ち、 +主に以下のような目的で使用されます。 + +- TLS サーバ側の動作確認 +- 証明書および秘密鍵の正当性確認 +- クライアント証明書検証のテスト +- TLS バージョンネゴシエーションの確認 +- `s_client` などを用いた相互接続テスト + +--- + +#### 機能概要 + +`s_server` コマンドは、指定されたポートで待ち受けを行い、 +クライアントからの接続を受け付けて TLS ハンドシェイクを実行します。 + +オプションに応じて、以下のような動作が可能です。 + +- 指定した証明書・秘密鍵による TLS サーバ起動 +- クライアント証明書検証の有効/無効切り替え +- 使用する TLS バージョンの制限 +- 複数回の接続受付 +- 簡易的な HTTP(HTML)レスポンスの送信 + +本コマンドは **テスト・検証用途**を目的としており、 +本番環境向けの高機能なサーバ実装ではありません。 + +--- + +#### 入出力 + +- **入力** + - サーバ証明書(PEM 形式) + - サーバ秘密鍵(PEM 形式) + - (任意)クライアント証明書検証用 CA 証明書 +- **出力** + - 接続状況および TLS ハンドシェイクに関する情報(標準出力) + +--- + +#### 共通オプション + +| オプション | 説明 | +|------|-------------| +| `-port ` | 待ち受ける TCP ポート番号 | +| `-key ` | サーバ秘密鍵ファイル(PEM 形式のみ対応) | +| `-cert ` | サーバ証明書ファイル(PEM 形式のみ対応) | +| `-CAfile ` | クライアント証明書検証に使用する CA 証明書(PEM 形式のみ) | +| `-noVerify` | クライアント証明書検証を無効化 | +| `-version ` | 使用する SSL/TLS バージョンを指定 | +| `-naccept ` | 接続を受け付ける回数(デフォルト: 1) | +| `-www` | HTTP 形式(HTML)のレスポンスを返す | +| `-readyFile ` | サーバ起動完了を通知するファイルを作成 | + +--- + +#### TLS バージョン指定(-version) + +`-version` オプションを使用することで、 +受け付ける SSL/TLS バージョンを制限できます。 + +| 値 | 対応プロトコル | +|----|----------------| +| `0` | SSLv3 | +| `1` | TLS 1.0 | +| `2` | TLS 1.1 | +| `3` | TLS 1.2 | +| `4` | TLS 1.3 | + +> **注意:** +> 実際に使用可能なプロトコルは、wolfSSL のビルド構成によって異なります。 + +--- + +#### クライアント証明書検証 + +- デフォルトでは、クライアント証明書の検証が有効です。 +- `-noVerify` を指定すると、クライアント証明書は要求・検証されません。 +- クライアント証明書を検証する場合は、 + `-CAfile` で信頼する CA 証明書を指定する必要があります。 + +--- + +#### 注意事項 + +- `-key` および `-cert` オプションで指定するファイルは + **PEM 形式のみ対応**しています。 +- 本コマンドは単純な TLS サーバであり、 + 高負荷・高機能なサーバ用途には適していません。 +- `-www` オプションは、TLS 接続確認を容易にするための簡易機能です。 +- `-readyFile` は、外部監視ツールなどから + サーバ起動完了を検知するために使用できます。 + +--- + +#### 例 + +TLS サーバをポート 4433 で起動する例: + +```sh +wolfssl s_server \ + -port 4433 \ + -cert server-cert.pem \ + -key server-key.pem +``` + +TLS 1.2 のみを使用するサーバを起動する例: + +```sh +wolfssl s_server \ + -port 4433 \ + -cert server-cert.pem \ + -key server-key.pem \ + -version 3 +``` + +クライアント証明書検証を無効にする例: + +```sh +wolfssl s_server \ + -port 4433 \ + -cert server-cert.pem \ + -key server-key.pem \ + -noVerify +``` + +複数回の接続を受け付ける例: + +```sh +wolfssl s_server \ + -port 4433 \ + -cert server-cert.pem \ + -key server-key.pem \ + -naccept 10 +``` diff --git a/wolfCLU/src-ja/verify.md b/wolfCLU/src-ja/verify.md index 1bbb1b37..6ea35779 100644 --- a/wolfCLU/src-ja/verify.md +++ b/wolfCLU/src-ja/verify.md @@ -1,15 +1,109 @@ -### VERIFY コマンド +### VERIFY コマンド — X.509 証明書の検証 -CA が指定された X509 証明書を検証します。 コマンドに渡される最後の引数は、検証する証明書ファイルの名前です。 検証が成功すると、「OK」が stdout に出力されます。 それ以外の場合、エラー値と理由が出力されます。 +`wolfssl verify` コマンドは、**信頼された認証局(Certificate Authority: CA)** に基づいて +X.509 証明書を **検証** するために使用されます。 -引数: +本コマンドは OpenSSL の `openssl verify` コマンドと同様の +証明書チェーン検証を行いますが、 +一般的な検証シナリオに焦点を当てた簡易的な機能セットとなっています。 -- [-CAfile] 検証に使用するCA証明書ファイル -- [-crl_check] CRL検証が必要 -- [-untrusted] 検証に使用する中間証明書のファイル名(現在は1つの-untrusted証明書のみサポートしています) +CA 証明書を用いた検証に加え、 +任意で中間証明書の指定や証明書失効リスト(CRL)による失効確認をサポートします。 -使用例: +--- +#### 機能概要 + +`verify` コマンドは、X.509 証明書に対して以下の検証を行います。 + +- 信頼された CA による証明書署名の検証 +- 証明書チェーンの検証(ルート証明書および中間証明書) +- 任意で CRL に基づく証明書失効チェック + +検証に成功した場合、標準出力に `OK` が表示されます。 +検証に失敗した場合は、エラーコードおよび理由が出力されます。 + +--- + +#### コマンド構文 + +```sh +wolfssl verify -CAfile \ + [-untrusted ] \ + [-crl_check] \ + [-partial_chain] \ + ``` -wolfssl verify -CAfile ./certs/ca-cert.pem ./certs/server-cert.pem + +#### 入力 + +- **CA 証明書** + - `-CAfile` オプションで指定する、信頼されたルート CA 証明書 +- **中間証明書(任意)** + - `-untrusted` オプションで指定する中間証明書 +- **検証対象証明書** + - コマンドラインの最後の引数として指定する、検証対象の証明書 + +--- + +#### 共通オプション + +| オプション | 説明 | +|------|-------------| +| `-CAfile ` | 検証に使用する信頼済み CA 証明書 | +| `-untrusted ` | 証明書チェーン構築に使用する中間証明書 | +| `-crl_check` | 証明書失効リスト(CRL)を用いた失効チェックを有効化 | +| `-partial_chain` | 不完全な証明書チェーンでも検証を許可 | + +> **注意:** +> 現在の実装では、`-untrusted` オプションで指定できる +> 中間証明書は **1 つのみ** です。 + +--- + +#### 検証時の挙動 + +- 最後の引数で指定された証明書は、`-CAfile` で指定された + 信頼済み CA に基づいて検証されます。 +- `-untrusted` が指定された場合、その証明書は + チェーン構築時の中間証明書として使用されます。 +- `-crl_check` を指定すると、利用可能な CRL を用いて + 証明書が失効していないか確認されます。 +- `-partial_chain` を指定した場合、自己署名ルート証明書までの + 完全なチェーンが存在しなくても、検証が成功する場合があります。 + +--- + +#### 注意事項 + +- `-CAfile` オプションは必須です。 +- `-untrusted` で指定可能な中間証明書は 1 つのみです。 +- CRL チェックを使用するには、wolfSSL を CRL サポート有効で + ビルドしている必要があります。 +- 本コマンドは検証のみを行い、不足している証明書や CRL を + 自動取得することはありません。 + +--- + +#### 例 + +CA 証明書を用いて証明書を検証する例: + +```sh +wolfssl verify -CAfile ca-cert.pem server-cert.pem +``` + + +中間証明書を指定して検証する例: + +```sh +wolfssl verify -CAfile ca-cert.pem \ + -untrusted intermediate-cert.pem \ + server-cert.pem +``` + +CRL チェックを有効にして検証する例: + +```sh +wolfssl verify -CAfile ca-cert.pem -crl_check server-cert.pem ``` \ No newline at end of file diff --git a/wolfCLU/src-ja/x509.md b/wolfCLU/src-ja/x509.md index b25a1cc9..2492fafe 100644 --- a/wolfCLU/src-ja/x509.md +++ b/wolfCLU/src-ja/x509.md @@ -1,17 +1,132 @@ -### X509 コマンド -このコマンドは、証明書の解析と出力に使用されます。 +### X509 コマンド — 証明書の解析・表示および署名 -引数: +`wolfssl x509` コマンドは、X.509 証明書および +証明書署名要求(Certificate Signing Request: CSR)を扱うための +汎用ユーティリティです。 -- [-in] 入力となるX509証明書ファイル -- [-inform] 入力ファイル形式:pem あるいは der (デフォルト:pem) -- [-out] 出力先ファイル -- [-outform] 出力ファイル形式:pem あるいは der(デフォルト:pem) -- [-pubkey] 公開鍵のみ出力する -- [-text] 証明書を出力する +本コマンドは **2 つの明確に異なる動作モード** を持っており、 +`-req` オプションが指定されているかどうかによって +振る舞いが大きく変化します。 -使用例: +- **証明書解析・表示モード(デフォルト)** +- **CSR 処理・証明書生成モード(`-req` 指定時)** +インタフェースおよび全体的な挙動は OpenSSL の +`openssl x509` コマンドに意図的に近づけられており、 +内部的には wolfSSL の X.509 解析および証明書処理実装に基づいて動作します。 + +主な用途は以下のとおりです。 + +- X.509 証明書の PEM / DER 形式変換 +- 証明書内容の確認(Subject、Issuer、有効期間、公開鍵など) +- シリアル番号、フィンガープリント、ハッシュ値などの証明書メタ情報の表示 +- CSR を入力として X.509 証明書を生成および署名 + +--- + +#### 動作モード + +##### 証明書解析・表示モード(デフォルト) + +`-req` オプションが指定されていない場合、入力ファイルは +**X.509 証明書** として扱われます。 + +このモードでは、既存の証明書に対する解析、表示、および形式変換が +主な目的となります。 + +主な操作内容は以下のとおりです。 + +- 人間可読形式での証明書内容の表示 +- 特定の証明書フィールドの抽出(Subject、Issuer、有効期間など) +- 公開鍵または RSA モジュラスの出力 +- PEM / DER 間での証明書形式変換 + +このモードでは **証明書の署名処理は行われません**。 + +##### 共通オプション + +| オプション | 説明 | +|------|-------------| +| `-inform pem \| der` | 入力証明書の形式 | +| `-in ` | 入力証明書ファイル | +| `-outform pem \| der` | 出力証明書の形式 | +| `-out ` | 出力ファイル | +| `-noout` | エンコードされた証明書を出力しない | +| `-text` | 証明書を人間可読形式で表示 | +| `-subject` | Subject 識別名を表示 | +| `-issuer` | Issuer 識別名を表示 | +| `-serial` | 証明書のシリアル番号を 16 進数で表示 | +| `-dates` | 証明書の有効期間を表示 | +| `-email` | Subject に含まれるメールアドレスを表示 | +| `-fingerprint` | 証明書のフィンガープリント(DER エンコードのハッシュ)を表示 | +| `-purpose` | 証明書の用途を表示 | +| `-hash` | Subject 名のハッシュ値を表示 | +| `-modulus` | RSA 公開鍵のモジュラスを表示 | +| `-pubkey` | 公開鍵を出力 | + +##### 例 + +```sh +wolfssl x509 -in cert.pem -text +wolfssl x509 -in cert.pem -subject -issuer -dates +wolfssl x509 -inform pem -in cert.pem -outform der -out cert.der ``` -wolfssl x509 -in ./certs/server-cert.pem -text -``` + +##### CSR 処理・証明書生成モード(`-req`) + +`-req` オプションが指定されると、入力ファイルは証明書ではなく +**証明書署名要求(Certificate Signing Request: CSR)** として解釈されます。 + +このモードでは、`wolfssl x509` は以下の用途に使用できます。 + +- CSR の処理および内容確認 +- CSR に基づく X.509 証明書の生成および署名 +- 設定ファイルからの証明書拡張の適用 +- 署名に使用するダイジェストアルゴリズムの選択 + +`-signkey`、ダイジェスト指定(`-sha256` など)、 +`-extfile`、`-extensions` といったオプションは、 +**このモードでのみ意味を持ちます**。 + +--- + +###### 注意事項 + +- `-in` で指定された入力ファイルの意味は、`-req` の有無によって異なります。 +- 一部のオプションは特定の動作モードでのみ有効であり、 + 他のモードでは無視されるか、無効となります。 +- CSR 自体を生成する場合は、専用の `req` コマンドを使用してください。 + +--- + +###### CSR 専用オプション + +以下のオプションは、**`-req` が指定されている場合にのみ有効**です。 + +| オプション | 説明 | +|------|-------------| +| `-req` | CSR 処理モードを有効化 | +| `-signkey ` | 生成される証明書の署名に使用する秘密鍵 | +| `-*`(例: `-sha256`, `-sha384`) | 証明書署名に使用するダイジェストアルゴリズム | +| `-extfile ` | X.509 拡張を定義した設定ファイル | +| `-extensions
` | 使用する拡張定義セクション名 | + +証明書表示関連のオプション(`-issuer`、`-serial`、`-dates` など)は、 +このモードでは一般的に適用されません。 + +--- + +###### 例 + +SHA-256 を用いて CSR から X.509 証明書を生成し、 +拡張情報を設定ファイルから適用する例を示します。 + +```sh +wolfssl x509 -req \ + -in server.csr \ + -signkey ca-key.pem \ + -sha256 \ + -extfile cert.conf \ + -extensions v3_server \ + -out server-cert.pem +``` \ No newline at end of file diff --git a/wolfCLU/src/ca.md b/wolfCLU/src/ca.md index 6cc1cd16..dd5cdb6e 100644 --- a/wolfCLU/src/ca.md +++ b/wolfCLU/src/ca.md @@ -1,21 +1,128 @@ -### CA Command -Used for signing Certificates. Can handle some basic config file parsing. +### CA Command — Certificate Authority Signing and Certificate Issuance -Available arguments are: +The `wolfssl ca` command is used to **sign Certificate Signing Requests (CSRs)** +and issue X.509 certificates, acting as a basic **Certificate Authority (CA)** +utility. -- [-in] input CSR file -- [-out] file to write to -- [-keyfile] file to read private key from -- [-cert] file to read CA from -- [-extensions] section in config file to parse extensions from -- [-md] type of hash to use i.e sha, sha256, ... -- [-inform] PEM/DER type of CSR input -- [-config] file to parse for configuration -- [-days] number of days should be valid for -- [-selfsign] sign with key associated with input cert +This command provides functionality similar to OpenSSL’s `openssl ca` command, +with a simplified feature set focused on common certificate signing operations. +It supports signing CSRs using a CA certificate and private key, as well as +generating self-signed certificates. -Example: +Typical use cases include: +- Signing a CSR with a CA private key to issue an X.509 certificate +- Applying certificate extensions from a configuration file +- Controlling certificate validity period and signature algorithm +- Generating self-signed certificates for testing or internal use + +--- + +#### Functional Overview + +The `ca` command operates on a CSR input and produces a signed X.509 certificate. + +Depending on the options used, it supports the following modes of operation: + +- **CA-signed certificate generation** + - A CSR is signed using a CA certificate and its associated private key +- **Self-signed certificate generation** + - The certificate is signed using the private key associated with the input + certificate (`-selfsign`) + +The command relies on a configuration file for parsing certificate extensions +and other certificate-related parameters. + +--- + +#### Input and Output + +- **Input** + - Certificate Signing Request (CSR) +- **Output** + - X.509 certificate (PEM or DER) + +--- + +#### Common Options + +| Option | Description | +|------|-------------| +| `-in ` | Input CSR file | +| `-out ` | Output file for the generated certificate | +| `-inform PEM \| DER` | Input format of the CSR | +| `-outform PEM \| DER` | Output format of the certificate | +| `-config ` | Configuration file for certificate parameters | +| `-days ` | Number of days the certificate should be valid | +| `-md ` | Message digest algorithm used for signing (e.g. `sha256`) | + +--- + +#### CA Key and Certificate Options + +These options specify the CA credentials used for signing. + +| Option | Description | +|------|-------------| +| `-keyfile ` | Private key used to sign the certificate | +| `-cert ` | CA certificate corresponding to the signing key | + +--- + +#### Extension Handling Options + +| Option | Description | +|------|-------------| +| `-extensions
` | Section name in the configuration file from which to parse certificate extensions | + +--- + +#### Self-Signed Certificate Option + +| Option | Description | +|------|-------------| +| `-selfsign` | Sign the certificate using the private key associated with the input certificate | + +> **Note:** +> When `-selfsign` is specified, the certificate is signed using its own key, +> rather than a separate CA key. + +--- + +#### Notes + +- The input file specified by `-in` must be a valid CSR. +- When generating a CA-signed certificate, both `-keyfile` and `-cert` + must be specified. +- Extension parsing is limited to basic configuration file support. +- This command does not manage certificate databases or serial number files, + unlike OpenSSL’s full `ca` command. + +--- + +#### Examples + +Sign a CSR using a CA certificate and private key: + +```sh +wolfssl ca \ + -config ca.conf \ + -in server.csr \ + -out server-cert.pem \ + -cert ca-cert.pem \ + -keyfile ca-key.pem \ + -md sha256 \ + -days 365 ``` -wolfssl ca -config ca.conf -in test.csr -out test.pem -md sha256 -selfsign -keyfile ./key + +Generate a self-signed certificate: + +```sh +wolfssl ca \ + -config selfsign.conf \ + -in server.csr \ + -out server-cert.pem \ + -selfsign \ + -md sha256 \ + -days 365 ``` diff --git a/wolfCLU/src/crl.md b/wolfCLU/src/crl.md index 175e8e25..db7c350f 100644 --- a/wolfCLU/src/crl.md +++ b/wolfCLU/src/crl.md @@ -1,15 +1,88 @@ -### CRL Command -Used to verify a CRL file given a CA, or to convert a CRL from one format [DER | PEM] to the other. The command will print out the CRL to stdout if -out is not specified and -noout is not used. Prints out "OK" on successful verification. +### CRL Command — Certificate Revocation List Processing and Inspection -- [-CAfile] -- [-inform] pem or der in format -- [-in] the file to read from -- [-outform] pem or der out format -- [-out] output file to write to -- [-noout] do not print output if set +The `wolfssl crl` command is used to **read, inspect, convert, and display +Certificate Revocation Lists (CRLs)**. -Example: +This command provides functionality similar to OpenSSL’s `openssl crl` +command and is intended for examining CRL contents and converting CRLs +between encoding formats. +Typical use cases include: + +- Displaying CRL contents in human-readable form +- Converting CRLs between PEM and DER formats +- Verifying CRL issuer information against a CA certificate +- Inspecting CRL metadata such as update times and revoked certificates + +--- + +#### Functional Overview + +The `crl` command operates on an existing Certificate Revocation List and +supports the following operations: + +- Reading CRLs in PEM or DER format +- Converting CRLs between PEM and DER encodings +- Printing CRL contents in a human-readable text format +- Suppressing encoded output when inspection only is desired + +The command does not generate CRLs; it is intended solely for CRL inspection +and format handling. + +--- + +#### Input and Output + +- **Input** + - Certificate Revocation List (CRL) in PEM or DER format +- **Output** + - CRL in PEM or DER format, or human-readable CRL information + +--- + +#### Common Options + +| Option | Description | +|------|-------------| +| `-CAfile ` | CA certificate used to verify the CRL issuer | +| `-in ` | Input CRL file | +| `-inform pem \| der` | Input CRL format | +| `-out ` | Output file for the CRL | +| `-outform pem \| der` | Output CRL format | +| `-noout` | Do not output the encoded CRL | +| `-text` | Output CRL contents in human-readable form | + +--- + +#### Notes + +- The `-in` option must specify a valid CRL file. +- The `-CAfile` option may be used to associate the CRL with a trusted CA. +- When `-text` is specified, CRL details such as issuer, update times, + and revoked certificate entries are printed. +- The `-noout` option suppresses output of the encoded CRL, but does not + suppress text output when `-text` is used. +- This command does not fetch CRLs automatically; it operates only on + locally provided files. + +--- + +#### Examples + +Display CRL contents in human-readable form: + +```sh +wolfssl crl -in crl.pem -text +``` + +Convert a CRL from PEM to DER format: + +```sh +wolfssl crl -in crl.pem -inform pem -outform der -out crl.der ``` -wolfssl crl -CAfile ./certs/ca-cert.pem -in ./certs/crl.der -inform DER -noout + +Inspect a CRL without outputting the encoded data: + +```sh +wolfssl crl -in crl.pem -text -noout ``` diff --git a/wolfCLU/src/dgst.md b/wolfCLU/src/dgst.md index bbfba125..972ca568 100644 --- a/wolfCLU/src/dgst.md +++ b/wolfCLU/src/dgst.md @@ -1,34 +1,116 @@ -### DGST Command -Can verify the signature. The last argument is the data that was signed. +### DGST Command — Message Digest and Digital Signature Operations -Hash algos supported: +The `wolfssl dgst` command is used to compute cryptographic message digests +and to **create or verify digital signatures** over input data. -- [-sha] -- [-sha224] -- [-sha256] -- [-sha384] -- [-sha512] +This command provides functionality similar to OpenSSL’s `openssl dgst` +command. The last argument on the command line specifies the input data +to be hashed or signed. -**Sign** +Typical use cases include: -Parameters: +- Computing a message digest (hash) of input data +- Creating a digital signature using a private key +- Verifying a digital signature using a public key or certificate -- [-sign] key used to create signature -- [-out] file to write signature to +--- -Example: -``` -wolfssl dgst -sign keyPrivate.pem -out test.sig testfile -``` +#### Functional Overview + +The `dgst` command operates on arbitrary input data and supports +multiple hash algorithms. + +Depending on the options used, it supports the following operations: + +- **Digest computation** + - Calculate a hash value for the input data +- **Signature generation** + - Create a digital signature over the input data using a private key +- **Signature verification** + - Verify a digital signature using a public key or certificate + +The input data is specified as the **last argument** to the command. + +--- + +#### Supported Hash Algorithms + +The following message digest algorithms are supported: + +- `-md5` +- `-sha` +- `-sha224` +- `-sha256` +- `-sha384` +- `-sha512` + +If no digest algorithm is explicitly specified, a default algorithm +may be used depending on the build configuration. + +--- + +#### Common Options + +| Option | Description | +|------|-------------| +| `-inform pem \| der` | Input format for keys or signature files | +| `-out ` | Output file for the generated signature or digest | + +--- + +#### Signature Generation Options -**Verify** +These options are used when creating a digital signature. -Parameters: +| Option | Description | +|------|-------------| +| `-sign ` | Private key used to create the signature | -- [-verify] key used to verify the signature -- [-signature] file containing the signature +When `-sign` is specified, the command generates a signature over the +input data and writes it to the file specified by `-out`. -Example: +--- + +#### Signature Verification Options + +These options are used when verifying an existing digital signature. + +| Option | Description | +|------|-------------| +| `-signature ` | File containing the signature to verify | +| `-verify ` | Public key or certificate used to verify the signature | + +When both `-signature` and `-verify` are specified, the command verifies +the signature against the input data. + +--- + +#### Notes + +- The input data to be hashed or signed is specified as the **last argument** + on the command line. +- The `-sign` and `-verify` options are mutually exclusive. +- When verifying a signature, the verification result is printed to stdout. +- Key and signature file formats must match the specified `-inform` option. + +--- + +#### Examples + +Create a digital signature using a private key: + +```sh +wolfssl dgst -sha256 -sign keyPrivate.pem -out data.sig data.txt +``` + +Verify a digital signature: + +```sh +wolfssl dgst -sha256 -signature data.sig -verify keyPublic.pem data.txt ``` -wolfssl dgst -verify keyPublic.pem -signature test.sig testfile + +Compute a message digest: + +```sh +wolfssl dgst -sha256 data.txt ``` diff --git a/wolfCLU/src/genkey.md b/wolfCLU/src/genkey.md index 7fc50672..061f231a 100644 --- a/wolfCLU/src/genkey.md +++ b/wolfCLU/src/genkey.md @@ -1,18 +1,222 @@ -### GENKEY Command -Used to generate RSA, ECC, ED25519 and DSA keys. If using "-output KEY" a private key is created having .priv appended to -out argument and a public key is created with .pub appended to the -out argument. If generating ED25519 keys compile wolfSSL with --enable-ed25519. +### GENKEY Command — Cryptographic Key Generation -Available arguments are: +The `wolfssl genkey` command is used to generate cryptographic key pairs or +individual public/private keys for supported algorithms. -- [-out] file to write to -- [rsa | ecc | ed25519] key type to generate -- [-inkey] input file for key -- [-size] size of key to generate -- [-outform] output form, either DER or PEM (defaults to DER) -- [-output] key to generate, either PUB, PRIV or KEYPAIR (defaults to KEYPAIR) -- [-exponent] RSA exponent size +This command provides a unified interface for key generation, similar in +spirit to OpenSSL’s `genpkey` and related commands, but with a simplified +and explicit option set. -Example: +The set of supported key types depends on the wolfSSL build configuration. +With the default configuration, the following key types are available: +- `rsa` +- `ecc` +- `ed25519` +- `dilithium` +- `xmssmt` +- `xmss` + +--- + +#### Functional Overview + +The `genkey` command supports the following key generation operations: + +- Generating a public/private key pair +- Generating only a private key +- Generating only a public key +- Outputting keys in PEM or DER format + +When generating a key pair, the command produces separate files for the +public and private keys, using filename suffixes to distinguish them. + +--- + +#### Supported Key Types + +| Key Type | Description | +|---------|-------------| +| `rsa` | RSA public/private key pair | +| `ecc` | Elliptic Curve Cryptography (ECC) key | +| `ed25519` | Ed25519 signature key | + +> **Note:** +> Availability of key types depends on how wolfSSL was configured and built. + +--- + +#### Common Options + +| Option | Description | +|------|-------------| +| `` | Type of key to generate (`rsa`, `ecc`, `ed25519`) | +| `-size ` | Key size in bits (RSA only, optional) | +| `-out ` | Base name of the output file(s) | +| `-outform PEM \| DER` | Output format of the generated key(s) | +| `-output ` | Specify which key(s) to generate | + +--- + +#### Output Behavior + +The output files are determined by the value of the `-output` option: + +| `-output` Value | Generated Files | +|----------------|----------------| +| `KEYPAIR` | `.priv` and `.pub` | +| `PRIV` | `.priv` | +| `PUB` | `.pub` | + +File extensions are automatically appended to the base filename specified +by `-out`. + +--- + +#### Notes + +- If `-size` is not specified, a default key size is used where applicable. +- The `-size` option applies only to RSA keys. +- For ECC and Ed25519 keys, curve selection is determined by the build + configuration or internal defaults. +- The generated keys are written directly to files; no interactive prompts + are used. + +--- + +#### Examples + +Generate an RSA key pair in DER format: + +```sh +wolfssl genkey rsa -size 2048 -out mykey -outform der -output KEYPAIR ``` -wolfssl genkey rsa -size 2048 -out mykey -outform pem -output KEYPAIR + +Generate only a private RSA key in PEM format: + +```sh +wolfssl genkey rsa -size 2048 -out mykey -outform pem -output PRIV +``` + +Generate an Ed25519 key pair: + +```sh +wolfssl genkey ed25519 -out myedkey -outform pem -output KEYPAIR ``` + +#### Additional Key Generation Options + +The following options provide additional control over key generation parameters +for specific key types. + +--- + +#### RSA-Specific Options + +| Option | Description | +|------|-------------| +| `-exponent ` | RSA public exponent value (e.g. `65537`) | + +> **Note:** +> The `-exponent` option is applicable only to RSA key generation. +> If not specified, a default exponent value is used. + +#### Examples + +Generate an RSA key with a custom public exponent: + +```sh +wolfssl genkey rsa -size 2048 -exponent 65537 -out mykey -outform pem -output KEYPAIR +``` + + +--- + +#### Post-Quantum and Hash-Based Key Types + +Depending on the build configuration, the `genkey` command may support +post-quantum and hash-based signature algorithms. + +--- + +##### Dilithium (Post-Quantum Signature) + +| Option | Description | +|------|-------------| +| `dilithium` | Generate a Dilithium post-quantum signature key | +| `-level <2 \| 3 \| 5>` | Security level of the Dilithium key | + +Supported security levels: + +- Level 2 +- Level 3 +- Level 5 + +The selected level determines the security strength and key size. + +--- + +##### XMSSMT (Multi-Tree XMSS) + +| Option | Description | +|------|-------------| +| `xmssmt` | Generate an XMSS Multi-Tree (XMSSMT) key | +| `-height <20 \| 40 \| 60>` | Total tree height | +| `-layer ` | Number of layers in the multi-tree structure | + +Valid `-layer` values depend on the selected height: + +- Height 20 or 40: `2`, `4`, `8` +- Height 60: `3`, `6`, `12` + +> **Note:** +> The height must be divisible by the number of layers. + +--- + +##### XMSS (Single-Tree XMSS) + +| Option | Description | +|------|-------------| +| `xmss` | Generate a single-tree XMSS key | +| `-height <10 \| 16 \| 20>` | Tree height | + +Supported heights: + +- 10 +- 16 +- 20 + +The tree height determines the maximum number of signatures that can be +generated with a single XMSS key. + +--- + +#### Notes on Post-Quantum Key Generation + +- Availability of post-quantum and hash-based algorithms depends on the + wolfSSL build configuration and enabled features. +- Larger heights and higher security levels result in larger key sizes + and increased computational cost. +- XMSS and XMSSMT keys have a **limited number of signatures** and must be + managed carefully to avoid key exhaustion. + +--- + +Generate a Dilithium Level 3 key pair: + +```sh +wolfssl genkey dilithium -level 3 -out pqkey -outform pem -output KEYPAIR +``` + +Generate an XMSSMT key with height 40 and 4 layers: + +```sh +wolfssl genkey xmssmt -height 40 -layer 4 -out xmssmtkey -outform pem -output KEYPAIR +``` + +Generate an XMSS key with height 16: + +```sh +wolfssl genkey xmss -height 16 -out xmsskey -outform pem -output KEYPAIR +``` \ No newline at end of file diff --git a/wolfCLU/src/hash.md b/wolfCLU/src/hash.md index ce88a166..0ca213b0 100644 --- a/wolfCLU/src/hash.md +++ b/wolfCLU/src/hash.md @@ -1,19 +1,100 @@ -### HASH Command -Used to create a hash of input data. +### HASH Command — Hash Calculation and Encoding Operations -Algorithms: +The `wolfssl hash` command is a simple utility used to perform +**cryptographic hash calculations** and **encoding/decoding operations** +on files. -- md5 -- sha -- sha256 -- sha384 -- sha512 -- base64enc -- base64dec +This command processes an input file using the specified algorithm and +prints the result to standard output. +It provides a lightweight and easy-to-use interface corresponding to a +subset of OpenSSL’s `openssl dgst` and `openssl enc` functionality. +--- -Example: +#### Functional Overview +The `hash` command supports the following operations: + +- Cryptographic hash calculation +- Base64 encoding +- Base64 decoding + +The file to be processed is specified using the `-in` option. + +--- + +#### Supported Algorithms + +The following algorithms are available with the current build configuration: + +- `md5` +- `sha` +- `sha256` +- `sha384` +- `sha512` +- `blake2b` +- `base64enc` +- `base64dec` + +> **Note:** +> The set of available algorithms depends on how wolfSSL was configured +> and built. + +--- + +#### Command Syntax + +```sh +wolfssl hash <-algorithm> -in +``` + +#### Common Options + +| Option | Description | +|------|-------------| +| `-in ` | Input file to be processed | +| `` | Hash or encode/decode algorithm to use | + +--- + +#### Notes + +- The hash result or encoded/decoded output is written to standard output. +- This command does not perform signing or verification. + Use the `dgst` command for digital signature creation or verification. +- The `base64enc` and `base64dec` options perform data encoding and decoding, + not cryptographic operations. + +--- + +#### Examples + +Compute a SHA-1 hash: + +```sh +wolfssl hash sha -in data.txt +``` + +Compute a SHA-256 hash: + +``` +wolfssl hash sha256 -in data.txt ``` -wolfssl -hash sha -in + +Compute a BLAKE2b hash: + +```sh +wolfssl hash blake2b -in data.txt +``` + +Perform Base64 encoding: + +```sh +wolfssl hash base64enc -in data.bin +``` + +Perform Base64 decoding: + +```sh +wolfssl hash base64dec -in data.b64 ``` \ No newline at end of file diff --git a/wolfCLU/src/pkey.md b/wolfCLU/src/pkey.md index 0a1c1cda..60f8cd55 100644 --- a/wolfCLU/src/pkey.md +++ b/wolfCLU/src/pkey.md @@ -1,13 +1,88 @@ -### PKEY Command -Used for dealing with generic key operations. Prints the key read in to stdout. +### PKEY Command — Generic Public and Private Key Processing -- [-in] file input for key -- [-inform] pem or der input format (defaults to pem) -- [-pubout] only print out the public key -- [-pubin] expect to public key as input +The `wolfssl pkey` command is a **generic key handling utility** used to +read, inspect, convert, and extract public keys from cryptographic key files. -Example: +Unlike the `rsa` command, which is specific to RSA keys, the `pkey` command +is designed to work with **multiple key types** through a unified interface. +This command provides functionality similar to OpenSSL’s `openssl pkey` +command. + +Typical use cases include: + +- Converting keys between PEM and DER formats +- Extracting public keys from private keys +- Handling different key types using a single command +- Inspecting or re-encoding key material + +--- + +#### Functional Overview + +The `pkey` command operates on an existing cryptographic key and supports +the following operations: + +- Reading public or private keys +- Converting key encoding formats (PEM ↔ DER) +- Outputting a public key from a private key +- Processing keys without regard to their specific algorithm + +The behavior of the command depends on whether the input key is a public key +or a private key, and on the options specified. + +--- + +#### Input and Output + +- **Input** + - Public key or private key (PEM or DER) +- **Output** + - Public key or private key (PEM or DER) + +--- + +#### Common Options + +| Option | Description | +|------|-------------| +| `-in ` | Input file containing the key | +| `-out ` | Output file (default: stdout) | +| `-inform pem \| der` | Input key format | +| `-outform pem \| der` | Output key format | +| `-pubin` | Expect the input to be a public key | +| `-pubout` | Output the public key instead of the private key | + +--- + +#### Notes + +- If `-pubin` is not specified, the command assumes the input is a private key. +- When `-pubout` is specified, the public key is extracted from the private key + and written to the output. +- The `pkey` command does not generate keys; use the `genkey` command for + key generation. +- Algorithm-specific inspection (such as RSA modulus output) is not supported; + use algorithm-specific commands such as `rsa` when needed. + +--- + +#### Examples + +Extract a public key from a private key: + +```sh +wolfssl pkey -in key.pem -pubout -out pubkey.pem +``` + +Convert a key from PEM to DER format: + +```sh +wolfssl pkey -in key.pem -inform pem -outform der -out key.der ``` -./wolfssl pkey -in ./certs/server-key.pem -inform pem -pubout + +Read and output a public key: + +```sh +wolfssl pkey -pubin -in pubkey.pem -outform pem ``` diff --git a/wolfCLU/src/req.md b/wolfCLU/src/req.md index 1a57ccde..91b368bf 100644 --- a/wolfCLU/src/req.md +++ b/wolfCLU/src/req.md @@ -1,21 +1,120 @@ -### REQ Command -Used for creating a certificate request or a self-signed certificate. Can handle some basic parsing of a .conf file for certificate setup. If no configuration file is used then stdin is prompted for certificate information. +### REQ Command — Certificate Request and Self-Signed Certificate Generation -Available arguments are: +The `wolfssl req` command is used to create and process +**Certificate Signing Requests (CSRs)** and, optionally, +to generate **self-signed X.509 certificates**. -- [-in] input file to read from -- [-out] file to write to (default stdout) -- [-key] public key to put into certificate request -- [-inform] der or pem format for '-in' (defaults to pem) -- [-outform] der or pem format for '-out' (defaults to pem) -- [-config] file to parse for certificate configuration -- [-days] number of days should be valid for -- [-x509] generate self signed certificate +This command provides functionality similar to OpenSSL’s +`openssl req` command and is primarily intended for: -Example: +- Generating a new Certificate Signing Request (CSR) +- Creating a new private key for use with a CSR +- Generating a self-signed X.509 certificate +- Verifying and inspecting an existing CSR +The behavior of the command depends on the combination of options +used, particularly `-newkey`, `-inkey`, and `-x509`. + +--- + +#### Functional Overview + +The `req` command supports the following primary use cases: + +- **CSR generation** + - Using an existing private key + - Generating a new private key as part of the request +- **Self-signed certificate generation** + - Creating an X.509 certificate directly from a CSR request +- **CSR inspection and verification** + - Printing the contents of a CSR + - Verifying the signature on a CSR + +Certificate subject information and extensions can be provided +either interactively or via a configuration file. + +--- + +### #Common Options + +| Option | Description | +|------|-------------| +| `-in ` | Input file to read from | +| `-out ` | Output file to write to (default: stdout) | +| `-inform der \| pem` | Input format for `-in` | +| `-outform der \| pem` | Output format for `-out` | +| `-config ` | Configuration file for certificate request parameters | +| `-subj ` | Specify the subject name on the command line | +| `-text` | Output the request in human-readable form | +| `-noout` | Do not output the encoded request or certificate | + +--- + +#### Key and CSR Generation Options + +These options control how the private key and CSR are generated. + +| Option | Description | +|------|-------------| +| `-newkey ` | Generate a new private key for the request | +| `-keyout ` | File to write the newly generated private key to | +| `-nodes` | Do not encrypt the output private key | +| `-inkey ` | Use an existing private key for the request | +| `-key ` | Public key to include in the certificate request | + +--- + +#### Self-Signed Certificate Options + +| Option | Description | +|------|-------------| +| `-x509` | Generate a self-signed X.509 certificate instead of a CSR | +| `-days ` | Number of days the certificate should be valid | +| `-extensions
` | Section name in the configuration file for extensions | + +--- + +#### Verification Options + +| Option | Description | +|------|-------------| +| `-verify` | Verify the signature on the CSR | + +--- + +#### Notes + +- When `-x509` is specified, the output is an X.509 certificate rather than a CSR. +- The `-newkey` option generates a new private key and associates it with the request. +- If neither `-newkey` nor `-inkey` is specified, the command expects a key to be + provided through other means. +- To sign a CSR with a CA key, use the `x509 -req` command. + +--- + +#### Examples + +Generate a new CSR and private key: + +```sh +wolfssl req -newkey rsa:2048 -keyout server.key -out server.csr ``` -wolfssl ecparam -genkey -out ecc.key -name secp384r1 -wolfssl req -new -x509 -days 3650 -config selfsigned.conf -key ecc.key -out ecc.cert -outform der -sha256 +Generate a self-signed certificate: + +```sh +wolfssl req -x509 -newkey rsa:2048 -days 365 \ + -keyout server.key -out server.crt +``` + +Display the contents of an existing CSR: + +``` +wolfssl req -in server.csr -text +``` + +Verify a CSR signature: + ``` +wolfssl req -in server.csr -verify +``` \ No newline at end of file diff --git a/wolfCLU/src/rsa.md b/wolfCLU/src/rsa.md index d9f9c130..33ec0b9e 100644 --- a/wolfCLU/src/rsa.md +++ b/wolfCLU/src/rsa.md @@ -1,12 +1,120 @@ -### RSA Command - -Does RSA operations. Including reading in RSA keys, outputing RSA keys or modulus, and reading encrypted PEM files. Can handle both DER and PEM format for input and output. The following is a list of options - -- [-in] file input for key to read -- [-inform] PEM or DER input format (defaults to PEM) -- [-out] file to write result to (defaults to stdout) -- [-outform] PEM or DER output format (defaults to PEM) -- [-passin] password for PEM encrypted files -- [-noout] do not print the key out when set -- [-modulus] print out the RSA modulus (n value) -- [-RSAPublicKey_in] expecting a public key input +### RSA Command — RSA Key Processing and Inspection + +The `wolfssl rsa` command is used to **read, inspect, convert, and extract +information from RSA keys**. + +This command provides functionality similar to OpenSSL’s `openssl rsa` +command and supports both private and public RSA keys in PEM or DER format. + +Typical use cases include: + +- Converting RSA keys between PEM and DER formats +- Printing RSA key components +- Extracting the RSA modulus +- Handling encrypted PEM private keys +- Converting between public and private key representations + +--- + +#### Functional Overview + +The `rsa` command operates on an existing RSA key and supports the following +operations: + +- Reading RSA private or public keys +- Converting key encoding formats (PEM ↔ DER) +- Outputting public keys from private keys +- Printing specific RSA parameters, such as the modulus +- Processing password-protected PEM private keys + +The behavior of the command depends on whether the input key is a private +key or a public key, and on the options specified. + +--- + +#### Input and Output + +- **Input** + - RSA private key or public key (PEM or DER) +- **Output** + - RSA private key or public key (PEM or DER), or selected key information + +--- + +#### Common Options + +| Option | Description | +|------|-------------| +| `-in ` | Input file containing the RSA key | +| `-inform PEM \| DER` | Input key format | +| `-out ` | Output file (default: stdout) | +| `-outform PEM \| DER` | Output key format | +| `-passin ` | Password for encrypted PEM private keys | +| `-noout` | Do not output the key material | + +--- + +#### Public and Private Key Handling Options + +These options control how public and private keys are interpreted and output. + +| Option | Description | +|------|-------------| +| `-RSAPublicKey_in` | Expect an RSA public key in RSAPublicKey format as input | +| `-pubin` | Expect a public key as input | +| `-pubout` | Output a public key instead of a private key | + +> **Note:** +> `-RSAPublicKey_in` and `-pubin` are used to explicitly specify that the input +> key is a public key. + +--- + +#### RSA Parameter Output Options + +| Option | Description | +|------|-------------| +| `-modulus` | Print the RSA modulus (`n` value) | + +When `-modulus` is specified, the command prints the modulus value in +hexadecimal form. + +--- + +#### Notes + +- If neither `-pubin` nor `-RSAPublicKey_in` is specified, the command + assumes the input is a private RSA key. +- When processing encrypted PEM private keys, `-passin` must be provided. +- The `-noout` option suppresses output of the key itself but allows + parameter output such as `-modulus`. +- This command does not generate RSA keys; use the `genkey` command for + key generation. + +--- + +#### Examples + +Convert an RSA private key from PEM to DER format: + +```sh +wolfssl rsa -in rsa-key.pem -inform PEM -outform DER -out rsa-key.der +``` + +Print the RSA modulus: + +```sh +wolfssl rsa -in rsa-key.pem -modulus -noout +``` + +Extract a public key from a private key: + +```sh +wolfssl rsa -in rsa-key.pem -pubout -out rsa-pub.pem +``` + +Read and output an RSA public key: + +```sh +wolfssl rsa -pubin -in rsa-pub.pem -outform PEM +``` diff --git a/wolfCLU/src/s_client.md b/wolfCLU/src/s_client.md index a9f5f924..1f3cec50 100644 --- a/wolfCLU/src/s_client.md +++ b/wolfCLU/src/s_client.md @@ -1,13 +1,97 @@ -### S_CLIENT Command -Very basic TLS connection supported. Currently does not verify the peer, -CAfile option is not yet completed. +## S_CLIENT Command — TLS Client Connection and Diagnostics -Arguments: +The `wolfssl s_client` command is a diagnostic utility used to establish +a **TLS/SSL client connection** to a remote server and inspect the +handshake and certificate verification behavior. -- [-connect] : +This command provides functionality similar to OpenSSL’s +`openssl s_client` command and is commonly used for: +- Testing TLS connectivity to a server +- Inspecting server certificates and certificate chains +- Verifying server certificates against a trusted CA +- Debugging TLS handshake and STARTTLS behavior -Example : +--- +### Functional Overview + +The `s_client` command initiates a TLS connection to a specified server +and performs the TLS handshake. + +Depending on the options used, it supports the following behaviors: + +- Direct TLS connections to a TCP endpoint +- STARTTLS negotiation for application protocols such as SMTP +- Server certificate verification using a CA file +- Immediate termination on verification failure + +The command is intended for **interactive testing and diagnostics**, not +for automated production use. + +--- + +### Connection Target + +The remote endpoint is specified using the `-connect` option. +Both IPv4 and IPv6 addresses are supported. + +IPv6 addresses must be enclosed in square brackets (`[]`). + +Examples: + +```sh +-connect 127.0.0.1:443 +-connect '[::1]:11111' +-connect '[fe80::63:57c0:9b88:77ca%en0]:11111' +-connect '[2001:4860:4860::8888]:443' +``` + +### Common Options + +| Option | Description | +|------|-------------| +| `-connect ` | Remote server address and port to connect to | +| `-starttls ` | Enable STARTTLS for the specified protocol (e.g. `smtp`) | +| `-CAfile ` | Trusted CA certificate file used for server certificate verification | +| `-verify_return_error` | Close the connection immediately if certificate verification fails | +| `-disable_stdin_check` | Disable standard input readiness checks during the session | + +--- + +### Notes + +- The `-connect` option supports both IPv4 and IPv6 addresses. + IPv6 addresses must be enclosed in square brackets (`[]`). +- The `-starttls` option is used for protocols that begin in plaintext and + then upgrade to TLS, such as SMTP. +- If `-verify_return_error` is not specified, the connection may continue + even if certificate verification fails, depending on configuration. +- The `-disable_stdin_check` option is primarily intended for non-interactive + or scripted use cases. + +--- + +### Examples + +Connect to a TLS server: + +```sh +wolfssl s_client -connect example.com:443 +``` + +Use STARTTLS with SMTP: + +```sh +wolfssl s_client -connect mail.example.com:25 -starttls smtp ``` -wolfssl s_client -connect 127.0.0.1:11111 -``` \ No newline at end of file + +Verify the server certificate and abort on error: + +```sh +wolfssl s_client -connect example.com:443 \ + -CAfile ca-cert.pem \ + -verify_return_error +``` + + diff --git a/wolfCLU/src/s_server.md b/wolfCLU/src/s_server.md new file mode 100644 index 00000000..445c0270 --- /dev/null +++ b/wolfCLU/src/s_server.md @@ -0,0 +1,142 @@ +### S_SERVER Command — TLS Server Startup and Operation Testing + +The `wolfssl s_server` command is a diagnostic utility used to start a +**simple TLS/SSL server** using a specified certificate and private key. + +This command serves a role similar to OpenSSL’s `openssl s_server` command +and is primarily used for the following purposes: + +- Testing TLS server-side behavior +- Verifying the correctness of certificates and private keys +- Testing client certificate verification +- Confirming TLS version negotiation +- Performing interoperability tests using tools such as `s_client` + +--- + +#### Functional Overview + +The `s_server` command listens on a specified port, accepts incoming +client connections, and performs the TLS handshake. + +Depending on the options specified, it supports the following behaviors: + +- Starting a TLS server using a specified certificate and private key +- Enabling or disabling client certificate verification +- Restricting the TLS protocol versions that may be used +- Accepting multiple client connections +- Sending a simple HTTP (HTML) response + +This command is intended for **testing and verification purposes** and is +not designed for use as a high-performance or production-grade server. + +--- + +#### Input and Output + +- **Input** + - Server certificate (PEM format) + - Server private key (PEM format) + - (Optional) CA certificate for client certificate verification +- **Output** + - Connection status and TLS handshake information (standard output) + +--- + +#### Common Options + +| Option | Description | +|------|-------------| +| `-port ` | TCP port number to listen on | +| `-key ` | Server private key file (PEM format only) | +| `-cert ` | Server certificate file (PEM format only) | +| `-CAfile ` | CA certificate used to verify client certificates (PEM format only) | +| `-noVerify` | Disable client certificate verification | +| `-version ` | Specify the SSL/TLS protocol version to use | +| `-naccept ` | Number of connections to accept (default: 1) | +| `-www` | Send responses in HTTP (HTML) format | +| `-readyFile ` | Create a file to indicate that the server is ready | + +--- + +#### TLS Version Selection (`-version`) + +The `-version` option restricts the SSL/TLS protocol versions that the +server will accept. + +| Value | Protocol | +|------|----------| +| `0` | SSLv3 | +| `1` | TLS 1.0 | +| `2` | TLS 1.1 | +| `3` | TLS 1.2 | +| `4` | TLS 1.3 | + +> **Note:** +> The actual set of available protocol versions depends on how wolfSSL +> was configured and built. + +--- + +#### Client Certificate Verification + +- Client certificate verification is enabled by default. +- When `-noVerify` is specified, client certificates are neither requested + nor verified. +- To enable client certificate verification, a trusted CA certificate must + be specified using the `-CAfile` option. + +--- + +#### Notes + +- The files specified with the `-key` and `-cert` options must be in + **PEM format**. +- This command implements a simple TLS server and is not suitable for + high-load or production server use. +- The `-www` option is a convenience feature for easily testing TLS + connectivity. +- The `-readyFile` option can be used by external monitoring tools to + detect when the server has finished starting up. + +--- + +#### Examples + +Start a TLS server listening on port 4433: + +```sh +wolfssl s_server \ + -port 4433 \ + -cert server-cert.pem \ + -key server-key.pem +``` + +Start a server that only allows TLS 1.2: + +```sh +wolfssl s_server \ + -port 4433 \ + -cert server-cert.pem \ + -key server-key.pem \ + -version 3 +``` + +Disable client certificate verification: + +```sh +wolfssl s_server \ + -port 4433 \ + -cert server-cert.pem \ + -key server-key.pem \ + -noVerify +Accept multiple client connections: +``` + +```sh +wolfssl s_server \ + -port 4433 \ + -cert server-cert.pem \ + -key server-key.pem \ + -naccept 10 +``` \ No newline at end of file diff --git a/wolfCLU/src/verify.md b/wolfCLU/src/verify.md index a6da2f9a..97149726 100644 --- a/wolfCLU/src/verify.md +++ b/wolfCLU/src/verify.md @@ -1,12 +1,108 @@ -### VERIFY Command -Verifies an X509 certificate given a CA. The last argument passed into the command is the certificate file name to be verified. If the verification is successful then "OK" will be printed out to stdout. Otherwise an error value and reason will be printed out. +### VERIFY Command — X.509 Certificate Verification -- [-CAfile] file name for CA to be used with verify -- [-crl_check] if CRL checking should be used -- [-untrusted] file name for intermediate certificate to be used in verification (only one -untrusted cert is currently supported) +The `wolfssl verify` command is used to **verify X.509 certificates** +against a trusted Certificate Authority (CA). -Example: +This command performs certificate chain validation similar to OpenSSL’s +`openssl verify` command, with a simplified feature set focused on common +verification scenarios. +It supports verification using a CA certificate, optional intermediate +certificates, and optional Certificate Revocation List (CRL) checking. + +--- + +#### Functional Overview + +The `verify` command validates an X.509 certificate by performing the +following checks: + +- Verification of the certificate signature against a trusted CA +- Validation of the certificate chain (root and intermediate certificates) +- Optional CRL-based revocation checking + +If the verification is successful, the command prints `OK` to standard output. +If verification fails, an error code and a descriptive reason are printed. + +--- + +#### Command Syntax + +```sh +wolfssl verify -CAfile \ + [-untrusted ] \ + [-crl_check] \ + [-partial_chain] \ + ``` -wolfssl verify -CAfile ./certs/ca-cert.pem ./certs/server-cert.pem + +#### Input + +- **CA Certificate** + - A trusted root CA certificate specified using the `-CAfile` option +- **Intermediate Certificate (optional)** + - An intermediate certificate provided via the `-untrusted` option +- **Target Certificate** + - The certificate to be verified, specified as the final argument on the command line + +--- + +#### Common Options + +| Option | Description | +|------|-------------| +| `-CAfile ` | Trusted CA certificate file used for verification | +| `-untrusted ` | Intermediate certificate file used to build the certificate chain | +| `-crl_check` | Enable certificate revocation checking using Certificate Revocation Lists (CRLs) | +| `-partial_chain` | Allow verification to succeed with a partial certificate chain | + +> **Note:** +> Current support allows loading **only one** intermediate certificate via the `-untrusted` option. + +--- + +#### Verification Behavior + +- The certificate specified as the final argument is verified against the + trusted CA provided by `-CAfile`. +- If `-untrusted` is specified, the given certificate is used as an + intermediate certificate during chain construction. +- When `-crl_check` is enabled, the verification process checks whether the + certificate has been revoked using available CRLs. +- When `-partial_chain` is specified, verification may succeed even if a full + certificate chain up to a self-signed root certificate is not available. + +--- + +#### Notes + +- The `-CAfile` option is mandatory. +- Only a single intermediate certificate is currently supported via + the `-untrusted` option. +- CRL checking requires wolfSSL to be built with CRL support enabled. +- This command performs verification only; it does not automatically fetch + missing certificates or CRLs. + +--- + +#### Examples + +Verify a certificate using a CA certificate: + +```sh +wolfssl verify -CAfile ca-cert.pem server-cert.pem +``` + +Verify a certificate with an intermediate certificate: + +```sh +wolfssl verify -CAfile ca-cert.pem \ + -untrusted intermediate-cert.pem \ + server-cert.pem +``` + +Verify a certificate with CRL checking enabled: + +```sh +wolfssl verify -CAfile ca-cert.pem -crl_check server-cert.pem ``` diff --git a/wolfCLU/src/x509.md b/wolfCLU/src/x509.md index 253b013a..8ebf13b4 100644 --- a/wolfCLU/src/x509.md +++ b/wolfCLU/src/x509.md @@ -1,17 +1,122 @@ -### X509 Commnad -This command is used for parsing and printing out certificates. +### X509 Command — Certificate Parsing, Inspection, and Signing -Arguments: +The `wolfssl x509` command is a general-purpose utility for working with X.509 certificates and +Certificate Signing Requests (CSRs). -- [-in] X509 file input -- [-inform] pem or der format for input (defaults to pem) -- [-out] file to output to -- [-outform] pem or der format for output (defaults to pem) -- [-pubkey] print out the public key only -- [-text] print out the certificate +This command supports **two distinct operating modes**, and its behavior changes significantly +depending on whether the `-req` option is specified: -Example: +- **Certificate Parsing and Inspection Mode (default)** +- **CSR Processing and Certificate Generation Mode (`-req`)** +The interface and overall behavior are intentionally similar to OpenSSL’s `openssl x509` command, +while internally relying on wolfSSL’s X.509 parsing and certificate handling implementation. + +Typical use cases include: + +- Converting X.509 certificates between PEM and DER formats +- Inspecting certificate contents (Subject, Issuer, validity period, public key, etc.) +- Printing certificate metadata such as serial numbers, fingerprints, and hashes +- Generating and signing X.509 certificates from a CSR + +--- + +#### Operating Modes + +##### Certificate Parsing and Inspection Mode (default) + +When the `-req` option is **not** specified, the input file is treated as an **X.509 certificate**. +In this mode, the command is primarily used for parsing, inspecting, and converting existing +certificates. + +Common operations include: + +- Printing human-readable certificate details +- Extracting specific certificate fields (Subject, Issuer, validity dates, etc.) +- Outputting the public key or RSA modulus +- Converting certificates between PEM and DER formats + +This mode does **not** perform certificate signing. + +##### Common Options + +| Option | Description | +|------|-------------| +| `-inform pem \| der` | Input certificate format | +| `-in ` | Input certificate file | +| `-outform pem \| der` | Output certificate format | +| `-out ` | Output file | +| `-noout` | Do not output the encoded certificate | +| `-text` | Print the certificate in human-readable form | +| `-subject` | Print the subject distinguished name | +| `-issuer` | Print the issuer distinguished name | +| `-serial` | Print the certificate serial number in hexadecimal | +| `-dates` | Print the certificate validity period | +| `-email` | Print the subject email address | +| `-fingerprint` | Print the certificate fingerprint (hash of DER encoding) | +| `-purpose` | Print the certificate purpose | +| `-hash` | Print the hash of the subject name | +| `-modulus` | Print the RSA public key modulus | +| `-pubkey` | Output the public key | + +##### Examples + +```sh +wolfssl x509 -in cert.pem -text +wolfssl x509 -in cert.pem -subject -issuer -dates +wolfssl x509 -inform pem -in cert.pem -outform der -out cert.der ``` -wolfssl x509 -in ./certs/server-cert.pem -text -``` + +##### CSR Processing and Certificate Generation Mode (`-req`) + +When the `-req` option is specified, the input file is interpreted as a +**Certificate Signing Request (CSR)** instead of a certificate. + +In this mode, `wolfssl x509` can be used to: + +- Process and inspect a CSR +- Generate and sign an X.509 certificate based on the CSR +- Apply certificate extensions from a configuration file +- Select the digest algorithm used for signing + +Options such as `-signkey`, digest selection (`-sha256`, etc.), `-extfile`, and `-extensions` +are meaningful **only in this mode**. + +#### Notes + +- The meaning of the input file specified by `-in` depends on whether `-req` is present. +- Some options are valid only in one operating mode and are ignored or invalid in the other. +- To generate a CSR itself, use the dedicated `req` command. + + +#### CSR-Specific Options + +The following options are meaningful **only when `-req` is specified**: + +| Option | Description | +|------|-------------| +| `-req` | Enable CSR processing mode | +| `-signkey ` | Private key used to sign the generated certificate | +| `-*` (e.g. `-sha256`, `-sha384`) | Digest algorithm used for certificate signing | +| `-extfile ` | Configuration file containing X.509 extensions | +| `-extensions
` | Section name in the configuration file that defines the extensions to apply | + +Options related to certificate inspection (such as `-issuer`, `-serial`, +`-dates`, etc.) are generally not applicable in this mode. + +--- + +#### Example + +Generate and sign an X.509 certificate from a CSR using SHA-256 and a +configuration file for extensions: + +```sh +wolfssl x509 -req \ + -in server.csr \ + -signkey ca-key.pem \ + -sha256 \ + -extfile cert.conf \ + -extensions v3_server \ + -out server-cert.pem + ``` From aebb41c12caf559caec53b164f900c6a8ab6a6ff Mon Sep 17 00:00:00 2001 From: Takashi Kojo Date: Mon, 12 Jan 2026 09:18:36 +0900 Subject: [PATCH 2/2] wolfCLU Appendix01: Configuration file format --- wolfCLU/create-pdf.sh | 2 +- wolfCLU/mkdocs-ja.yml | 2 + wolfCLU/mkdocs.yml | 2 + wolfCLU/src-ja/Appendix01.md | 315 ++++++++++++++++++++++++++++++++++ wolfCLU/src/Appendix01.md | 318 +++++++++++++++++++++++++++++++++++ 5 files changed, 638 insertions(+), 1 deletion(-) create mode 100644 wolfCLU/src-ja/Appendix01.md create mode 100644 wolfCLU/src/Appendix01.md diff --git a/wolfCLU/create-pdf.sh b/wolfCLU/create-pdf.sh index 30c11e6b..eaaec0ed 100755 --- a/wolfCLU/create-pdf.sh +++ b/wolfCLU/create-pdf.sh @@ -1,3 +1,3 @@ #!/bin/bash -pandoc -s header.txt src/Intro.md src/build.md src/command_list.md src/bench.md src/ca.md src/crl.md src/dsaparam.md src/dhparam.md src/dgst.md src/ecparam.md src/enc.md src/genkey.md src/hash.md src/md5.md src/sha.md src/pkcs12.md src/pkey.md src/rand.md src/req.md src/rsa.md src/s_client.md d src/s_server.md src/verify.md src/x509.md --toc -o wolfCLU_Manual.pdf +pandoc -s header.txt src/Intro.md src/build.md src/command_list.md src/bench.md src/ca.md src/crl.md src/dsaparam.md src/dhparam.md src/dgst.md src/ecparam.md src/enc.md src/genkey.md src/hash.md src/md5.md src/sha.md src/pkcs12.md src/pkey.md src/rand.md src/req.md src/rsa.md src/s_client.md d src/s_server.md src/verify.md src/x509.md src/Appendix01.md --toc -o wolfCLU_Manual.pdf diff --git a/wolfCLU/mkdocs-ja.yml b/wolfCLU/mkdocs-ja.yml index e1d23077..e36c9dc5 100644 --- a/wolfCLU/mkdocs-ja.yml +++ b/wolfCLU/mkdocs-ja.yml @@ -32,6 +32,8 @@ nav: - "VERIFY コマンド": verify.md - "X509 コマンド": x509.md - "BASE64 コマンド": base64.md + - "4. Appendix": + - "構成ファイルのフォーマット": Appendix01.md theme: name: null custom_dir: ../mkdocs-material/material diff --git a/wolfCLU/mkdocs.yml b/wolfCLU/mkdocs.yml index d3a83156..147aaeee 100644 --- a/wolfCLU/mkdocs.yml +++ b/wolfCLU/mkdocs.yml @@ -27,6 +27,8 @@ nav: - "VERIFY Command": verify.md - "X509 Command": x509.md - "BASE64 Command": base64.md + - "4. Appendix": + - "Configuration File Format": Appendix01.md theme: name: null custom_dir: ../mkdocs-material/material diff --git a/wolfCLU/src-ja/Appendix01.md b/wolfCLU/src-ja/Appendix01.md new file mode 100644 index 00000000..13523504 --- /dev/null +++ b/wolfCLU/src-ja/Appendix01.md @@ -0,0 +1,315 @@ +# Appendix A: 構成ファイルのフォーマット + +## A.1 概要 + +wolfCLU の各種コマンド(`x509`、`req` など)は、 +OpenSSL の `openssl.cnf` と同様の **設定ファイル(configuration file)** を参照することで、以下を行います。 + +- Distinguished Name (DN) の定義 +- X.509 拡張の指定 +- 証明書生成時の動作制御 + +## 注意事項(CA 機能の位置づけと適用範囲) + +wolfCLU における CA 機能は、 + +- **証明書生成および検証のための診断・検証用途** +- **組み込み型製品において必要とされる + 限られた範囲の証明書操作の提供** + +を目的としています。 + +特に、**リソース制約のある環境**や、 +**証明書管理を外部システムに委ねる構成**において、 +wolfCLU は **実装および検証用途に適した機能**を提供します。 + +そのため、wolfCLU は +本格的な認証局(CA)運用や +証明書ライフサイクル全体の管理を目的としたツールではありません。 + +> **注意** +> 本設定ファイルは OpenSSL 互換を意識した書式を採用していますが、 +> `openssl.cnf` のすべての機能を網羅するものではありません。 + +--- + +## A.2 基本構文 + +設定ファイルは、以下の基本ルールに従います。 + +### A.2.1 セクション + +``` +[ section_name ] +``` + +- セクション名は大文字・小文字を区別しません +- セクションは任意の順序で定義できます + +### A.2.2 キーと値 + +``` +key = value +``` + +- 空白は無視されます +- 値は文字列として扱われ、数値型としての解釈は行われません + +### A.2.3 コメント + +comment + +``` +; comment +``` + +- `#` および `;` はコメントとして扱われます +- 行末コメントも可能です + +--- + +## A.3 設定ファイルの読み込みモデル + +wolfCLU の config 処理は以下の特徴を持ちます。 + +- **単一ファイル読み込み** + - `include` および `include_dir` はサポートされません +- **ネスト参照は 1 段階** + - `section = other_section` による参照は可能 + - 無限再帰や多段参照は想定されていません +- **未定義キーは無視** + - 未使用ディレクティブが存在してもエラーにはなりません + +--- + +## A.4 サポートされる主要セクション + +### A.4.1 `[ req ]` + +証明書要求(CSR)および自己署名証明書生成時の基本動作を定義します。 + +例: + +``` +[ req ] +default_bits = 2048 +distinguished_name = req_distinguished_name +x509_extensions = v3_req +prompt = no +``` + + +| キー | 説明 | +|----|----| +| `default_bits` | 鍵長(RSA 使用時) | +| `distinguished_name` | DN 定義セクション | +| `x509_extensions` | 使用する拡張セクション | +| `prompt` | DN 入力を対話形式にするか | + +--- + +### A.4.2 `[ req_distinguished_name ]` + +Distinguished Name (DN) の各属性を定義します。 + +``` +[ req_distinguished_name ] +C = US +ST = MT +L = Bozeman +O = wolfSSL Inc +OU = Engineering +CN = example.com +``` + +- 各キーは X.509 DN 属性として解釈されます +- 定義されていない属性は省略されます + +--- + +### A.4.3 X.509 拡張セクション +(例:`[ v3_req ]`, `[ v3_ca ]`) + +証明書拡張を定義します。 + +**Subject Alternative Name (SAN)** + +``` +subjectAltName = @alt_names + +[ alt_names ] +DNS.1 = example.com +DNS.2 = www.example.com +``` + +**Basic Constraints** + +``` +basicConstraints = CA:FALSE +``` + +**Key Usage** + +``` +keyUsage = digitalSignature, keyEncipherment +``` + +**Extended Key Usage** + +``` +extendedKeyUsage = serverAuth, clientAuth +``` + +--- + +## A.5 拡張ディレクティブの対応状況 + +wolfCLU は以下の代表的な X.509 拡張をサポートします。 + +- `basicConstraints` +- `keyUsage` +- `extendedKeyUsage` +- `subjectAltName` +- `subjectKeyIdentifier` +- `authorityKeyIdentifier` + +未対応の拡張が指定された場合でも、 +設定ファイルの読み込み自体は失敗しません。 + +--- + +## A.6 コマンドとの対応関係 + +| コマンド | 使用される主なセクション | +|--------|----------------------| +| `req` | `req`, `req_distinguished_name`, 拡張セクション | +| `x509` | 拡張セクション | +| `s_server` / `s_client` | 証明書読み込み用途のみ | + +--- + +## A.7 OpenSSL との主な相違点 + +- `include` / `include_dir` 非対応 +- `policy` セクション非対応 +- 変数展開(`${var}`)非対応 +- engine 関連設定非対応 + +これらは **意図的に実装されていない機能**であり、 +wolfCLU は **CLI 診断用途に必要な最小限の config 処理**を目的としています。 + +--- + +## A.8 最小構成例 + +``` +[ req ] +prompt = no +distinguished_name = dn +x509_extensions = v3 + +[ dn ] +CN = test.example.com + +[ v3 ] +basicConstraints = CA:FALSE +keyUsage = digitalSignature +``` + +--- + +## A.9 `[ ca ]` セクション + +### A.9.1 基本構造 + +``` +[ ca ] +default_ca = CA_default +``` + +`[ ca ]` セクションは、 +**実際に使用される CA 定義セクションを指し示すための入口**として機能します。 + +--- + +### A.9.2 CA 定義セクション(例:`[ CA_default ]`) + +``` +[ CA_default ] +dir = ./demoCA +certs = $dir/certs +crl_dir = $dir/crl +database = $dir/index.txt +serial = $dir/serial +certificate = $dir/cacert.pem +private_key = $dir/private/cakey.pem +default_md = sha256 +policy = policy_any +x509_extensions = v3_ca +``` + +> **注** +> すべてのキーが必須ではありません。 +> wolfCLU が参照しない項目は無視されます。 + +--- + +### A.9.3 サポートされる主なキー + +| キー | 説明 | +|----|----| +| `certificate` | CA 証明書ファイル | +| `private_key` | CA 秘密鍵ファイル | +| `default_md` | 署名に使用するハッシュアルゴリズム | +| `x509_extensions` | 発行証明書に適用する拡張セクション | + +以下のキーは OpenSSL 互換形式で記述可能ですが、 +wolfCLU では参照されない、または限定的に扱われます。 + +- `database` +- `serial` +- `crl_dir` +- `policy` + +--- + +### A.9.4 ポリシーセクション(`[ policy_xxx ]`) + +OpenSSL では DN 制約を定義するために使用されますが、 +wolfCLU ではポリシー内容の評価・検証は行われません。 + +``` +[ policy_any ] +countryName = optional +stateOrProvinceName = optional +organizationName = optional +commonName = supplied +``` + +この記述は **設定互換性維持のために許容**されており、 +実質的な制約処理は行われません。 + +--- + +### A.9.5 wolfCLU における `[ ca ]` セクションの制約 + +wolfCLU の CA 処理は以下の点で OpenSSL と異なります。 + +- 証明書発行履歴(DB)管理を行わない +- serial ファイルの自動更新を行わない +- CRL 発行・管理機能を持たない +- 再発行・失効管理を想定していない + +そのため、`[ ca ]` セクションは +**簡易 CA として署名付き証明書を生成するための設定**として使用されます。 + +--- + +## A.10 使用される主なコマンド + +| コマンド | `[ ca ]` セクションの利用 | +|--------|----------------------| +| `x509` | CA 署名付き証明書生成時 | +| `req` | CSR を CA 署名する場合 | + +--- diff --git a/wolfCLU/src/Appendix01.md b/wolfCLU/src/Appendix01.md new file mode 100644 index 00000000..f46252cc --- /dev/null +++ b/wolfCLU/src/Appendix01.md @@ -0,0 +1,318 @@ +# Appendix A: Configuration File Format + +## A.1 Overview + +Various wolfCLU commands (such as `x509`, `req`, etc.) can reference a +**configuration file**, similar in concept to OpenSSL’s `openssl.cnf`, +to perform the following tasks: + +- Definition of Distinguished Names (DNs) +- Specification of X.509 extensions +- Control of certificate generation behavior + +--- + +## Notes on CA Functionality (Scope and Intended Use) + +The CA-related functionality in wolfCLU is intended for: + +- **Diagnostic and verification use cases for certificate generation and validation** +- **Providing a limited set of certificate operations required in embedded systems** + +In particular, wolfCLU is designed to provide +**implementation- and verification-oriented functionality** +for environments with **resource constraints** or for architectures +where **certificate management is delegated to external systems**. + +As such, wolfCLU is **not intended to be used as a full-featured +Certificate Authority (CA) management tool**, nor for managing the +entire certificate lifecycle. + +> **Note** +> Although the configuration file syntax is designed to resemble OpenSSL’s +> format, it does **not** implement all features of `openssl.cnf`. + +--- + +## A.2 Basic Syntax + +Configuration files follow the rules described below. + +### A.2.1 Sections + +``` +[ section_name ] +``` + +- Section names are case-insensitive. +- Sections may be defined in any order. + +--- + +### A.2.2 Keys and Values + +``` +key = value +``` + +- Whitespace around keys and values is ignored. +- Values are treated as strings; no numeric interpretation is performed. + +--- + +### A.2.3 Comments + +``` +; comment +``` + +- Both `#` and `;` are treated as comment markers. +- End-of-line comments are supported. + +--- + +## A.3 Configuration File Processing Model + +wolfCLU’s configuration processing has the following characteristics: + +- **Single-file loading** + - `include` and `include_dir` are not supported +- **Single-level section references** + - References such as `section = other_section` are supported + - Recursive or multi-level references are not supported +- **Undefined keys are ignored** + - Unknown or unused directives do not cause errors + +--- + +## A.4 Major Supported Sections + +### A.4.1 `[ req ]` + +Defines the basic behavior for Certificate Signing Request (CSR) +generation and self-signed certificate creation. + +Example: + +``` +[ req ] +default_bits = 2048 +distinguished_name = req_distinguished_name +x509_extensions = v3_req +prompt = no +``` + +| Key | Description | +|----|------------| +| `default_bits` | Key size (when using RSA) | +| `distinguished_name` | DN definition section | +| `x509_extensions` | Extension section to apply | +| `prompt` | Whether DN input is interactive | + +--- + +### A.4.2 `[ req_distinguished_name ]` + +Defines individual attributes of the Distinguished Name (DN). + +``` +[ req_distinguished_name ] +C = US +ST = MT +L = Bozeman +O = wolfSSL Inc +OU = Engineering +CN = example.com +``` + +- Each key is interpreted as an X.509 DN attribute. +- Attributes not defined in the section are omitted. + +--- + +### A.4.3 X.509 Extension Sections +(e.g. `[ v3_req ]`, `[ v3_ca ]`) + +These sections define certificate extensions. + +**Subject Alternative Name (SAN)** + +``` +subjectAltName = @alt_names + +[ alt_names ] +DNS.1 = example.com +DNS.2 = www.example.com +``` + +**Basic Constraints** + +``` +basicConstraints = CA:FALSE +``` + +**Key Usage** + +``` +keyUsage = digitalSignature, keyEncipherment +``` + +**Extended Key Usage** + +``` +extendedKeyUsage = serverAuth, clientAuth +``` + +--- + +## A.5 Supported Extension Directives + +wolfCLU supports the following commonly used X.509 extensions: + +- `basicConstraints` +- `keyUsage` +- `extendedKeyUsage` +- `subjectAltName` +- `subjectKeyIdentifier` +- `authorityKeyIdentifier` + +If unsupported extensions are specified, the configuration file is still +parsed successfully, and the unsupported directives are ignored. + +--- + +## A.6 Mapping Between Commands and Sections + +| Command | Primary Sections Used | +|--------|----------------------| +| `req` | `req`, `req_distinguished_name`, extension sections | +| `x509` | Extension sections | +| `s_server` / `s_client` | Certificate loading only | + +--- + +## A.7 Major Differences from OpenSSL + +- No support for `include` / `include_dir` +- No support for `policy` sections +- No variable expansion (e.g. `${var}`) +- No engine-related configuration + +These features are **intentionally not implemented**. +wolfCLU aims to provide **the minimum configuration processing required +for CLI-based diagnostics and verification**. + +--- + +## A.8 Minimal Configuration Example + +``` +[ req ] +prompt = no +distinguished_name = dn +x509_extensions = v3 + +[ dn ] +CN = test.example.com + +[ v3 ] +basicConstraints = CA:FALSE +keyUsage = digitalSignature +``` + +--- + +## A.9 `[ ca ]` Section + +### A.9.1 Basic Structure + +``` +[ ca ] +default_ca = CA_default +``` + +The `[ ca ]` section acts as an **entry point that selects the actual CA +definition section** to be used. + +--- + +### A.9.2 CA Definition Section (Example: `[ CA_default ]`) + +``` +[ CA_default ] +dir = ./demoCA +certs = $dir/certs +crl_dir = $dir/crl +database = $dir/index.txt +serial = $dir/serial +certificate = $dir/cacert.pem +private_key = $dir/private/cakey.pem +default_md = sha256 +policy = policy_any +x509_extensions = v3_ca +``` + +> **Note** +> Not all keys are required. +> Any entries not referenced by wolfCLU are ignored. + +--- + +### A.9.3 Primary Supported Keys + +| Key | Description | +|----|------------| +| `certificate` | CA certificate file | +| `private_key` | CA private key file | +| `default_md` | Hash algorithm used for signing | +| `x509_extensions` | Extension section applied to issued certificates | + +The following keys may be written in OpenSSL-compatible form, but are +either ignored or only partially used by wolfCLU: + +- `database` +- `serial` +- `crl_dir` +- `policy` + +--- + +### A.9.4 Policy Sections (`[ policy_xxx ]`) + +In OpenSSL, policy sections are used to define DN constraints. +In wolfCLU, however, policy contents are **not evaluated or enforced**. + +``` +[ policy_any ] +countryName = optional +stateOrProvinceName = optional +organizationName = optional +commonName = supplied +``` + +This syntax is **accepted solely for configuration compatibility**; +no actual constraint checking is performed. + +--- + +### A.9.5 Limitations of the `[ ca ]` Section in wolfCLU + +wolfCLU’s CA processing differs from OpenSSL in the following ways: + +- No certificate issuance database management +- No automatic serial number file updates +- No CRL generation or management +- No support for re-issuance or revocation workflows + +As a result, the `[ ca ]` section is used strictly as a +**configuration mechanism for generating CA-signed certificates +in a simplified CA model**. + +--- + +## A.10 Primary Commands Using `[ ca ]` + +| Command | Use of the `[ ca ]` Section | +|--------|----------------------------| +| `x509` | Generation of CA-signed certificates | +| `req` | Signing CSRs with a CA |