public interface Encryptable
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
HASH_ALGORITHM
The following was taken from Shea Polansky with VERY few modifications.
|
static char[] |
hexArray |
static int |
NONCE_SIZE |
static java.lang.String[] |
nonceAlphabet
I would like to use a asymmetric encryption
client generates a pair of public/private keys and sends the public key to the server
more info here https://docs.oracle.com/javase/tutorial/security/apisign/step2.html
server uses the public key to encrypt some secret key and sends it back to the client (secrete is generated in this class as well as encry.
|
static java.util.Random |
r |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
bytesToHex(byte[] bytes)
Converts a byte array to a hexadecimal string.
|
<T> T |
decrypt(java.lang.String msg,
java.lang.String key) |
void |
encrypt(java.lang.String msg,
java.lang.String key) |
static java.lang.String |
generateHashedPassword(java.lang.String salt,
java.lang.String password)
Generates a hashed password based on a given salt and password.
|
static java.lang.String |
generateKey() |
static java.lang.String |
xorDecrypt(java.lang.String message,
java.lang.String key) |
static java.lang.String |
xorEncrypt(java.lang.String message,
java.lang.String key) |
static final java.lang.String[] nonceAlphabet
static final int NONCE_SIZE
static final java.util.Random r
static final java.lang.String HASH_ALGORITHM
static final char[] hexArray
void encrypt(java.lang.String msg,
java.lang.String key)
<T> T decrypt(java.lang.String msg,
java.lang.String key)
static java.lang.String xorEncrypt(java.lang.String message,
java.lang.String key)
static java.lang.String xorDecrypt(java.lang.String message,
java.lang.String key)
static java.lang.String generateKey()
static java.lang.String bytesToHex(byte[] bytes)
bytes - the byte array to convertstatic java.lang.String generateHashedPassword(java.lang.String salt,
java.lang.String password)
salt - the salt to usepassword - the password to use