Create a random private DHKey with an n
-
createKeys(int)
- Create a pair of public/private keys in a group with an
n
bit modulo.
-
equals(Object)
- Return true if the two keys are eqivalent.
-
getAlgorithm()
- Return the name of the algorithm used by this key.
-
getG()
- Return the generator for this key.
-
getGenerator(BigInteger)
- Returns the smallest number
g
> 1 with
gcd(g
,m
)=1.
-
getKey()
- Return the BigInteger representing this key.
-
getM()
- Return the modulus for this key.
-
getModulus(int)
- Return the largest prime
p
< 2^n
such that (p
-1)/2 is prime.
-
getPublic()
- Return the BigInteger representing the public key from the pair.
-
getSize()
- Return the "size" of the key.
-
isPrivate()
- Returns true iff this is a private key.
-
matches(Key)
- Returns true if this and key are a matched pair
of public/private keys or the same symmetric key.
-
toString()
- Return a CDS for this key.
DHKey
public DHKey(BigInteger a,
BigInteger g,
BigInteger m,
boolean pri)
- Create new Diffie-Hellman key for
a
in the group
modulo m
with generator g
. It is a
private key iff pri is true
.
DHKey
public DHKey(int n)
- Create a random private DHKey with an
n
Pe-calcualted modula exist for bit lengths 256, 512 and 1024. (The 2048 bit
modulus is still being calculated. Using these values saves a
lot of time and does not weaken the keys.
getModulus
public static BigInteger getModulus(int n)
- Return the largest prime
p
< 2^n
such that (p
-1)/2 is prime.
getGenerator
public static BigInteger getGenerator(BigInteger m)
- Returns the smallest number
g
> 1 with
gcd(g
,m
)=1.
createKeys
public static KeyPair createKeys(int n)
- Create a pair of public/private keys in a group with an
n
bit modulo.
Pe-calcualted modula exist for bit lengths 256, 512, 1024 and
2048. Using these values saves a lot of time and does not weaken
the keys.
getSize
public int getSize()
- Return the "size" of the key. This is a measure of how
difficult it is to break and is heavily dependant on
the algorithm used. In many cases it will be the
actual number of bits needed to store the key.
- Overrides:
- getSize in class K
getAlgorithm
public String getAlgorithm()
- Return the name of the algorithm used by this key.
- Overrides:
- getAlgorithm in class K
isPrivate
public boolean isPrivate()
- Returns true iff this is a private key. The default behaviour is to
always return true. Classes for asymmetric keys should override
this.
- Overrides:
- isPrivate in class K
getPublic
public DHKey getPublic()
- Return the BigInteger representing the public key from the pair.
getKey
public BigInteger getKey()
- Return the BigInteger representing this key.
getM
public BigInteger getM()
- Return the modulus for this key.
getG
public BigInteger getG()
- Return the generator for this key.
equals
public final boolean equals(Object o)
- Return true if the two keys are eqivalent.
- Overrides:
- equals in class Object
matches
public boolean matches(Key key)
- Returns true if this and key are a matched pair
of public/private keys or the same symmetric key.
The default behaviour is to return the same value
as equals(key).
- Overrides:
- matches in class K
toString
public String toString()
- Return a CDS for this key.
- Overrides:
- toString in class Object
All Packages Class Hierarchy This Package Previous Next Index