Anonymity - Monero Inheritance setup #48

Open
opened 2024-09-18 19:04:36 +02:00 by nihilist · 5 comments
Owner
No description provided.
nihilist added this to the OPSEC Tutorials (paid contributions) project 2024-09-18 19:04:36 +02:00
Author
Owner

can be inspired from what was attempted here #1

can be inspired from what was attempted here https://git.nowhere.moe/nihilist/blog-contributions/pulls/1
nihilist added the
Complex
label 2024-09-23 10:41:00 +02:00
Author
Owner

could be simplified ?

  1. generate 3 keys, and make sure that only 2 out of the 3 keys can unlock the encrypted volume (not possible to do with monero directly ? 2:3 multisig ?)
  2. need a way to have 2 out of 3 keys to be able to unlock a simple encrypted file
  3. give the encrypted file (containing seed phrase) to lawyer, and to the inheritor

Passing out procedure:

  1. lawyer sees that you die
  2. lawyer gives the key to your inheritor
  3. inheritor has 2 out of the 3 keys to unlock the volume, and can get the monero funds
could be simplified ? 1) generate 3 keys, and make sure that only 2 out of the 3 keys can unlock the encrypted volume (not possible to do with monero directly ? 2:3 multisig ?) 2) need a way to have 2 out of 3 keys to be able to unlock a simple encrypted file 3) give the encrypted file (containing seed phrase) to lawyer, and to the inheritor Passing out procedure: 1) lawyer sees that you die 2) lawyer gives the key to your inheritor 3) inheritor has 2 out of the 3 keys to unlock the volume, and can get the monero funds
Author
Owner

original idea: https://medium.com/@kyodo-tech/threshold-encryption-for-secure-multi-party-collaboration-72e168052da7

Generate the secret that needs to be protected. Use Shamir’s Secret Sharing to split the secret into N shares with a threshold T. Each share is a part of the secret, ensuring that any subset of fewer than T shares provides no information about the secret.
Encrypt each share using the public key of the respective recipient with OpenPGP. Only the intended recipient can decrypt their share using their private key.
Distribute the encrypted shares to the respective recipients. Each recipient receives a part of the secret, encrypted with their own public key.
Recipients decrypt their shares using their private keys. Combine the decrypted shares using the SSS reconstruction process to recover the original secret. This requires at least T shares.
# Install a shamir cli tool, e.g.
go install github.com/kyodo-tech/shamir/cmd/sss@latest
# Step 1: Split the secret into shares
sss -mode=split -secret="my secret" -n=5 -T=3
# Output:
# N8QLmd6YcLu2AQ==
# Nnubhbvx52y8Ag==
# bMawbwAK5bJ+Aw==
# SurUYDi7Mfm4BA==
# EFf/ioNAMyd6BQ==

# Step 2: Encrypt each share with the recipient's public key
echo "N8QLmd6YcLu2AQ==" | gpg --armor --encrypt -r bob@example.com > share_bob.asc
echo "Nnubhbvx52y8Ag==" | gpg --armor --encrypt -r alice@example.com > share_alice.asc
echo "bMawbwAK5bJ+Aw==" | gpg --armor --encrypt -r bill@example.com > share_bill.asc
# ...

# Step 3: Decrypt the shares (done by the recipients)
gpg --decrypt share_bob.asc > share_bob.txt
gpg --decrypt share_alice.asc > share_alice.txt
gpg --decrypt share_bill.asc > share_bill.txt

# Step 4: Combine 3 of the decrypted shares to reconstruct the secret
sss -mode=combine -shares=$(cat share_bob.txt),$(cat share_alice.txt),$(cat share_bill.txt)
# Output:
# my secret
# Extract the beginning of the encrypted file
head -c 1024k bigfile.gpg > head.gpg

# Extract session key locally
gpg --show-session-key head.gpg

# Use the extracted session key to decrypt on the server
gpg -d -o bigfile --override-session-key $combined_key bigfile.gpg
# Generate a session key
session_key=$(openssl rand -base64 32)

# Encrypt a large file with the session key
echo $session_key | gpg --symmetric --cipher-algo AES256 --passphrase-fd 0 -o encrypted_data.gpg original_data

# Split the session key into shares
echo $session_key | sss -n=5 -T=3
# share1
# ...

# Encrypt Each Share with Public Keys as before
echo "share2" | gpg --armor --encrypt -r alice@example.com > share_alice.asc
# ...

# Decrypt the shares on the target machines
gpg --decrypt share_alice.asc > share_alice.txt
# ...

# Re-combine the shares to reconstruct the session key
combined_key=$(sss -mode=combine -shares=$(cat share_participant1.txt),$(cat share_participant2.txt),$(cat share_participant3.txt))

# Decrypt the large file using the combined key
echo $combined_key | gpg --decrypt --passphrase-fd 0 -o original_data encrypted_data.gpg
original idea: https://medium.com/@kyodo-tech/threshold-encryption-for-secure-multi-party-collaboration-72e168052da7 Generate the secret that needs to be protected. Use Shamir’s Secret Sharing to split the secret into N shares with a threshold T. Each share is a part of the secret, ensuring that any subset of fewer than T shares provides no information about the secret. Encrypt each share using the public key of the respective recipient with OpenPGP. Only the intended recipient can decrypt their share using their private key. Distribute the encrypted shares to the respective recipients. Each recipient receives a part of the secret, encrypted with their own public key. Recipients decrypt their shares using their private keys. Combine the decrypted shares using the SSS reconstruction process to recover the original secret. This requires at least T shares. ```bash # Install a shamir cli tool, e.g. go install github.com/kyodo-tech/shamir/cmd/sss@latest # Step 1: Split the secret into shares sss -mode=split -secret="my secret" -n=5 -T=3 # Output: # N8QLmd6YcLu2AQ== # Nnubhbvx52y8Ag== # bMawbwAK5bJ+Aw== # SurUYDi7Mfm4BA== # EFf/ioNAMyd6BQ== # Step 2: Encrypt each share with the recipient's public key echo "N8QLmd6YcLu2AQ==" | gpg --armor --encrypt -r bob@example.com > share_bob.asc echo "Nnubhbvx52y8Ag==" | gpg --armor --encrypt -r alice@example.com > share_alice.asc echo "bMawbwAK5bJ+Aw==" | gpg --armor --encrypt -r bill@example.com > share_bill.asc # ... # Step 3: Decrypt the shares (done by the recipients) gpg --decrypt share_bob.asc > share_bob.txt gpg --decrypt share_alice.asc > share_alice.txt gpg --decrypt share_bill.asc > share_bill.txt # Step 4: Combine 3 of the decrypted shares to reconstruct the secret sss -mode=combine -shares=$(cat share_bob.txt),$(cat share_alice.txt),$(cat share_bill.txt) # Output: # my secret ``` ```bash # Extract the beginning of the encrypted file head -c 1024k bigfile.gpg > head.gpg # Extract session key locally gpg --show-session-key head.gpg # Use the extracted session key to decrypt on the server gpg -d -o bigfile --override-session-key $combined_key bigfile.gpg ``` ```bash # Generate a session key session_key=$(openssl rand -base64 32) # Encrypt a large file with the session key echo $session_key | gpg --symmetric --cipher-algo AES256 --passphrase-fd 0 -o encrypted_data.gpg original_data # Split the session key into shares echo $session_key | sss -n=5 -T=3 # share1 # ... # Encrypt Each Share with Public Keys as before echo "share2" | gpg --armor --encrypt -r alice@example.com > share_alice.asc # ... # Decrypt the shares on the target machines gpg --decrypt share_alice.asc > share_alice.txt # ... # Re-combine the shares to reconstruct the session key combined_key=$(sss -mode=combine -shares=$(cat share_participant1.txt),$(cat share_participant2.txt),$(cat share_participant3.txt)) # Decrypt the large file using the combined key echo $combined_key | gpg --decrypt --passphrase-fd 0 -o original_data encrypted_data.gpg ```
Author
Owner

mirrored the shamir repository here: https://git.nowhere.moe/nihilist/shamir

mirrored the shamir repository here: https://git.nowhere.moe/nihilist/shamir
Author
Owner

CONTEXT:

  1. Bob is getting old, he has 9000 moneros on his wallet, he doesn't want to carry his monero wallet seed phrase into his grave
CONTEXT: 1) Bob is getting old, he has 9000 moneros on his wallet, he doesn't want to carry his monero wallet seed phrase into his grave 2) 3) 4)
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: nihilist/blog-contributions#48
No description provided.