Skip to content

Commit

Permalink
primitives: elgamal: publicize key fields
Browse files Browse the repository at this point in the history
  • Loading branch information
joeykraut committed Feb 23, 2024
1 parent 8fd52e2 commit e3253cb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 10 additions & 3 deletions primitives/src/elgamal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ pub struct EncKey<P>
where
P: Config,
{
pub(crate) key: Projective<P>,
/// The underlying elliptic curve point
pub key: Projective<P>,
}

impl<P: Config> Hash for EncKey<P> {
Expand All @@ -69,11 +70,12 @@ impl<P: Config> PartialEq for EncKey<P> {
Clone(bound = "P: Config"),
PartialEq(bound = "P: Config")
)]
pub(crate) struct DecKey<P>
pub struct DecKey<P>
where
P: Config,
{
key: P::ScalarField,
/// The underlying field element of the key
pub key: P::ScalarField,
}

impl<P: Config> Drop for DecKey<P> {
Expand Down Expand Up @@ -166,6 +168,11 @@ where
KeyPair { enc, dec }
}

/// Get the decryption key
pub fn dec_key(&self) -> DecKey<P> {
self.dec.clone()
}

/// Get decryption key reference
pub(crate) fn dec_key_ref(&self) -> &DecKey<P> {
&self.dec
Expand Down
2 changes: 1 addition & 1 deletion relation/src/gadgets/ecc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ where

#[derive(Debug, Copy, Clone, Eq, PartialEq)]
/// Represent variable of an EC point.
pub struct PointVariable(Variable, Variable);
pub struct PointVariable(pub Variable, pub Variable);

impl PointVariable {
/// Get the variable representing the x coordinate of the point.
Expand Down

0 comments on commit e3253cb

Please sign in to comment.