-
import javax.crypto.SecretKey;
-
-
import org.apache.commons.codec.binary.Base64;
-
-
import metcarob.com.common.security.EncryptReturn;
-
import metcarob.com.common.security.SecurityUtilities;
-
import metcarob.com.common.security.saltPot;
-
-
-
public class Main {
-
-
/**
-
* @param args
-
*/
-
try {
-
byte[] salt = {
-
(byte)0x42, (byte)0xBB, (byte)0xF7, (byte)0xC8, (byte)0x06, (byte)0xF9, (byte)0x42, (byte)0xD8,
-
(byte)0x43, (byte)0xBB, (byte)0xF7, (byte)0xC8, (byte)0x06, (byte)0xF9, (byte)0x42, (byte)0xD8,
-
(byte)0x44, (byte)0xBB, (byte)0xF7, (byte)0xC8, (byte)0x06, (byte)0xF9, (byte)0x42, (byte)0xD8,
-
(byte)0x45, (byte)0xBB, (byte)0xF7, (byte)0xC8, (byte)0x06, (byte)0xF9, (byte)0x42, (byte)0xD8,
-
(byte)0x46, (byte)0xBB, (byte)0xF7, (byte)0xC8, (byte)0x06, (byte)0xF9, (byte)0x42, (byte)0xD8,
-
(byte)0x47, (byte)0xBB, (byte)0xF7, (byte)0xC8, (byte)0x06, (byte)0xF9, (byte)0x42, (byte)0xD8,
-
(byte)0x48, (byte)0xBB, (byte)0xF7, (byte)0xC8, (byte)0x06, (byte)0xF9, (byte)0x42, (byte)0xD8,
-
(byte)0x49, (byte)0xBB, (byte)0xF7, (byte)0xC8, (byte)0x06, (byte)0xF9, (byte)0x42, (byte)0xD8,
-
(byte)0x41, (byte)0xBB, (byte)0xF7, (byte)0xC8, (byte)0x06, (byte)0xF9, (byte)0x42, (byte)0xD8,
-
(byte)0x41, (byte)0xBB, (byte)0xF7, (byte)0xC8, (byte)0x06, (byte)0xF9, (byte)0x42, (byte)0xD8,
-
(byte)0x41, (byte)0xBB, (byte)0xF7, (byte)0xC8, (byte)0x06, (byte)0xF9, (byte)0x42, (byte)0xD8,
-
(byte)0x41, (byte)0xBB, (byte)0xF7, (byte)0xC8, (byte)0x06, (byte)0xF9, (byte)0x42, (byte)0xD8,
-
(byte)0x41, (byte)0xBB, (byte)0xF7, (byte)0xC8, (byte)0x06, (byte)0xF9, (byte)0x42, (byte)0xD8,
-
(byte)0x41, (byte)0xBB, (byte)0xF7, (byte)0xC8, (byte)0x06, (byte)0xF9, (byte)0x42, (byte)0xD8,
-
(byte)0x41, (byte)0xBB, (byte)0xF7, (byte)0xC8, (byte)0x06, (byte)0xF9, (byte)0x42, (byte)0xD8,
-
(byte)0x41, (byte)0xBB, (byte)0xF7, (byte)0xC8, (byte)0x06, (byte)0xF9, (byte)0x42, (byte)0xD8,
-
(byte)0x41, (byte)0xBB, (byte)0xF7, (byte)0xC8, (byte)0x06, (byte)0xF9, (byte)0x42, (byte)0xD8,
-
(byte)0x41, (byte)0xBB, (byte)0xF7, (byte)0xC8, (byte)0x06, (byte)0xF9, (byte)0x42, (byte)0xD8,
-
(byte)0x41, (byte)0xBB, (byte)0xF7, (byte)0xC8, (byte)0x06, (byte)0xF9, (byte)0x42, (byte)0xD8,
-
(byte)0x21, (byte)0x13, (byte)0x74, (byte)0x34, (byte)0x94, (byte)0x7B, (byte)0x70, (byte)0x99
-
};
-
//IV:Qbv3yAb5QthBu/fIBvlC2A==
-
//IV:Qbv3yAb5QthBu/fIBvlC2A==
-
//IV:Rrv3yAb5QthHu/fIBvlC2A==
-
-
-
saltPot m_salt = new saltPot(salt);
-
m_salt.allocateSalt(32); //Salt for pass gen
-
m_salt.allocateSalt(16); //IC for const IC Encrypt
-
-
-
String cipherText;
-
-
{
-
SecretKey key = SecurityUtilities.generateKeyFromPassword(m_PrivateReqPass.toCharArray(), m_salt.getSalt(1));
-
EncryptReturn er = SecurityUtilities.encryptNoIVSecretKey(key, m_PrivateReqMsg.getBytes(), m_salt.getSalt(2));
-
}
-
-
-
{
-
SecretKey key = SecurityUtilities.generateKeyFromPassword(m_PrivateReqPass.toCharArray(), m_salt.getSalt(1));
-
byte[] cypBYT = Base64.decodeBase64(cipherText);
-
}
-
-
e.printStackTrace();
-
}
-
}
-
-
}
This creates a saltpot and allocates the first 32 bytes. Here i have indicated where I use it in code
TODO
RJM Article Type
Work Notes