|
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.vodafone360.people.engine.login.RSAEncryptionUtils
public class RSAEncryptionUtils
Utility class for encrypting/decrypting login and registration user credentials.
| Field Summary | |
|---|---|
private static byte[] |
DEFAULT_PUBKEY_EXPONENTIAL
Exponential part of the public key. |
private static byte[] |
DEFAULT_PUBKEY_MODULO
Default public key which can be used to encrypt data. |
private static int |
ROUND_UP_VALUE
Ensures data length is always a multiple of 16 (by rounding up if necessary). |
| Constructor Summary | |
|---|---|
RSAEncryptionUtils()
|
|
| Method Summary | |
|---|---|
static void |
copyDefaultPublicKey(PublicKeyDetails key)
Copies the default key into the given parameter. |
protected static byte[] |
encryptRSA(RSAKeyParameters pubKey,
java.lang.String data)
Encrypts bytes with the given RSA Public Key. |
protected static RSAKeyParameters |
getDefaultPublicKey()
Fetches the default public key. |
protected static RSAKeyParameters |
getRSAPubKey(byte[] mod,
byte[] exp)
Composes a RSA Public Key from its components. |
private static int |
roundUp(int v,
int t)
Return the value of v rounded up to a multiple of t |
private static byte[] |
rsa(boolean encrypt,
RSAKeyParameters key,
byte[] data)
Encrypts or Decrypts bytes with the given RSA Public or Private Key. |
private static byte[] |
trimZeros(byte[] data)
Removes all the zeros from the end of the given array. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final byte[] DEFAULT_PUBKEY_MODULO
private static final byte[] DEFAULT_PUBKEY_EXPONENTIAL
private static final int ROUND_UP_VALUE
| Constructor Detail |
|---|
public RSAEncryptionUtils()
| Method Detail |
|---|
protected static RSAKeyParameters getDefaultPublicKey()
public static void copyDefaultPublicKey(PublicKeyDetails key)
key - Where the key should be copied.
protected static RSAKeyParameters getRSAPubKey(byte[] mod,
byte[] exp)
mod - the RSA modulo.exp - the RSA exponent.
protected static byte[] encryptRSA(RSAKeyParameters pubKey,
java.lang.String data)
throws InvalidCipherTextException
pubKey - the RSA Public Key.data - the data to encrypt.
java.security.InvalidParameterException
InvalidCipherTextException
private static byte[] rsa(boolean encrypt,
RSAKeyParameters key,
byte[] data)
throws InvalidCipherTextException
encrypt - true for encrypt, false for decrypt.key - the RSA Public or Private Key.data - the data to encrypt or decrypt.
InvalidCipherTextException
private static int roundUp(int v,
int t)
v - The value to round upt - The multiple to use
private static byte[] trimZeros(byte[] data)
data - Initial array to trim
|
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
JavaDoc