|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcommon.Cipher
public class Cipher
Provides encryption and decryption operations.
The used encryption scheme is
\f$y=E(x)=b\cdot{}(r\cdot{}q+x)\bmod{p}\f$
The decryption is done by
\f$x=D(y)=b^{-1}\cdot{}y\bmod{p}\bmod{q}\f$
If an encrypted value is known to contain b
of a degree k
greater than 1,
the decryption is instead done by
\f$x=D(y,k)=b^{-k}\cdot{}y\bmod{p}\bmod{q}\f$
Before using, the Cipher object needs to be initialized with either a parameters file (see initialize(String)
)
or a stream (see initialize(InputStream)
) containing the parameters.
Constructor Summary | |
---|---|
Cipher()
|
Method Summary | |
---|---|
static java.math.BigInteger |
decrypt(java.math.BigInteger c)
Decrypts an encrypted value to the original integer value. |
static java.math.BigInteger |
decrypt(java.math.BigInteger c,
int degree)
Decrypts an encrypted value of a specified degree of b to the original integer value. |
static java.math.BigInteger |
encrypt(java.math.BigInteger x)
Encrypts an integer x to E(x) . |
static void |
initialize(java.io.InputStream is)
Initializes the cipher with parameters in a stream. |
static void |
initialize(java.lang.String paramfile)
Initializes the cipher with parameters in a given file. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Cipher()
Method Detail |
---|
public static void initialize(java.lang.String paramfile)
paramfile
- parameters filename.public static void initialize(java.io.InputStream is)
is
- stream containing the parameters.public static java.math.BigInteger encrypt(java.math.BigInteger x)
x
to E(x)
.
x
- integer to be encrypted.
public static java.math.BigInteger decrypt(java.math.BigInteger c)
c
- encrypted value.
public static java.math.BigInteger decrypt(java.math.BigInteger c, int degree)
b
to the original integer value.
c
- encrypted value.degree
- known degree of b
in the encrypted value.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |