How tamzidrahman1029/health-care-encryption works
This repository is a prototype for encrypting and sharing electronic health records (EHRs), with encrypted files kept off-chain and record metadata and hashes registered on a blockchain. The intended workflow is to encrypt an EHR, protect its AES key, store the ciphertext, register its reference and hash, then let an authorized hospital retrieve and verify the file before decrypting it. The sampled API implements token checks and hash verification; the receiver script demonstrates ML-KEM-based transfer and decryption. Separate ECC, ML-KEM, and object-storage utilities are also present. README evidence only describes a minimal Hardhat project, so wiring for unsampled modules is not inferred.
Main entry points: hospital_api.py EHR request API · hospital_b_receive.py Hospital receiver · EHRStorage.sol EHR metadata contract · encrypt_patient.py EHR encryption
Components 17
EHR cryptography
- EHR encryption
encrypt_patient.py - AES key setup
generate_aes_key.py - ECC key protection
ecc_key_protection.py - ML-KEM protection
mlkem_key_protection.py - ECC recovery
recover_and_decrypt.py - ML-KEM recovery
mlkem_recover_and_decrypt.py - Load and decrypt
load_and_decrypt.py - Hash generation
generate_hash.py
Blockchain registry
- EHR metadata contract
blockchain/contracts/EHRStorage.sol - Record registration
blockchain/blockchain_register.py - Blockchain node
Encrypted storage
- Private file store
private_storage - Object storage API
storage_server/fastapi_storage.py - Object files
storage_server/ehr_object_storage
Hospital sharing
- EHR request API
hospital_api.py - Hospital receiver
HospitalB_Node/hospital_b_receive.py
Other components
- Hospital staff
Connections 24
- Hospital staff → EHR encryption: provides EHR
- Hospital staff → EHR request API: requests record
- Hospital staff → Hospital receiver: initiates transfer
- Hospital staff → Object storage API: uploads file
- EHR encryption → AES key setup: uses key
- EHR encryption → Hash generation: hashes ciphertext
- AES key setup → ECC key protection: protects key
- AES key setup → ML-KEM protection: protects key
- ECC recovery → Load and decrypt: provides key
- ML-KEM recovery → Load and decrypt: provides key
- EHR request API → Blockchain node: reads records
- EHR request API → EHR metadata contract: queries metadata
- EHR request API → Private file store: reads ciphertext
- EHR request API → Hash generation: verifies file
- EHR request API → Hospital staff: returns verified file
- Record registration → Blockchain node: submits transaction
- Record registration → EHR metadata contract: adds record
- Blockchain node → EHR metadata contract: executes calls
- Hospital receiver → EHR metadata contract: adds and reads records
- Hospital receiver → ML-KEM protection: wraps AES key
- Hospital receiver → ML-KEM recovery: recovers AES key
- Hospital receiver → Hash generation: checks ciphertext
- Hospital receiver → Load and decrypt: decrypts EHR
- Object storage API → Object files: writes and serves