|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--HFE.HFE2_n
This class is the "final version" of HFE which works on
n=67,129,257 bits over the field GF(2) (Field2
) which
extents to GF(2^n) (Field2_n
).
Field Summary | |
private static int[] |
codeVec
Cipher as a vector. |
(package private) static int |
extensionDegree
Holds the degree of the irreducible polynomial and thereby also the degree of the extension field |
(package private) static int[] |
generatingPolynomial
Central switch to change generating polynomial. |
(package private) static Poly2Max |
generatingPolynomialAsMaxPoly
Polynomial set in variable generatingPolynomial
but as a Poly2Max polynomial. |
(package private) static int |
hashLen
Holds the number of bits for the hash value |
(package private) Poly2MultiSquare[] |
hashPoly
Quadratic polynomials for computing hash of message m |
(package private) int[] |
hashValue
hash value of the current message |
(package private) static int |
messageLength
Holds the number of bits for an encrypted message, i.e. |
(package private) static int |
messageSigLength
Holds the number of bits for a message in terms of a signature. |
(package private) int |
modeDecSig
Signals if we are in decryption (1) or signature generation mode (-1). |
(package private) static int |
padBits
Holds the number of bits for a message in terms of a signature. |
(package private) static int |
paramK
Holds the number of public equations which are replaced by random equations. |
private Poly2_nMax |
privatePoly
Stores the private polynomial over GF(2^n). |
private Poly2MultiSquare[] |
publicPoly
Stores the public key in an array of polynomials. |
(package private) static int |
reductionTerm
Central switch to change the reduction term, i.e. |
private static int[] |
resVec
Message as a vector. |
(package private) java.util.Random |
rnd
Random number generator for signature generation |
private RootFinding |
rootFinder
Root finding algorithm |
private static int[] |
rootVec
Message as a vector. |
(package private) static int |
signatureLength
Holds the number of bits for a signature. |
private static int[] |
sigTmpVec
Hash of message as a vector. |
private static int[] |
textVec
Message as a vector. |
(package private) Field2_n |
tmpElem
Temporary register [element of GF(2^n)]. |
private Transform2 |
transS
Transformation S in HFE |
private Transform2 |
transT
Transformation T in HFE |
private static int[] |
valueVec
Message in a special format as a vector. |
Constructor Summary | |
(package private) |
HFE2_n(byte[] seed)
Initializes HFE2_n by generating the public and the private key from the given seed. |
Method Summary | |
boolean |
checkRoot(Field2_n root)
Returns always true in signature mode (see variable modeDecSig ). |
void |
decrypt(int[] cipher,
int[] res)
Decrypts a given, n bit cipher text. |
void |
encrypt(int[] plain,
int[] res)
Encryptes a given, n bit plain text. |
private void |
encryptPrivate(int[] plain,
int[] res)
Encryptes a given, n bit plain text. |
(package private) void |
generateKeys(byte[] seed)
Generates the public and the private key from a given seed and stores them in the object's fields. |
private static Poly2_nMax |
genPolyPrivate(java.security.SecureRandom rndGen)
Generates a private key for HFE. |
private Poly2MultiSquare[] |
genPolyPublic(java.security.SecureRandom rndGen)
Generats the public polynomials from the private polynomial |
void |
genSign(int[] message,
int[] res)
Generates signature for given message using (S,P,T). |
static void |
main(java.lang.String[] args)
Tests everything in this class |
private void |
setHashPoly()
Sets the hash polynomials using a constant seed. |
static void |
speedIt()
|
static void |
testIt()
Tests the functionality of the whole class. |
boolean |
valSign(int[] message,
int[] sig)
Validates if given signature sig is valid or not. |
Methods inherited from class java.lang.Object |
|
Field Detail |
static final int[] generatingPolynomial
generatingPolynomialAsMaxPoly
static final int reductionTerm
static final int extensionDegree
static final Poly2Max generatingPolynomialAsMaxPoly
generatingPolynomial
but as a Poly2Max polynomial.
Does not need to be changed for different Field2_n
.static final int hashLen
static final int paramK
static final int messageLength
hashLen
+ extensionDegree
.static final int padBits
static final int messageSigLength
static final int signatureLength
int modeDecSig
checkRoot(HFE.Field2_n)
to signal the correct result
to class RootFinding
.private Poly2_nMax privatePoly
private Poly2MultiSquare[] publicPoly
private Transform2 transS
private Transform2 transT
private RootFinding rootFinder
private static int[] textVec
private static int[] sigTmpVec
genSign(int[], int[])
private static int[] resVec
private static int[] rootVec
checkRoot(HFE.Field2_n)
and used in decrypt(int[], int[])
as well as genSign(int[], int[])
.private static int[] valueVec
private static int[] codeVec
Poly2MultiSquare[] hashPoly
int[] hashValue
Field2_n tmpElem
java.util.Random rnd
Constructor Detail |
HFE2_n(byte[] seed)
seed
- Seed for the cryptographic random number generator.Method Detail |
private static Poly2_nMax genPolyPrivate(java.security.SecureRandom rndGen)
rndGen
- Secure random number generatorprivate Poly2MultiSquare[] genPolyPublic(java.security.SecureRandom rndGen)
rndGen
- Secure random number generatorvoid generateKeys(byte[] seed)
seed
- Seed for the random number generator. Must be "quite long" to be secure.private void setHashPoly()
private void encryptPrivate(int[] plain, int[] res)
plain
- plaintext as vector of n bitsres
- result as a vector of n+16 bitspublic void encrypt(int[] plain, int[] res)
plaintext
- as vector of n bitsres
- result as a vector of n+16 bitspublic void decrypt(int[] cipher, int[] res)
ciphertext
- as bit-vectorres
- result as a bit-vectorpublic void genSign(int[] message, int[] res)
message
- to sign (in general: hash of this message with messageSigLength
bits)res
- signature for this message with signatureLength
bitspublic boolean valSign(int[] message, int[] sig)
sig
is valid or not.message
- which was signed (in general: hash of this message with messageSigLength
bits) using method genSign(int[], int[])
sig
- signature for this message with signatureLength
bitspublic boolean checkRoot(Field2_n root)
modeDecSig
).
In decryption mode checks if the root has the correct hash value after
transformation S is applied. If so, returns true.checkRoot
in interface CheckRoot
public static void testIt()
public static final void speedIt()
public static void main(java.lang.String[] args)
testIt()
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |