public interface SignatureScheme
extends org.cryptimeleon.math.serialization.StandaloneRepresentable, org.cryptimeleon.math.serialization.annotations.RepresentationRestorer
SignatureScheme has the ability to sign plaintexts
and verify the resulting signature (using SigningKeys and VerificationKeys).
The functional contract is that verify(sign(m, sk), pk) == true for sk, pk that
"fit" together (depending on the concrete type of signature scheme).
Sub-Interfaces define how you obtain signing and verification keys.
SignatureScheme instances implement StandaloneRepresentable.
So once set up, you can restore the same scheme with the same public parameters
using the Representation mechanism (i.e. call the class's constructor
with a Representation argument).
We note that we see all signature schemes as single-message schemes.
However, some signature schemes may be able to sign MessageBlocks
(cf., for example, StandardMultiMessageSignatureScheme).
| Modifier and Type | Method and Description |
|---|---|
int |
getMaxNumberOfBytesForMapToPlaintext()
Returns the maximal number of bytes that can be mapped injectively to a
PlainText by
mapToPlaintext(byte[], SigningKey) and mapToPlaintext(byte[], VerificationKey). |
PlainText |
mapToPlaintext(byte[] bytes,
SigningKey sk)
Provides an injective mapping of the given bytes to a
PlainText usable with this scheme (which may be a
MessageBlock). |
PlainText |
mapToPlaintext(byte[] bytes,
VerificationKey pk)
Provides an injective mapping of the given bytes to a
PlainText usable with this scheme (which may be a
MessageBlock). |
default java.lang.Object |
restoreFromRepresentation(java.lang.reflect.Type type,
org.cryptimeleon.math.serialization.Representation repr) |
PlainText |
restorePlainText(org.cryptimeleon.math.serialization.Representation repr) |
Signature |
restoreSignature(org.cryptimeleon.math.serialization.Representation repr) |
SigningKey |
restoreSigningKey(org.cryptimeleon.math.serialization.Representation repr) |
VerificationKey |
restoreVerificationKey(org.cryptimeleon.math.serialization.Representation repr) |
Signature |
sign(PlainText plainText,
SigningKey secretKey)
Signs the giving plaintext using the given signing key.
|
default Signature |
sign(org.cryptimeleon.math.serialization.Representation plainText,
org.cryptimeleon.math.serialization.Representation secretKey) |
java.lang.Boolean |
verify(PlainText plainText,
Signature signature,
VerificationKey publicKey)
Verifies the given signature for the given plaintext using the given verification key.
|
default java.lang.Boolean |
verify(org.cryptimeleon.math.serialization.Representation plainText,
org.cryptimeleon.math.serialization.Representation signature,
org.cryptimeleon.math.serialization.Representation publicKey) |
Signature sign(PlainText plainText, SigningKey secretKey)
plainText - the message to signsecretKey - the secret signing keyplainText computed using secretKeyjava.lang.Boolean verify(PlainText plainText, Signature signature, VerificationKey publicKey)
plainText - the plaintext the signature should validate againstsignature - the signature to verifypublicKey - the verification key to verify withPlainText restorePlainText(org.cryptimeleon.math.serialization.Representation repr)
Signature restoreSignature(org.cryptimeleon.math.serialization.Representation repr)
SigningKey restoreSigningKey(org.cryptimeleon.math.serialization.Representation repr)
VerificationKey restoreVerificationKey(org.cryptimeleon.math.serialization.Representation repr)
default Signature sign(org.cryptimeleon.math.serialization.Representation plainText, org.cryptimeleon.math.serialization.Representation secretKey)
default java.lang.Boolean verify(org.cryptimeleon.math.serialization.Representation plainText,
org.cryptimeleon.math.serialization.Representation signature,
org.cryptimeleon.math.serialization.Representation publicKey)
PlainText mapToPlaintext(byte[] bytes, VerificationKey pk)
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.
The contract is that VerificationKey pk and SigningKey sk are compatible
(in the sense that verify(m,sign(m, sk),pk) == true),
then mapToPlaintext(bytes, pk)) equals mapToPlaintext(bytes, sk) for all bytes.
bytes - bytes to be mapped to a PlainTextpk - the verification key for which the resulting PlainText should be valid
(note that the plaintext space may differ for different verification keys).java.lang.IllegalArgumentException - if there is no injective PlainText element of
these bytes (e.g., the byte array is too long)PlainText mapToPlaintext(byte[] bytes, SigningKey sk)
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.
The contract is that VerificationKey pk and SigningKey sk are compatible
(in the sense that verify(m,sign(m, sk),pk) == true),
then mapToPlaintext(bytes, pk)) equals mapToPlaintext(bytes, sk) for all bytes.
bytes - bytes to be mapped to a PlainTextsk - the signing key for which the resulting PlainText should be valid
(note that the plaintext space may differ for different signing keys).java.lang.IllegalArgumentException - if there is no injective PlainText element of
these bytes (e.g., the byte array is too long)int getMaxNumberOfBytesForMapToPlaintext()
PlainText by
mapToPlaintext(byte[], SigningKey) and mapToPlaintext(byte[], VerificationKey).
As described in mapToPlaintext(byte[], org.cryptimeleon.craco.sig.VerificationKey) 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[], org.cryptimeleon.craco.sig.VerificationKey).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