|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.threerings.presents.util.SecureUtil
public class SecureUtil
Security utilities for performing secure authentication.
| Field Summary | |
|---|---|
protected static SecureRandom |
_rand
|
protected static byte[] |
IV
Our initialization vector. |
protected static IvParameterSpec |
IVPS
|
protected static char |
SPLIT
Our split character. |
static int |
VERSION
The version of our security protocol (for backwards compatability with older clients). |
| Constructor Summary | |
|---|---|
SecureUtil()
|
|
| Method Summary | |
|---|---|
static boolean |
ciphersSupported(PrivateKey key)
Returns true if we can generate our ciphers. |
static boolean |
ciphersSupported(PublicKey key)
Returns true if we can generate our ciphers. |
static byte[] |
createRandomKey(int length)
Creates a random key. |
static byte[] |
decryptBytes(PrivateKey key,
byte[] encrypted,
byte[] salt)
Decrypts a secret key and checks for tailing salt. |
static byte[] |
encryptBytes(PublicKey key,
byte[] secret,
byte[] salt)
Encrypts a secret key and salt with a public key. |
static KeyPair |
genRSAKeyPair(int bits)
Creates an RSA key pair. |
static Cipher |
getAESCipher(int mode,
byte[] key)
Creates our AES cipher. |
static Cipher |
getRSACipher(int mode,
Key key)
Creates our RSA cipher. |
static Cipher |
getRSACipher(PrivateKey key)
Creates our RSA cipher. |
static Cipher |
getRSACipher(PublicKey key)
Creates our RSA cipher. |
static String |
RSAKeyToString(PrivateKey key)
Converts an key to a string suitable for a properties file. |
static String |
RSAKeyToString(PublicKey key)
Converts an key to a string suitable for a properties file. |
static PrivateKey |
stringToRSAPrivateKey(String str)
Creates a private key from the supplied string. |
static PublicKey |
stringToRSAPublicKey(String str)
Creates a public key from the supplied string. |
static byte[] |
xorBytes(byte[] data,
byte[] key)
XORs a byte array against a key. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int VERSION
protected static final SecureRandom _rand
protected static final char SPLIT
protected static final byte[] IV
protected static final IvParameterSpec IVPS
| Constructor Detail |
|---|
public SecureUtil()
| Method Detail |
|---|
public static Cipher getAESCipher(int mode,
byte[] key)
public static Cipher getRSACipher(PrivateKey key)
public static Cipher getRSACipher(PublicKey key)
public static Cipher getRSACipher(int mode,
Key key)
public static KeyPair genRSAKeyPair(int bits)
public static String RSAKeyToString(PublicKey key)
public static String RSAKeyToString(PrivateKey key)
public static PublicKey stringToRSAPublicKey(String str)
public static PrivateKey stringToRSAPrivateKey(String str)
public static boolean ciphersSupported(PrivateKey key)
public static boolean ciphersSupported(PublicKey key)
public static byte[] createRandomKey(int length)
public static byte[] encryptBytes(PublicKey key,
byte[] secret,
byte[] salt)
public static byte[] decryptBytes(PrivateKey key,
byte[] encrypted,
byte[] salt)
public static byte[] xorBytes(byte[] data,
byte[] key)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||