Top Fields Constructors Methods
org.bouncycastle.pqc.crypto.picnic

pack-priv Class PicnicEngine

extends Object
Class Inheritance
Imports
java.security.SecureRandom, java.util.logging.Logger, org.bouncycastle.crypto.Xof, org.bouncycastle.crypto.digests.SHAKEDigest, org.bouncycastle.math.raw.Bits, org.bouncycastle.util.Arrays, .Integers, .Pack

Field Summary

Modifier and TypeField and Description
protected final int
private final int
private final int
private final int
protected final Xof
protected final int
private static final Logger
protected static final int
protected static final int
private static final int
protected static final int
protected final LowmcConstants
private static final int
private static final int
protected final int
protected final int
protected final int
protected final int
protected final int
private final int
private static final int
protected final int
protected static final int
protected final int
private int
protected final int
protected final int
protected final int
private final int
private static final int
TRANSFORM_FS

< Largest signature size, in bytes

private static final int
private static final int
protected final int
protected final int
private static final int

Constructor Summary

AccessConstructor and Description
pack-priv
PicnicEngine(int picnicParams, LowmcConstants lowmcConstants)

Method Summary

Modifier and TypeMethod and Description
pack-priv static int
appendUnique(int[] list, int value, int position)

private boolean
arePaddingBitsZero(byte[] data, int bitLength)

private boolean
arePaddingBitsZero(int[] data, int bitLength)

private void
aux_mpc_AND(int mask_a, int mask_b, int fresh_output_mask, Tape tape)

protected void
aux_mpc_sbox(int[] in, int[] out, Tape tape)

pack-priv static int
bitsToChunks(int chunkLenBits, byte[] input, int inputLen, int[] chunks)

private void
Commit(byte[] seed, int seedOffset, View view, byte[] hash)

private void
commit(byte[] digest_arr, byte[] seed, byte[] aux, byte[] salt, int t, int j)

private void
commit_h(byte[] digest_arr, byte[][] C)

private void
commit_v(byte[] digest_arr, byte[] input, Msg msg)

private void
computeSaltAndRootSeed(byte[] saltAndRoot, int[] privateKey, int[] pubKey, int[] plaintext, byte[] message)

private byte[]
computeSeeds(int[] privateKey, int[] publicKey, int[] plaintext, byte[] message)

private boolean
contains(int[] list, int len, int value)

private int
countNonZeroChallenges(byte[] challengeBits, int challengeBitsOffset)

private boolean
createRandomTape(byte[] seed, int seedOffset, byte[] salt, int roundNumber, int playerNumber, byte[] tape, int tapeLen)

private void
createRandomTapes(Tape tape, byte[][] seeds, int seedsOffset, byte[] salt, int t)

public void
crypto_sign(byte[] sm, byte[] m, byte[] sk)

public void
crypto_sign_keypair(byte[] pk, byte[] sk, SecureRandom random)

public boolean
crypto_sign_open(byte[] m, byte[] sm, byte[] pk)

private int
deserializeSignature(Signature sig, byte[] sigBytes, int sigBytesLen, int sigBytesOffset)

private int
deserializeSignature2(Signature2 sig, byte[] sigBytes, int sigLen, int sigBytesOffset)

private void
expandChallengeHash(byte[] challengeHash, int[] challengeC, int[] challengeP)

pack-priv static int
extend(int bit)

private void
G(int viewNumber, byte[] seed, int seedOffset, View view, byte[] output)

private void
getAuxBits(byte[] output, Tape tape)

pack-priv int
getChallenge(byte[] challenge, int round)

private int[]
getMissingLeavesList(int[] challengeC)

public int
public int
public int
getSignatureSize(int messageLength)

public int
private void
H3(int[] circuitOutput, int[] plaintext, View[][] views, byte[][][] as, byte[] challengeBits, byte[] salt, byte[] message, byte[][][] gs)

private void
H3(int[] circuitOutput, int[] plaintext, int[][][] viewOutputs, byte[][][] as, byte[] challengeBits, byte[] salt, byte[] message, byte[][][] gs)

private void
HCP(byte[] challengeHash, int[] challengeC, int[] challengeP, byte[][] Ch, byte[] hCv, byte[] salt, int[] pubKey, int[] plaintext, byte[] message)

private void
implH3(int[] circuitOutput, int[] plaintext, byte[][][] as, byte[] challengeBits, byte[] salt, byte[] message, byte[][][] gs)

pack-priv static int
indexOf(int[] list, int len, int value)

pack-priv static boolean
is_picnic3(int params)

private void
LowMCEnc(int[] plaintext, int[] output, int[] key)

protected void
matrix_mul(int[] output, int[] state, int[] matrix, int matrixOffset)

protected void
matrix_mul_offset(int[] output, int outputOffset, int[] state, int stateOffset, int[] matrix, int matrixOffset)

private void
mpc_AND(int[] in1, int[] in2, int[] out, Tape rand, View[] views)

Functions implementing Sign

private int
mpc_AND(int a, int b, int mask_a, int mask_b, Tape tape, Msg msg)

pack-priv void
mpc_AND_verify(int[] in1, int[] in2, int[] out, Tape rand, View view1, View view2)

private void
mpc_LowMC(Tape tapes, View[] views, int[] plaintext, int[] slab)

pack-priv void
mpc_LowMC_verify(View view1, View view2, Tape tapes, int[] tmp, int[] plaintext, int challenge)

private void
mpc_matrix_mul(int[] output, int outputOffset, int[] state, int stateOffset, int[] matrix, int matrixOffset, int players)

private void
mpc_sbox(int[] state, int[] state_masks, Tape tape, Msg msg)

private void
mpc_substitution(int[] state, Tape rand, View[] views)

pack-priv void
mpc_substitution_verify(int[] state, Tape rand, View view1, View view2)

private void
mpc_xor(int[] state, int[] in, int players)

private void
mpc_xor_constant(int[] state, int stateOffset, int[] in, int inOffset, int len)

private void
mpc_xor_constant_verify(int[] state, int[] in, int inOffset, int length, int challenge)

private void
picnic_keygen(byte[] plaintext_bytes, byte[] ciphertext_bytes, byte[] data_bytes, SecureRandom random)

private void
picnic_read_public_key(int[] ciphertext, int[] plaintext, byte[] pk)

private boolean
picnic_sign(byte[] sk, byte[] message, byte[] signature)

private int
picnic_verify(byte[] pk, byte[] message, byte[] signature, int sigLen)

private int
picnic_write_private_key(byte[] data, byte[] ciphertext, byte[] plaintext, byte[] buf)

private int
picnic_write_public_key(byte[] ciphertext, byte[] plaintext, byte[] buf)

pack-priv void
prove(Signature.Proof proof, int challenge, byte[] seeds, int seedsOffset, View[] views, byte[][] commitments, byte[][] gs)

pack-priv int
serializeSignature(Signature sig, byte[] sigBytes, int sigOffset)

Serialization functions

private int
serializeSignature2(Signature2 sig, byte[] sigBytes, int sigOffset)

private void
setChallenge(byte[] challenge, int round, int trit)

private int
sign_picnic1(int[] privateKey, int[] pubKey, int[] plaintext, byte[] message, Signature sig)

private boolean
sign_picnic3(int[] privateKey, int[] pubKey, int[] plaintext, byte[] message, Signature2 sig)

private int
simulateOnline(int[] maskedKey, Tape tape, int[] tmp_shares, Msg msg, int[] plaintext, int[] pubKey)

private static boolean
subarrayEquals(byte[] a, byte[] b, int length)

private static boolean
subarrayEquals(int[] a, int[] b, int length)

private void
substitution(int[] state)

private void
tapesToWords(int[] shares, Tape tape)

private void
updateDigest(int[] block, byte[] temp)

private int
verify(Signature sig, int[] pubKey, int[] plaintext, byte[] message)

private int
verify_picnic3(Signature2 sig, int[] pubKey, int[] plaintext, byte[] message)

pack-priv boolean
verifyProof(Signature.Proof proof, View view1, View view2, int challenge, byte[] salt, int roundNumber, byte[] tmp, int[] plaintext, Tape tape)

private void
wordToMsgs(int w, Msg msg)

protected void
xor_array(int[] out, int[] in1, int[] in2, int in2_offset)

private void
xor_three(int[] output, int[] in1, int[] in2, int[] in3)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

andSizeBytesback to summary
protected final int andSizeBytes
CRYPTO_BYTESback to summary
private final int CRYPTO_BYTES
CRYPTO_PUBLICKEYBYTESback to summary
private final int CRYPTO_PUBLICKEYBYTES
CRYPTO_SECRETKEYBYTESback to summary
private final int CRYPTO_SECRETKEYBYTES
digestback to summary
protected final Xof digest
digestSizeBytesback to summary
protected final int digestSizeBytes
LOGback to summary
private static final Logger LOG
LOWMC_MAX_AND_GATESback to summary
protected static final int LOWMC_MAX_AND_GATES
LOWMC_MAX_KEY_BITSback to summary
protected static final int LOWMC_MAX_KEY_BITS
LOWMC_MAX_STATE_SIZEback to summary
private static final int LOWMC_MAX_STATE_SIZE
LOWMC_MAX_WORDSback to summary
protected static final int LOWMC_MAX_WORDS
lowmcConstantsback to summary
protected final LowmcConstants lowmcConstants
MAX_AUX_BYTESback to summary
private static final int MAX_AUX_BYTES
MAX_DIGEST_SIZEback to summary
private static final int MAX_DIGEST_SIZE
numMPCPartiesback to summary
protected final int numMPCParties
numMPCRoundsback to summary
protected final int numMPCRounds
numOpenedRoundsback to summary
protected final int numOpenedRounds
numRoundsback to summary
protected final int numRounds
numSboxesback to summary
protected final int numSboxes
parametersback to summary
private final int parameters
PICNIC_MAX_LOWMC_BLOCK_SIZEback to summary
private static final int PICNIC_MAX_LOWMC_BLOCK_SIZE
pqSecurityLevelback to summary
protected final int pqSecurityLevel
saltSizeBytesback to summary
protected static final int saltSizeBytes
seedSizeBytesback to summary
protected final int seedSizeBytes
signatureLengthback to summary
private int signatureLength
stateSizeBitsback to summary
protected final int stateSizeBits
stateSizeBytesback to summary
protected final int stateSizeBytes
stateSizeWordsback to summary
protected final int stateSizeWords
transformback to summary
private final int transform
TRANSFORM_FSback to summary
private static final int TRANSFORM_FS

< Largest signature size, in bytes

TRANSFORM_INVALIDback to summary
private static final int TRANSFORM_INVALID
TRANSFORM_URback to summary
private static final int TRANSFORM_UR
UnruhGWithInputBytesback to summary
protected final int UnruhGWithInputBytes
UnruhGWithoutInputBytesback to summary
protected final int UnruhGWithoutInputBytes
WORD_SIZE_BITSback to summary
private static final int WORD_SIZE_BITS

Constructor Detail

PicnicEngineback to summary
pack-priv PicnicEngine(int picnicParams, LowmcConstants lowmcConstants)

Method Detail

appendUniqueback to summary
pack-priv static int appendUnique(int[] list, int value, int position)
arePaddingBitsZeroback to summary
private boolean arePaddingBitsZero(byte[] data, int bitLength)
arePaddingBitsZeroback to summary
private boolean arePaddingBitsZero(int[] data, int bitLength)
aux_mpc_ANDback to summary
private void aux_mpc_AND(int mask_a, int mask_b, int fresh_output_mask, Tape tape)
aux_mpc_sboxback to summary
protected void aux_mpc_sbox(int[] in, int[] out, Tape tape)
bitsToChunksback to summary
pack-priv static int bitsToChunks(int chunkLenBits, byte[] input, int inputLen, int[] chunks)
Commitback to summary
private void Commit(byte[] seed, int seedOffset, View view, byte[] hash)
commitback to summary
private void commit(byte[] digest_arr, byte[] seed, byte[] aux, byte[] salt, int t, int j)
commit_hback to summary
private void commit_h(byte[] digest_arr, byte[][] C)
commit_vback to summary
private void commit_v(byte[] digest_arr, byte[] input, Msg msg)
computeSaltAndRootSeedback to summary
private void computeSaltAndRootSeed(byte[] saltAndRoot, int[] privateKey, int[] pubKey, int[] plaintext, byte[] message)
computeSeedsback to summary
private byte[] computeSeeds(int[] privateKey, int[] publicKey, int[] plaintext, byte[] message)
containsback to summary
private boolean contains(int[] list, int len, int value)
countNonZeroChallengesback to summary
private int countNonZeroChallenges(byte[] challengeBits, int challengeBitsOffset)
createRandomTapeback to summary
private boolean createRandomTape(byte[] seed, int seedOffset, byte[] salt, int roundNumber, int playerNumber, byte[] tape, int tapeLen)
createRandomTapesback to summary
private void createRandomTapes(Tape tape, byte[][] seeds, int seedsOffset, byte[] salt, int t)
crypto_signback to summary
public void crypto_sign(byte[] sm, byte[] m, byte[] sk)
crypto_sign_keypairback to summary
public void crypto_sign_keypair(byte[] pk, byte[] sk, SecureRandom random)
crypto_sign_openback to summary
public boolean crypto_sign_open(byte[] m, byte[] sm, byte[] pk)
deserializeSignatureback to summary
private int deserializeSignature(Signature sig, byte[] sigBytes, int sigBytesLen, int sigBytesOffset)
deserializeSignature2back to summary
private int deserializeSignature2(Signature2 sig, byte[] sigBytes, int sigLen, int sigBytesOffset)
expandChallengeHashback to summary
private void expandChallengeHash(byte[] challengeHash, int[] challengeC, int[] challengeP)
extendback to summary
pack-priv static int extend(int bit)
Gback to summary
private void G(int viewNumber, byte[] seed, int seedOffset, View view, byte[] output)
getAuxBitsback to summary
private void getAuxBits(byte[] output, Tape tape)
getChallengeback to summary
pack-priv int getChallenge(byte[] challenge, int round)
getMissingLeavesListback to summary
private int[] getMissingLeavesList(int[] challengeC)
getPublicKeySizeback to summary
public int getPublicKeySize()
getSecretKeySizeback to summary
public int getSecretKeySize()
getSignatureSizeback to summary
public int getSignatureSize(int messageLength)
getTrueSignatureSizeback to summary
public int getTrueSignatureSize()
H3back to summary
private void H3(int[] circuitOutput, int[] plaintext, View[][] views, byte[][][] as, byte[] challengeBits, byte[] salt, byte[] message, byte[][][] gs)
H3back to summary
private void H3(int[] circuitOutput, int[] plaintext, int[][][] viewOutputs, byte[][][] as, byte[] challengeBits, byte[] salt, byte[] message, byte[][][] gs)
HCPback to summary
private void HCP(byte[] challengeHash, int[] challengeC, int[] challengeP, byte[][] Ch, byte[] hCv, byte[] salt, int[] pubKey, int[] plaintext, byte[] message)
implH3back to summary
private void implH3(int[] circuitOutput, int[] plaintext, byte[][][] as, byte[] challengeBits, byte[] salt, byte[] message, byte[][][] gs)
indexOfback to summary
pack-priv static int indexOf(int[] list, int len, int value)
is_picnic3back to summary
pack-priv static boolean is_picnic3(int params)
LowMCEncback to summary
private void LowMCEnc(int[] plaintext, int[] output, int[] key)
matrix_mulback to summary
protected void matrix_mul(int[] output, int[] state, int[] matrix, int matrixOffset)
matrix_mul_offsetback to summary
protected void matrix_mul_offset(int[] output, int outputOffset, int[] state, int stateOffset, int[] matrix, int matrixOffset)
mpc_ANDback to summary
private void mpc_AND(int[] in1, int[] in2, int[] out, Tape rand, View[] views)

Functions implementing Sign

mpc_ANDback to summary
private int mpc_AND(int a, int b, int mask_a, int mask_b, Tape tape, Msg msg)
mpc_AND_verifyback to summary
pack-priv void mpc_AND_verify(int[] in1, int[] in2, int[] out, Tape rand, View view1, View view2)
mpc_LowMCback to summary
private void mpc_LowMC(Tape tapes, View[] views, int[] plaintext, int[] slab)
mpc_LowMC_verifyback to summary
pack-priv void mpc_LowMC_verify(View view1, View view2, Tape tapes, int[] tmp, int[] plaintext, int challenge)
mpc_matrix_mulback to summary
private void mpc_matrix_mul(int[] output, int outputOffset, int[] state, int stateOffset, int[] matrix, int matrixOffset, int players)
mpc_sboxback to summary
private void mpc_sbox(int[] state, int[] state_masks, Tape tape, Msg msg)
mpc_substitutionback to summary
private void mpc_substitution(int[] state, Tape rand, View[] views)
mpc_substitution_verifyback to summary
pack-priv void mpc_substitution_verify(int[] state, Tape rand, View view1, View view2)
mpc_xorback to summary
private void mpc_xor(int[] state, int[] in, int players)
mpc_xor_constantback to summary
private void mpc_xor_constant(int[] state, int stateOffset, int[] in, int inOffset, int len)
mpc_xor_constant_verifyback to summary
private void mpc_xor_constant_verify(int[] state, int[] in, int inOffset, int length, int challenge)
picnic_keygenback to summary
private void picnic_keygen(byte[] plaintext_bytes, byte[] ciphertext_bytes, byte[] data_bytes, SecureRandom random)
picnic_read_public_keyback to summary
private void picnic_read_public_key(int[] ciphertext, int[] plaintext, byte[] pk)
picnic_signback to summary
private boolean picnic_sign(byte[] sk, byte[] message, byte[] signature)
picnic_verifyback to summary
private int picnic_verify(byte[] pk, byte[] message, byte[] signature, int sigLen)
picnic_write_private_keyback to summary
private int picnic_write_private_key(byte[] data, byte[] ciphertext, byte[] plaintext, byte[] buf)
picnic_write_public_keyback to summary
private int picnic_write_public_key(byte[] ciphertext, byte[] plaintext, byte[] buf)
proveback to summary
pack-priv void prove(Signature.Proof proof, int challenge, byte[] seeds, int seedsOffset, View[] views, byte[][] commitments, byte[][] gs)
serializeSignatureback to summary
pack-priv int serializeSignature(Signature sig, byte[] sigBytes, int sigOffset)

Serialization functions

serializeSignature2back to summary
private int serializeSignature2(Signature2 sig, byte[] sigBytes, int sigOffset)
setChallengeback to summary
private void setChallenge(byte[] challenge, int round, int trit)
sign_picnic1back to summary
private int sign_picnic1(int[] privateKey, int[] pubKey, int[] plaintext, byte[] message, Signature sig)
sign_picnic3back to summary
private boolean sign_picnic3(int[] privateKey, int[] pubKey, int[] plaintext, byte[] message, Signature2 sig)
simulateOnlineback to summary
private int simulateOnline(int[] maskedKey, Tape tape, int[] tmp_shares, Msg msg, int[] plaintext, int[] pubKey)
subarrayEqualsback to summary
private static boolean subarrayEquals(byte[] a, byte[] b, int length)
subarrayEqualsback to summary
private static boolean subarrayEquals(int[] a, int[] b, int length)
substitutionback to summary
private void substitution(int[] state)
tapesToWordsback to summary
private void tapesToWords(int[] shares, Tape tape)
updateDigestback to summary
private void updateDigest(int[] block, byte[] temp)
verifyback to summary
private int verify(Signature sig, int[] pubKey, int[] plaintext, byte[] message)
verify_picnic3back to summary
private int verify_picnic3(Signature2 sig, int[] pubKey, int[] plaintext, byte[] message)
verifyProofback to summary
pack-priv boolean verifyProof(Signature.Proof proof, View view1, View view2, int challenge, byte[] salt, int roundNumber, byte[] tmp, int[] plaintext, Tape tape)
wordToMsgsback to summary
private void wordToMsgs(int w, Msg msg)
xor_arrayback to summary
protected void xor_array(int[] out, int[] in1, int[] in2, int in2_offset)
xor_threeback to summary
private void xor_three(int[] output, int[] in1, int[] in2, int[] in3)