Expand description
Proxy Re-Encryption for delegated decryption.
This module implements a proxy re-encryption scheme that allows a proxy to transform a ciphertext encrypted under one public key into a ciphertext encrypted under another public key, without learning the plaintext or the secret keys.
§Use Cases for CHIE Protocol
- Content owners delegating access to others
- Revocable access control without re-encryption
- Efficient content sharing in P2P networks
- Privacy-preserving content distribution
§Example
use chie_crypto::proxy_re::*;
// Alice generates her keypair
let alice_keypair = ProxyReKeypair::generate();
// Bob generates his keypair
let bob_keypair = ProxyReKeypair::generate();
// Alice encrypts data
let plaintext = b"Secret content";
let ciphertext = alice_keypair.encrypt(plaintext).unwrap();
// Alice can decrypt
let decrypted = alice_keypair.decrypt(&ciphertext).unwrap();
assert_eq!(decrypted, plaintext);
// Alice generates a re-encryption key for Bob
let re_key = alice_keypair.generate_re_key(&bob_keypair.public_key());
// Proxy re-encrypts the ciphertext for Bob (without learning plaintext)
let re_encrypted = re_encrypt(&ciphertext, &re_key).unwrap();
// Bob decrypts the outer layer to recover the original ciphertext
let outer_decrypted = bob_keypair.decrypt(&re_encrypted).unwrap();
let inner_ciphertext: ProxyReCiphertext = crate::codec::decode(&outer_decrypted).unwrap();
// Alice can decrypt the inner ciphertext to get the plaintext
let final_plaintext = alice_keypair.decrypt(&inner_ciphertext).unwrap();
assert_eq!(final_plaintext, plaintext);Structs§
- Proxy
ReCiphertext - Ciphertext for proxy re-encryption.
- Proxy
ReKeypair - Keypair for proxy re-encryption.
- Proxy
RePublic Key - Public key for proxy re-encryption.
- Proxy
ReRe Key - Re-encryption key for transforming ciphertexts.
- Proxy
ReSecret Key - Secret key for proxy re-encryption.
Enums§
- Proxy
ReError - Errors that can occur during proxy re-encryption operations.
Functions§
- decrypt
- Decrypt a ciphertext with a secret key.
- encrypt
- Encrypt data under a public key.
- generate_
re_ key - Generate a re-encryption key from delegator’s secret key to delegatee’s public key.
- re_
encrypt - Re-encrypt a ciphertext using a re-encryption key.
Type Aliases§
- Proxy
ReResult - Result type for proxy re-encryption operations.