Module searchable

Module searchable 

Source
Expand description

Searchable Encryption for privacy-preserving keyword search.

This module provides searchable symmetric encryption (SSE) that allows searching encrypted data without decrypting it.

§Use Cases in CHIE Protocol

  • Encrypted Content Catalogs: Search encrypted file metadata without revealing content
  • Privacy-Preserving Discovery: Find content by keywords without exposing search queries
  • Delegated Search: Allow authorized parties to search encrypted data

§Protocol

  1. Index Generation: Create encrypted index of keywords in documents
  2. Trapdoor Generation: Generate search token for a keyword (requires secret key)
  3. Search: Match trapdoor against encrypted index without decryption
  4. Result Retrieval: Return matching document IDs

§Security

  • Server cannot learn: keywords, queries, or plaintext document content
  • Server can learn: search pattern (which queries match), access pattern (which documents match)
  • This is a deterministic SSE scheme (same keyword always produces same trapdoor)

§Example

use chie_crypto::searchable::{SearchableEncryption, EncryptedIndex};

// Create searchable encryption instance
let sse = SearchableEncryption::new();

// Build encrypted index
let mut index = EncryptedIndex::new(&sse);
index.add_document(1, &[b"rust".to_vec(), b"crypto".to_vec()]);
index.add_document(2, &[b"crypto".to_vec(), b"p2p".to_vec()]);
index.add_document(3, &[b"rust".to_vec(), b"p2p".to_vec()]);

// Generate search trapdoor
let trapdoor = sse.generate_trapdoor(b"crypto");

// Search the encrypted index
let results = index.search(&trapdoor);
assert_eq!(results.len(), 2); // Documents 1 and 2
assert!(results.contains(&1));
assert!(results.contains(&2));

Structs§

EncryptedIndex
Encrypted searchable index
EncryptedIndexBuilder
Builder for encrypted index with bulk operations
MultiKeywordSearch
Multi-keyword search (AND operation)
SearchableEncryption
Searchable symmetric encryption instance with master key
Trapdoor
Search trapdoor that allows searching without revealing the keyword

Enums§

SearchableError

Type Aliases§

DocumentId
Document ID type
SearchableResult