Struct scrambledb::setup::StoreContext
source · pub struct StoreContext { /* private fields */ }
Implementations§
source§impl StoreContext
impl StoreContext
sourcepub fn setup(randomness: &mut Randomness) -> Result<Self, Error>
pub fn setup(randomness: &mut Randomness) -> Result<Self, Error>
§Data Store Setup
On setup, a data store initializes a coPRFReceiverContext, derives a pair of encryption and decryption keys for the RPKE as well as a private PRP key.
Inputs:
randomness: (NcoPRFReceiver + NRPKEKeyGen + NPRP) uniformly random bytes
Outputs:
coprf_receiver_context: CoPRFReceiverContext
ek: RPKE.EncryptionKey
dk: RPKE.DecryptionKey
k_prp: PRP.PRPKey
fn setup(randomness) -> StoreContext:
let coprf_receiver_context =
CoPRFReceiverContext::new(randomness[NcoPRFReceiver]);
let (ek, dk) = RPKE.generate_keys(randomness[NRPKEKeyGen]);
let k_prp = PRP.KeyGen(randomness[NPRP]);
StoreContext{
coprf_receiver_context,
ek,
dk,
k_prp
}
sourcepub fn public_keys(&self) -> (StoreEncryptionKey, BlindingPublicKey)
pub fn public_keys(&self) -> (StoreEncryptionKey, BlindingPublicKey)
Given a store context generated as above, the following methods are available:
- Retrieve store public keys for encryption and coPRF blinding.
Input:
context: StoreContext
Output:
ek: RPKE.EncryptionKey
bpk: CoPRF.BlindingPublicKey
fn public_keys(context):
let ek = context.ek;
let bpk = context.coprf_receiver_context.public_key()
return (ek, bpk);
sourcepub fn finalize_pseudonym(
&self,
blind_pseudonym: BlindedPseudonymizedHandle
) -> Result<FinalizedPseudonym, Error>
pub fn finalize_pseudonym( &self, blind_pseudonym: BlindedPseudonymizedHandle ) -> Result<FinalizedPseudonym, Error>
- Finalize Pseudonym: As part of the finalization of a split or join conversion the raw pseudonyms that are the unblinded result of coPRF evaluation are further hardened by application of a PRP.
Input:
context: StoreContext
blind_pseudonym: CoPRFBlindOutput
Output:
pseudonym: Pseudonym
fn finalize_pseudonym(context, blind_pseudonym):
let raw_pseudonym =
context.coprf_receiver_context.finalize(blind_pseudonym);
return PRP.eval(context.k_prp, raw_pseudonym)
sourcepub fn recover_raw_pseudonym(
&self,
pseudonym: FinalizedPseudonym
) -> Result<P256Point, Error>
pub fn recover_raw_pseudonym( &self, pseudonym: FinalizedPseudonym ) -> Result<P256Point, Error>
-
Recover Raw Pseudonym: In preparation of a join conversion, the raw pseudonyms, i.e. coPRF outputs must be recovered from the hardened pseudonyms before they can be sent to the converter for blind conversion.
Inputs: context: StoreContext pseudonym: Pseudonym Output: raw_pseudonym: CoPRFOutput fn recover_raw_pseudonym(context, pseudonym): return PRP.invert(context.k_prp, pseudonym)
Auto Trait Implementations§
impl Freeze for StoreContext
impl RefUnwindSafe for StoreContext
impl Send for StoreContext
impl Sync for StoreContext
impl Unpin for StoreContext
impl UnwindSafe for StoreContext
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more