This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# stage50_group_reliable.py | |
# 段階50:グループ通信 × ダブルラチェット(Sender Keys) × 信頼配送(ACK/再送/順序整列/重複排除) | |
# 実行: pip install cryptography && python stage50_group_reliable.py | |
import os, time, random, hmac, hashlib, collections | |
from dataclasses import dataclass | |
from typing import Dict, Tuple, List, Optional | |
from cryptography.hazmat.primitives import hashes | |
from cryptography.hazmat.primitives.kdf.hkdf import HKDF | |
from cryptography.hazmat.primitives.ciphers.aead import AESGCM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# stage51_dynamic_group_reliable.py | |
# 段階51:動的メンバー管理(JOIN/LEAVE+即REKEY)× 信頼配送(ACK/再送) | |
# + ダブルラチェット(Sender Keys)でPFS | |
# 依存: cryptography | |
# 実行: pip install cryptography && python stage51_dynamic_group_reliable.py | |
import os, time, random, hmac, hashlib, collections | |
from dataclasses import dataclass | |
from typing import Dict, Tuple, List, Optional | |
from cryptography.hazmat.primitives import hashes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# stage52_persistent_state.py | |
# 段階52:安全な永続化(AES-GCM暗号化)+ 再起動復帰 + 監査ログ(HMACチェーン) | |
# 実行: pip install cryptography && python stage52_persistent_state.py | |
import os, time, json, base64, random, hmac, hashlib, collections | |
from dataclasses import dataclass, asdict, field | |
from typing import Dict, Tuple, List, Optional, Any | |
from cryptography.hazmat.primitives import hashes | |
from cryptography.hazmat.primitives.kdf.hkdf import HKDF | |
from cryptography.hazmat.primitives.ciphers.aead import AESGCM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# stage54_key_wrapping_rotation.py | |
# 段階54:二重鍵化(Key Wrapping: scrypt+AES-GCM)+ パスフレーズ保護 + 鍵ローテーション + 監査鍵分離 | |
# 依存: cryptography | |
# 実行: pip install cryptography && python stage54_key_wrapping_rotation.py | |
import os, sys, time, json, base64, random, hmac, hashlib, getpass | |
from dataclasses import dataclass, field | |
from typing import Dict, Tuple, List, Optional, Any | |
from cryptography.hazmat.primitives.kdf.scrypt import Scrypt | |
from cryptography.hazmat.primitives.ciphers.aead import AESGCM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# qkd55_fixed.py — 段階55: ラップ/アンラップを堅牢化(InvalidTag根絶) | |
# 依存: cryptography (AESGCM), 標準ライブラリのみ | |
from __future__ import annotations | |
from dataclasses import dataclass, field | |
from typing import Optional, Dict | |
import secrets, hmac, hashlib, base64 | |
from cryptography.hazmat.primitives.ciphers.aead import AESGCM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# qkd56.py — 段階56 完全修正版(Audit暗号化のInvalidTag根絶) | |
# 依存: cryptography (AESGCM) | |
from __future__ import annotations | |
from dataclasses import dataclass, field | |
from typing import Dict, List, Tuple, Optional | |
import secrets, base64, hmac, hashlib, struct | |
from cryptography.hazmat.primitives.ciphers.aead import AESGCM |