recover_shared_key: Recover a secret key from distributed shares

View source: R/secret-sharing.R

recover_shared_keyR Documentation

Recover a secret key from distributed shares

Description

Inverse of share_keys(). Given a SecretShareMap holding at least threshold shares, reconstructs a PrivateKey equivalent to the original secret at the point of sharing. The reconstructed key participates in distributed decryption identically to the original, so a dropped-out party's share of a threshold decryption can still be completed by the remaining parties.

Usage

recover_shared_key(
  cc,
  share_map,
  n_parties,
  threshold,
  sharing_scheme = "additive"
)

Arguments

cc

A CryptoContext. Used to construct the empty placeholder key that the scheme routine fills in.

share_map

A SecretShareMap from share_keys().

n_parties

Integer; must match the value used at share_keys() time.

threshold

Integer; must match the value used at share_keys() time.

sharing_scheme

Character; must match the value used at share_keys() time.

Details

Under the hood, the C++ API takes a mutable PrivateKey reference that must be pre-allocated as an empty PrivateKeyImpl bound to cc. The R wrapper constructs that empty placeholder internally so R users do not have to know about the in-place-fill convention.

Value

A PrivateKey holding the reconstructed secret.

See Also

share_keys()


openfhe.R documentation built on Nov. 13, 2026, 5:07 p.m.