> For the complete documentation index, see [llms.txt](https://8w6s.gitbook.io/hvpdb/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://8w6s.gitbook.io/hvpdb/home/home-ja/rokkuoyobi/sekyuritimoderu.md).

# セキュリティモデル

HVPDB は静止時の暗号化に重点を置いています。オプションでユーザーごとの認証もサポートします。

### 高レベルのモデル

* メインの DB ファイルは暗号化されます。
* WAL ファイルは暗号化されます。
* マスターパスワードはファイル暗号化キー（FEK）を導出します。
* FEK は決して保存されません。
* ユーザーパスワードは KDF ハッシュとして保存されます。

暗号化プリミティブ：

* AES-256-GCM (AEAD)

暗号の詳細は にあります [暗号学と鍵導出](/hvpdb/home/home-ja/rokkuoyobi/to.md).

### 脅威モデル（範囲）

範囲内：

* オフラインでのディスク窃取
* 静止時データの機密性
* 暗号文の改ざん検出（AEAD）

範囲外：

* パスワードがメモリにあるような侵害されたランタイム
* 悪意のあるプラグイン（プラグインは信頼されたコード）
* TLS なしで HTTP サーバを公開した場合の通信の安全性

### 鍵管理

#### 鍵の作成

* DB/WAL ヘッダごとにランダムなソルトが生成されます。
* マスターパスワードは Argon2id または Scrypt を経由して FEK を導出します。

#### ローテーション

マスターパスワードをローテーションできます。これは古いパスワードで復号し、新しいパスワードで再書き込みします。

エントリポイント：

* CLI： `hvpdb passwd <target>`
* HVPShell： `crypt <password>`

#### バックアップと復旧

バックアップはファイル単位です。バックアップとパスワードを保護してください。

参照： [バックアップと復旧](/hvpdb/home/home-ja/cao-zuo/bakkuapputo.md).

{% hint style="warning" %}
暗号化は静止データを保護します。プロセス分離の代替にはなりません。同じプロセスで信頼できないコードを実行しないでください。
{% endhint %}

### タイミング攻撃耐性

資格情報の検証は不明なユーザーに対しても暗号処理を行います。

これによりタイミングに基づくユーザー列挙を防ぐのに役立ちます。

実装の詳細：

* 比較は を使用します `secrets.compare_digest()` （定数時間）

### TOCTOU 安全なロック取得

ロックファイルは原子的に作成されます。

これにより取得時のチェックと使用の間の競合（Time-Of-Check-To-Time-Of-Use レース）を回避します。

実装の詳細：

* を使用します `os.open(..., O_CREAT | O_EXCL)` ロック作成のために

### パスキー / FIDO2 認証（v1.0.7）

HVPDB は WebAuthn/FIDO2 によるパスワードレス認証をサポートします。

CLI エントリポイント：

* `hvpdb gen-passkey <user> --native`
* `hvpdb login-passkey <user> --native`

### アクセスキー認証

アクセスキーは自動化のための移植可能な資格情報です。

CLI エントリポイント：

* `hvpdb gen-key --qr --save access_key.json`
* `hvpdb shell <target> --access-key access_key.json`


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://8w6s.gitbook.io/hvpdb/home/home-ja/rokkuoyobi/sekyuritimoderu.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
