public class SM extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
SM.SMException |
static class |
SM.SMState |
| Modifier and Type | Field and Description |
|---|---|
static int |
EXPECT1 |
static int |
EXPECT2 |
static int |
EXPECT3 |
static int |
EXPECT4 |
static int |
EXPECT5 |
static byte[] |
GENERATOR_S |
static int |
MOD_LEN_BITS |
static int |
MOD_LEN_BYTES |
static BigInteger |
MODULUS_MINUS_2 |
static BigInteger |
MODULUS_S |
static int |
MSG1_LEN |
static int |
MSG2_LEN |
static int |
MSG3_LEN |
static int |
MSG4_LEN |
static BigInteger |
ORDER_S |
static int |
PROG_CHEATED |
static int |
PROG_FAILED |
static int |
PROG_OK |
static int |
PROG_SUCCEEDED |
| Constructor and Description |
|---|
SM() |
| Modifier and Type | Method and Description |
|---|---|
static int |
checkEqualCoords(BigInteger c,
BigInteger d1,
BigInteger d2,
BigInteger p,
BigInteger q,
SM.SMState state,
int version)
Verify a proof of knowledge of coordinates with first components being equal
|
static int |
checkEqualLogs(BigInteger c,
BigInteger d,
BigInteger r,
SM.SMState state,
int version)
Verify a proof of knowledge of logs with exponents being equal
|
static boolean |
checkExpon(BigInteger x)
Check that an BigInteger is in the right range to be a (non-zero)
exponent.
|
static boolean |
checkGroupElem(BigInteger g)
Check that an BigInteger is in the right range to be a (non-unit) group
element.
|
static int |
checkKnowLog(BigInteger c,
BigInteger d,
BigInteger g,
BigInteger x,
int version)
Verify a proof of knowledge of a discrete logarithm.
|
static BigInteger |
hash(int version,
BigInteger a,
BigInteger b)
Hash one or two BigIntegers.
|
static void |
main(String[] args) |
static BigInteger[] |
proofEqualCoords(SM.SMState state,
BigInteger r,
int version)
Proof of knowledge of coordinates with first components being equal
|
static BigInteger[] |
proofEqualLogs(SM.SMState state,
int version)
Proof of knowledge of logs with exponents being equal
|
static BigInteger[] |
proofKnowLog(BigInteger g,
BigInteger x,
int version)
Proof of knowledge of a discrete logarithm.
|
static BigInteger |
randomExponent()
Generate a random exponent
|
static byte[] |
serialize(BigInteger[] ints) |
static byte[] |
step1(SM.SMState astate,
byte[] secret)
Create first message in SMP exchange.
|
static void |
step2a(SM.SMState bstate,
byte[] input,
int received_question)
Receive the first message in SMP exchange, which was generated by
step1.
|
static byte[] |
step2b(SM.SMState bstate,
byte[] secret)
Create second message in SMP exchange.
|
static byte[] |
step3(SM.SMState astate,
byte[] input)
Create third message in SMP exchange.
|
static byte[] |
step4(SM.SMState bstate,
byte[] input)
Create final message in SMP exchange.
|
static void |
step5(SM.SMState astate,
byte[] input)
Receives the final SMP message, which was generated in otrl_sm_step.
|
static BigInteger[] |
unserialize(byte[] bytes) |
public static final int EXPECT1
public static final int EXPECT2
public static final int EXPECT3
public static final int EXPECT4
public static final int EXPECT5
public static final int PROG_OK
public static final int PROG_CHEATED
public static final int PROG_FAILED
public static final int PROG_SUCCEEDED
public static final int MSG1_LEN
public static final int MSG2_LEN
public static final int MSG3_LEN
public static final int MSG4_LEN
public static final BigInteger MODULUS_S
public static final BigInteger MODULUS_MINUS_2
public static final BigInteger ORDER_S
public static final byte[] GENERATOR_S
public static final int MOD_LEN_BITS
public static final int MOD_LEN_BYTES
public static BigInteger randomExponent()
public static BigInteger hash(int version, BigInteger a, BigInteger b) throws SM.SMException
version - the prefix to usea - The 1st BigInteger to hash.b - The 2nd BigInteger to hash.SM.SMException - when the SHA-256 algorithm
is missing or when the biginteger can't be serialized.public static byte[] serialize(BigInteger[] ints) throws SM.SMException
SM.SMExceptionpublic static BigInteger[] unserialize(byte[] bytes) throws SM.SMException
SM.SMExceptionpublic static boolean checkGroupElem(BigInteger g)
g - the BigInteger to check.public static boolean checkExpon(BigInteger x)
x - The BigInteger to check.public static BigInteger[] proofKnowLog(BigInteger g, BigInteger x, int version) throws SM.SMException
g - the group generatorx - the secret informationversion - the prefix to use for the hashing functionSM.SMException - when c and d could not be calculatedpublic static int checkKnowLog(BigInteger c, BigInteger d, BigInteger g, BigInteger x, int version) throws SM.SMException
c - c from remote partyd - d from remote partyg - the group generatorx - our secret informationversion - the prefix to usec.SM.SMException - when something goes wrongpublic static BigInteger[] proofEqualCoords(SM.SMState state, BigInteger r, int version) throws SM.SMException
state - MVN_PASS_JAVADOC_INSPECTIONr - MVN_PASS_JAVADOC_INSPECTIONversion - MVN_PASS_JAVADOC_INSPECTIONSM.SMException - MVN_PASS_JAVADOC_INSPECTIONpublic static int checkEqualCoords(BigInteger c, BigInteger d1, BigInteger d2, BigInteger p, BigInteger q, SM.SMState state, int version) throws SM.SMException
c - MVN_PASS_JAVADOC_INSPECTIONd1 - MVN_PASS_JAVADOC_INSPECTIONd2 - MVN_PASS_JAVADOC_INSPECTIONp - MVN_PASS_JAVADOC_INSPECTIONq - MVN_PASS_JAVADOC_INSPECTIONstate - MVN_PASS_JAVADOC_INSPECTIONversion - MVN_PASS_JAVADOC_INSPECTIONSM.SMException - MVN_PASS_JAVADOC_INSPECTIONpublic static BigInteger[] proofEqualLogs(SM.SMState state, int version) throws SM.SMException
state - MVN_PASS_JAVADOC_INSPECTIONversion - MVN_PASS_JAVADOC_INSPECTIONSM.SMException - MVN_PASS_JAVADOC_INSPECTIONpublic static int checkEqualLogs(BigInteger c, BigInteger d, BigInteger r, SM.SMState state, int version) throws SM.SMException
c - MVN_PASS_JAVADOC_INSPECTIONd - MVN_PASS_JAVADOC_INSPECTIONr - MVN_PASS_JAVADOC_INSPECTIONstate - MVN_PASS_JAVADOC_INSPECTIONversion - MVN_PASS_JAVADOC_INSPECTIONSM.SMException - MVN_PASS_JAVADOC_INSPECTIONpublic static byte[] step1(SM.SMState astate, byte[] secret) throws SM.SMException
astate - MVN_PASS_JAVADOC_INSPECTIONsecret - MVN_PASS_JAVADOC_INSPECTIONSM.SMException - MVN_PASS_JAVADOC_INSPECTIONpublic static void step2a(SM.SMState bstate, byte[] input, int received_question) throws SM.SMException
bstate - MVN_PASS_JAVADOC_INSPECTIONinput - MVN_PASS_JAVADOC_INSPECTIONreceived_question - MVN_PASS_JAVADOC_INSPECTIONSM.SMException - MVN_PASS_JAVADOC_INSPECTIONpublic static byte[] step2b(SM.SMState bstate, byte[] secret) throws SM.SMException
bstate - MVN_PASS_JAVADOC_INSPECTIONsecret - MVN_PASS_JAVADOC_INSPECTIONSM.SMException - MVN_PASS_JAVADOC_INSPECTIONpublic static byte[] step3(SM.SMState astate, byte[] input) throws SM.SMException
astate - MVN_PASS_JAVADOC_INSPECTIONinput - MVN_PASS_JAVADOC_INSPECTIONSM.SMException - MVN_PASS_JAVADOC_INSPECTIONpublic static byte[] step4(SM.SMState bstate, byte[] input) throws SM.SMException
bstate - MVN_PASS_JAVADOC_INSPECTIONinput - MVN_PASS_JAVADOC_INSPECTIONSM.SMException - MVN_PASS_JAVADOC_INSPECTIONpublic static void step5(SM.SMState astate, byte[] input) throws SM.SMException
astate - MVN_PASS_JAVADOC_INSPECTIONinput - MVN_PASS_JAVADOC_INSPECTIONSM.SMException - MVN_PASS_JAVADOC_INSPECTIONpublic static void main(String[] args) throws SM.SMException
SM.SMExceptionCopyright © 2015. All rights reserved.