Skip to content

Commit

Permalink
Merge pull request #69 from fjarri/shares
Browse files Browse the repository at this point in the history
Rename "num_kfrags" to "shares"
  • Loading branch information
fjarri authored Sep 12, 2021
2 parents 3d3adf3 + fd691e2 commit c0e03ef
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 13 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Bumped `k256` to `0.9` and `ecdsa` to `0.12.2`. ([#53])
- Bumped `pyo3` to `0.14`. ([#65])
- Reduced the size of key material in `SecretKeyFactory` from 64 to 32 bytes. ([#64])
- Renamed `num_kfrags` to `shares` in `genereate_kfrags` ([#69])


### Added
Expand Down Expand Up @@ -42,6 +43,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[#64]: https://github.com/nucypher/rust-umbral/pull/64
[#65]: https://github.com/nucypher/rust-umbral/pull/65
[#67]: https://github.com/nucypher/rust-umbral/pull/67
[#69]: https://github.com/nucypher/rust-umbral/pull/69


## [0.2.0] - 2021-06-14
Expand Down
4 changes: 2 additions & 2 deletions umbral-pre-python/docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,9 @@ API reference
Decrypts ``ciphertext`` with the secret key of the delegator.

.. py:function:: generate_kfrags(delegating_sk: SecretKey, receiving_pk: PublicKey, signer: Signer, threshold: int, num_kfrags: int, sign_delegating_key: bool, sign_receiving_key: bool) -> List[VerifiedKeyFrag]
.. py:function:: generate_kfrags(delegating_sk: SecretKey, receiving_pk: PublicKey, signer: Signer, threshold: int, shares: int, sign_delegating_key: bool, sign_receiving_key: bool) -> List[VerifiedKeyFrag]
Generates ``num_kfrags`` key fragments that can be used to reencrypt the capsule for the holder of the secret key corresponding to ``receiving_pk``. ``threshold`` fragments will be enough for decryption.
Generates ``shares`` key fragments that can be used to reencrypt the capsule for the holder of the secret key corresponding to ``receiving_pk``. ``threshold`` fragments will be enough for decryption.

If ``sign_delegating_key`` or ``sign_receiving_key`` are ``True``, include these keys in the signature allowing proxies to verify the fragments were created with a given key or for a given key, respectively.

Expand Down
4 changes: 2 additions & 2 deletions umbral-pre-python/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ pub fn generate_kfrags(
receiving_pk: &PublicKey,
signer: &Signer,
threshold: usize,
num_kfrags: usize,
shares: usize,
sign_delegating_key: bool,
sign_receiving_key: bool,
) -> Vec<VerifiedKeyFrag> {
Expand All @@ -574,7 +574,7 @@ pub fn generate_kfrags(
&receiving_pk.backend,
&signer.backend,
threshold,
num_kfrags,
shares,
sign_delegating_key,
sign_receiving_key,
);
Expand Down
2 changes: 1 addition & 1 deletion umbral-pre-python/umbral_pre/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def generate_kfrags(
receiving_pk: PublicKey,
signer: SecretKey,
threshold: int,
num_kfrags: int,
shares: int,
sign_delegating_key: bool,
sign_receiving_key: bool,
) -> List[VerifiedKeyFrag]:
Expand Down
4 changes: 2 additions & 2 deletions umbral-pre-wasm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ pub fn generate_kfrags(
receiving_pk: &PublicKey,
signer: &Signer,
threshold: usize,
num_kfrags: usize,
shares: usize,
sign_delegating_key: bool,
sign_receiving_key: bool,
) -> Vec<JsValue> {
Expand All @@ -532,7 +532,7 @@ pub fn generate_kfrags(
&receiving_pk.0,
&signer.0,
threshold,
num_kfrags,
shares,
sign_delegating_key,
sign_receiving_key,
);
Expand Down
12 changes: 6 additions & 6 deletions umbral-pre/src/pre.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ pub fn decrypt_original(
dem.decrypt(ciphertext, &capsule.to_array())
}

/// Creates `num_kfrags` fragments of `delegating_sk`,
/// Creates `shares` fragments of `delegating_sk`,
/// which will be possible to reencrypt to allow the creator of `receiving_pk`
/// decrypt the ciphertext encrypted with `delegating_sk`.
///
Expand All @@ -84,22 +84,22 @@ pub fn decrypt_original(
/// corresponds to given delegating or receiving public keys
/// by supplying them to [`KeyFrag::verify()`](`crate::KeyFrag::verify`).
///
/// Returns a boxed slice of `num_kfrags` KeyFrags
/// Returns a boxed slice of `shares` KeyFrags
#[allow(clippy::too_many_arguments)]
pub fn generate_kfrags_with_rng(
rng: &mut (impl CryptoRng + RngCore),
delegating_sk: &SecretKey,
receiving_pk: &PublicKey,
signer: &Signer,
threshold: usize,
num_kfrags: usize,
shares: usize,
sign_delegating_key: bool,
sign_receiving_key: bool,
) -> Box<[VerifiedKeyFrag]> {
let base = KeyFragBase::new(rng, delegating_sk, receiving_pk, signer, threshold);

let mut result = Vec::<VerifiedKeyFrag>::new();
for _ in 0..num_kfrags {
for _ in 0..shares {
result.push(VerifiedKeyFrag::from_base(
rng,
&base,
Expand All @@ -119,7 +119,7 @@ pub fn generate_kfrags(
receiving_pk: &PublicKey,
signer: &Signer,
threshold: usize,
num_kfrags: usize,
shares: usize,
sign_delegating_key: bool,
sign_receiving_key: bool,
) -> Box<[VerifiedKeyFrag]> {
Expand All @@ -129,7 +129,7 @@ pub fn generate_kfrags(
receiving_pk,
signer,
threshold,
num_kfrags,
shares,
sign_delegating_key,
sign_receiving_key,
)
Expand Down

0 comments on commit c0e03ef

Please sign in to comment.