sequenceDiagram
participant C as Client
participant S as Server
C->>S: TCP接続
Note over C,S: 1. ホスト認証 (Server Authentication)
S->>C: サーバ公開鍵送信
C->>C: サーバ鍵を known_hosts と照合
C->S: セッション鍵生成 & 交換
Note over C,S: 2. クライアント認証 (Client Authentication)
C->>S: ユーザ名送信
S->>C: 認証方式要求 (password / publickey )
C->>S: 公開鍵署名送信
S->>S: 署名を公開鍵で検証
S->>C: Authentication OK & セッション開始