Skip to content

Commit

Permalink
Rename Capsule::from_pubkey -> from_public_key for uniformity with fr…
Browse files Browse the repository at this point in the history
…om_secret_key
  • Loading branch information
fjarri committed Mar 26, 2021
1 parent cc35cf9 commit c070b39
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions umbral-pre/src/capsule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ impl Capsule {
}

/// Generates a symmetric key and its associated KEM ciphertext
pub(crate) fn from_pubkey(pk: &PublicKey) -> (Capsule, CurvePoint) {
pub(crate) fn from_public_key(pk: &PublicKey) -> (Capsule, CurvePoint) {
let g = CurvePoint::generator();

let priv_r = CurveScalar::random_nonzero();
Expand Down Expand Up @@ -205,7 +205,7 @@ mod tests {
let receiving_sk = SecretKey::random();
let receiving_pk = PublicKey::from_secret_key(&receiving_sk);

let (capsule, key_seed) = Capsule::from_pubkey(&delegating_pk);
let (capsule, key_seed) = Capsule::from_public_key(&delegating_pk);

let kfrags = generate_kfrags(&delegating_sk, &receiving_pk, &signing_sk, 2, 3, true, true);

Expand Down Expand Up @@ -242,7 +242,7 @@ mod tests {
.is_none());

// Mismatched capsule
let (capsule2, _key_seed) = Capsule::from_pubkey(&delegating_pk);
let (capsule2, _key_seed) = Capsule::from_public_key(&delegating_pk);
assert!(capsule2
.open_reencrypted(&receiving_sk, &delegating_pk, &cfrags)
.is_none());
Expand Down
2 changes: 1 addition & 1 deletion umbral-pre/src/pre.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use alloc::boxed::Box;
/// and encapsulates the key for later reencryption.
/// Returns the KEM [`Capsule`] and the ciphertext.
pub fn encrypt(pk: &PublicKey, plaintext: &[u8]) -> Option<(Capsule, Box<[u8]>)> {
let (capsule, key_seed) = Capsule::from_pubkey(pk);
let (capsule, key_seed) = Capsule::from_public_key(pk);
// TODO (#43): add salt and info here?
let dem = DEM::new(&key_seed.to_array(), None, None);
let capsule_bytes = capsule.to_array();
Expand Down

0 comments on commit c070b39

Please sign in to comment.