public class Client
extends java.lang.Object
| Constructor and Description |
|---|
Client() |
| Modifier and Type | Method and Description |
|---|---|
static void |
clickClose(java.lang.String un)
Remove user from server.
|
static boolean |
createChal(java.math.BigInteger b,
java.lang.String info,
java.lang.String message)
Creates challenge.
|
static void |
createUser(java.lang.String un)
Creates new user and register on server.
|
static byte[] |
digToKey(byte[] dig)
Transfers key from length of hash to length of cipher.
|
static java.lang.String |
getCip()
Gets type of cipher function and check correctness.
|
static java.lang.String |
getHash()
Gets type of hash function and check correctness.
|
static javax.crypto.SecretKey |
getKey(Challenge chal)
Gets cipher key.
|
static javax.crypto.SecretKey |
getKeyFromNum(java.security.MessageDigest dig,
java.lang.String ciph,
java.math.BigInteger num)
Hashs input number to secret key.
|
static java.lang.String |
getMess(byte[] cm,
java.math.BigInteger f,
java.lang.String Shash,
java.lang.String Scip)
Gets message from crypted message.
|
static java.util.LinkedList<User> |
getUsers()
Gets list of usernames.
|
static boolean |
checkCon()
Checks connetion to server.
|
static Challenge |
checkChall()
Check challenges - gets list of challenges and checks which is destined for user.
|
static java.math.BigInteger |
checkSign(java.lang.String dk,
java.lang.String Shash)
Checks signature of key.
|
static boolean |
checkUN(java.lang.String un)
Checks identical usernames.
|
static void |
referenceToServer()
Gets reference from the Name Service.
|
static byte[] |
verif(Challenge chal,
java.math.BigInteger f)
Verification of user - computes Kmacc key and creates response which sends to server for verification.
|
public static void referenceToServer()
public static boolean checkCon()
throws java.rmi.RemoteException
java.rmi.RemoteExceptionpublic static boolean checkUN(java.lang.String un)
throws java.rmi.RemoteException
un - username to checkjava.rmi.RemoteExceptionpublic static void createUser(java.lang.String un)
throws java.rmi.RemoteException,
java.security.NoSuchAlgorithmException
un - usernamejava.rmi.RemoteExceptionjava.security.NoSuchAlgorithmExceptionpublic static java.lang.String getHash()
public static java.lang.String getCip()
public static java.util.LinkedList<User> getUsers() throws java.rmi.RemoteException
java.rmi.RemoteExceptionpublic static boolean createChal(java.math.BigInteger b,
java.lang.String info,
java.lang.String message)
throws java.security.NoSuchAlgorithmException,
javax.crypto.NoSuchPaddingException,
java.rmi.RemoteException,
java.security.InvalidKeyException,
javax.crypto.IllegalBlockSizeException,
javax.crypto.BadPaddingException,
java.security.NoSuchProviderException
b - receiver's public keyinfo - string infomessage - string messagejava.security.NoSuchAlgorithmExceptionjavax.crypto.NoSuchPaddingExceptionjava.rmi.RemoteExceptionjava.security.InvalidKeyExceptionjavax.crypto.IllegalBlockSizeExceptionjavax.crypto.BadPaddingExceptionjava.security.NoSuchProviderExceptionpublic static Challenge checkChall() throws java.rmi.RemoteException, java.security.NoSuchAlgorithmException, java.security.NoSuchProviderException
java.rmi.RemoteExceptionjava.security.NoSuchAlgorithmExceptionjava.security.NoSuchProviderExceptionpublic static javax.crypto.SecretKey getKey(Challenge chal) throws java.security.NoSuchAlgorithmException, javax.crypto.NoSuchPaddingException, java.security.InvalidKeyException, javax.crypto.IllegalBlockSizeException, javax.crypto.BadPaddingException, java.rmi.RemoteException, java.security.NoSuchProviderException
chal - challengejava.security.NoSuchAlgorithmExceptionjavax.crypto.NoSuchPaddingExceptionjava.security.InvalidKeyExceptionjavax.crypto.IllegalBlockSizeExceptionjavax.crypto.BadPaddingExceptionjava.rmi.RemoteExceptionjava.security.NoSuchProviderExceptionpublic static java.math.BigInteger checkSign(java.lang.String dk,
java.lang.String Shash)
throws java.security.NoSuchAlgorithmException,
java.rmi.RemoteException
dk - decrypted keyShash - type of sender's hashs functionjava.security.NoSuchAlgorithmExceptionjava.rmi.RemoteExceptionpublic static byte[] verif(Challenge chal, java.math.BigInteger f) throws java.rmi.RemoteException, java.security.NoSuchAlgorithmException, javax.crypto.NoSuchPaddingException, java.security.InvalidKeyException, javax.crypto.IllegalBlockSizeException, javax.crypto.BadPaddingException, java.security.NoSuchProviderException
chal - challengef - verification keyjava.rmi.RemoteExceptionjava.security.NoSuchAlgorithmExceptionjavax.crypto.NoSuchPaddingExceptionjava.security.InvalidKeyExceptionjavax.crypto.IllegalBlockSizeExceptionjavax.crypto.BadPaddingExceptionjava.security.NoSuchProviderExceptionpublic static java.lang.String getMess(byte[] cm,
java.math.BigInteger f,
java.lang.String Shash,
java.lang.String Scip)
throws java.security.InvalidKeyException,
java.security.NoSuchAlgorithmException,
javax.crypto.NoSuchPaddingException,
javax.crypto.IllegalBlockSizeException,
javax.crypto.BadPaddingException
cm - crypted messagef - verification keyShash - type of sender's hashs functionScip - type of sender's cipher functionjava.security.InvalidKeyExceptionjava.security.NoSuchAlgorithmExceptionjavax.crypto.NoSuchPaddingExceptionjavax.crypto.IllegalBlockSizeExceptionjavax.crypto.BadPaddingExceptionpublic static void clickClose(java.lang.String un)
throws java.rmi.RemoteException
un - usernamejava.rmi.RemoteExceptionpublic static javax.crypto.SecretKey getKeyFromNum(java.security.MessageDigest dig,
java.lang.String ciph,
java.math.BigInteger num)
dig - message digestciph - typ of cipher functionnum - input numberpublic static byte[] digToKey(byte[] dig)