Module proxy_re

Module proxy_re 

Source
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§

ProxyReCiphertext
Ciphertext for proxy re-encryption.
ProxyReKeypair
Keypair for proxy re-encryption.
ProxyRePublicKey
Public key for proxy re-encryption.
ProxyReReKey
Re-encryption key for transforming ciphertexts.
ProxyReSecretKey
Secret key for proxy re-encryption.

Enums§

ProxyReError
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§

ProxyReResult
Result type for proxy re-encryption operations.