public class PedersenCommitmentScheme extends java.lang.Object implements CommitmentScheme
CommitmentScheme interface and provides a concrete Pedersen commitment scheme implementation
for (commit, open) methods.| Modifier and Type | Field and Description |
|---|---|
protected org.cryptimeleon.math.structures.groups.GroupElement |
g |
protected org.cryptimeleon.math.structures.groups.Group |
group |
protected org.cryptimeleon.math.structures.groups.cartesian.GroupElementVector |
h |
| Constructor and Description |
|---|
PedersenCommitmentScheme(org.cryptimeleon.math.structures.groups.Group group,
org.cryptimeleon.math.structures.groups.GroupElement g,
org.cryptimeleon.math.structures.groups.cartesian.GroupElementVector h) |
PedersenCommitmentScheme(org.cryptimeleon.math.structures.groups.Group group,
int numMessages) |
PedersenCommitmentScheme(org.cryptimeleon.math.serialization.Representation repr) |
| Modifier and Type | Method and Description |
|---|---|
CommitmentPair |
commit(PlainText plainText)
Creates a commitment to the given
PlainText. |
CommitmentPair |
commit(org.cryptimeleon.math.structures.rings.cartesian.RingElementVector valuesToCommit) |
CommitmentPair |
commit(org.cryptimeleon.math.structures.rings.cartesian.RingElementVector valuesToCommit,
org.cryptimeleon.math.structures.rings.zn.Zn.ZnElement randomness) |
CommitmentPair |
commit(org.cryptimeleon.math.structures.rings.zn.Zn.ZnElement... valuesToCommit) |
boolean |
equals(java.lang.Object o) |
int |
getMaxNumberOfBytesForMapToPlaintext()
Returns the maximal number of bytes that can be mapped injectively to a
PlainText by
CommitmentScheme.mapToPlaintext(byte[]) |
org.cryptimeleon.math.serialization.Representation |
getRepresentation() |
int |
hashCode() |
MessageBlock |
mapToPlaintext(byte[] bytes)
Provides an injective mapping of the given
byte[] to a PlainText usable with this scheme
(which may be a MessageBlock). |
PedersenCommitment |
restoreCommitment(org.cryptimeleon.math.serialization.Representation repr) |
PedersenOpenValue |
restoreOpenValue(org.cryptimeleon.math.serialization.Representation repr) |
boolean |
verify(Commitment commitment,
OpenValue openValue,
PlainText plainText)
Verifies that the given announced
PlainText equals the result of opening
the Commitment with the OpenValue. |
boolean |
verify(Commitment commitment,
OpenValue openValue,
org.cryptimeleon.math.structures.rings.cartesian.RingElementVector committedValues) |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitrestoreCommitmentPair, restoreFromRepresentationprotected org.cryptimeleon.math.structures.groups.Group group
protected org.cryptimeleon.math.structures.groups.cartesian.GroupElementVector h
protected org.cryptimeleon.math.structures.groups.GroupElement g
public PedersenCommitmentScheme(org.cryptimeleon.math.serialization.Representation repr)
public PedersenCommitmentScheme(org.cryptimeleon.math.structures.groups.Group group,
org.cryptimeleon.math.structures.groups.GroupElement g,
org.cryptimeleon.math.structures.groups.cartesian.GroupElementVector h)
public PedersenCommitmentScheme(org.cryptimeleon.math.structures.groups.Group group,
int numMessages)
public CommitmentPair commit(PlainText plainText)
CommitmentSchemePlainText.commit in interface CommitmentSchemeplainText - the message to commit toCommitmentPair containing the commitment and an OpenValue that can be used to
reveal the committed message.public CommitmentPair commit(org.cryptimeleon.math.structures.rings.zn.Zn.ZnElement... valuesToCommit)
public CommitmentPair commit(org.cryptimeleon.math.structures.rings.cartesian.RingElementVector valuesToCommit)
public CommitmentPair commit(org.cryptimeleon.math.structures.rings.cartesian.RingElementVector valuesToCommit, org.cryptimeleon.math.structures.rings.zn.Zn.ZnElement randomness)
public boolean verify(Commitment commitment, OpenValue openValue, PlainText plainText)
CommitmentSchemePlainText equals the result of opening
the Commitment with the OpenValue.
A commitment scheme such as HashThenCommitCommitmentScheme may also hash the message before committing
to it. This method can take this into account, i.e. by hashing the given announced plaintext before comparing.
verify in interface CommitmentSchemecommitment - commitment to verifyopenValue - used to open the commitment and reveal the contentplainText - the hash of this will be compared with the opened commitment messagepublic boolean verify(Commitment commitment, OpenValue openValue, org.cryptimeleon.math.structures.rings.cartesian.RingElementVector committedValues)
public MessageBlock mapToPlaintext(byte[] bytes) throws java.lang.IllegalArgumentException
CommitmentSchemebyte[] to a PlainText usable with this scheme
(which may be a MessageBlock).
It only guarantees injectivity for arrays of the same length.
Applications that would like to use mapToPlaintext with multiple different array lengths
may want to devise a padding method and then only call mapToPlaintext with
byte arrays of the same (padded) length.mapToPlaintext in interface CommitmentSchemebytes - byte[] to map to a PlainText that can be committed to using this commitment schemePlainText usable with this commitment schemejava.lang.IllegalArgumentException - if there is no injective PlainText element corresponding to the given
bytes, for example if the byte array is too longpublic int getMaxNumberOfBytesForMapToPlaintext()
CommitmentSchemePlainText by
CommitmentScheme.mapToPlaintext(byte[])
As described in CommitmentScheme.mapToPlaintext(byte[]) there might be no injective PlainText for some byte arrays, e.g.
if the byte array is too long. Therefore, this method provides the maximal number of bytes that can be mapped
injectively to a PlainText.
getMaxNumberOfBytesForMapToPlaintext in interface CommitmentSchemeCommitmentScheme.mapToPlaintext(byte[]).public PedersenCommitment restoreCommitment(org.cryptimeleon.math.serialization.Representation repr)
restoreCommitment in interface CommitmentSchemepublic PedersenOpenValue restoreOpenValue(org.cryptimeleon.math.serialization.Representation repr)
restoreOpenValue in interface CommitmentSchemepublic org.cryptimeleon.math.serialization.Representation getRepresentation()
getRepresentation in interface org.cryptimeleon.math.serialization.Representablepublic boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Object