public interface CommitmentScheme
extends org.cryptimeleon.math.serialization.StandaloneRepresentable, org.cryptimeleon.math.serialization.annotations.RepresentationRestorer
| Modifier and Type | Method and Description |
|---|---|
CommitmentPair |
commit(PlainText plainText)
Creates a commitment to the given
PlainText. |
int |
getMaxNumberOfBytesForMapToPlaintext()
Returns the maximal number of bytes that can be mapped injectively to a
PlainText by
mapToPlaintext(byte[]) |
PlainText |
mapToPlaintext(byte[] bytes)
Provides an injective mapping of the given
byte[] to a PlainText usable with this scheme
(which may be a MessageBlock). |
Commitment |
restoreCommitment(org.cryptimeleon.math.serialization.Representation repr) |
default CommitmentPair |
restoreCommitmentPair(org.cryptimeleon.math.serialization.Representation repr) |
default java.lang.Object |
restoreFromRepresentation(java.lang.reflect.Type type,
org.cryptimeleon.math.serialization.Representation repr) |
OpenValue |
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. |
CommitmentPair commit(PlainText plainText)
PlainText.plainText - the message to commit toCommitmentPair containing the commitment and an OpenValue that can be used to
reveal the committed message.boolean verify(Commitment commitment, OpenValue openValue, PlainText plainText)
PlainText 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.
commitment - commitment to verifyopenValue - used to open the commitment and reveal the contentplainText - the hash of this will be compared with the opened commitment messagePlainText mapToPlaintext(byte[] bytes)
byte[] 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.bytes - 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 longint getMaxNumberOfBytesForMapToPlaintext()
PlainText by
mapToPlaintext(byte[])
As described in 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.
mapToPlaintext(byte[]).default CommitmentPair restoreCommitmentPair(org.cryptimeleon.math.serialization.Representation repr)
Commitment restoreCommitment(org.cryptimeleon.math.serialization.Representation repr)
OpenValue restoreOpenValue(org.cryptimeleon.math.serialization.Representation repr)
default java.lang.Object restoreFromRepresentation(java.lang.reflect.Type type,
org.cryptimeleon.math.serialization.Representation repr)
restoreFromRepresentation in interface org.cryptimeleon.math.serialization.annotations.RepresentationRestorer