|
Rice Pastry API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectrice.p2p.util.SecurityUtils
public class SecurityUtils
This class contains a large number of static methods for performing security-related primitives, such as encrypt, decrypt, etc...
| Field Summary | |
|---|---|
static java.lang.String |
APOP_ALGORITHM
The name of the apop function. |
static java.lang.String |
ASYMMETRIC_ALGORITHM
The name of the asymmetric cipher to use. |
static java.lang.String |
ASYMMETRIC_GENERATOR
The name of the asymmetric generator to use. |
static java.lang.String |
DEPRECATED_ASYMMETRIC_ALGORITHM
|
static java.lang.String |
HASH_ALGORITHM
The name of the hash function. |
static java.lang.String |
HMAC_ALGORITHM
The name of the hmac function. |
static byte[] |
HMAC_IPAD
The ipad byte array for use in hmac |
static byte |
HMAC_IPAD_BYTE
The ipad of hmac keys, as defined in RFC 2195 |
static int |
HMAC_KEY_LENGTH
The length of hmac keys |
static byte[] |
HMAC_OPAD
The opad byte array for use in hmac |
static byte |
HMAC_OPAD_BYTE
The opad of hmac keys, as defined in RFC 2195 |
static java.lang.String |
SIGNATURE_ALGORITHM
The name of the signature algorithm to use. |
static java.lang.String |
SYMMETRIC_ALGORITHM
The name of the symmetric cipher to use. |
static java.lang.String |
SYMMETRIC_GENERATOR
The name of the symmetric cipher to use. |
static int |
SYMMETRIC_KEY_LENGTH
The length of the symmetric keys |
| Method Summary | |
|---|---|
static byte[] |
apop(byte[] challenge,
byte[] password)
Utility method for determining the apop of a challenge and password using a secure hashing algorithm. |
static byte[] |
decryptAsymmetric(byte[] data,
java.security.PrivateKey key)
Decrypts the given byte[] using the provided private key. |
static byte[] |
decryptSymmetric(byte[] data,
byte[] key)
Utility method for decrypting some data with symmetric encryption. |
static java.lang.Object |
deserialize(byte[] data)
Utility method for deserializing an object from a byte[] |
static byte[] |
encryptAsymmetric(byte[] data,
java.security.PublicKey key)
Encrypts the given byte[] using the provided public key. |
static byte[] |
encryptSymmetric(byte[] data,
byte[] key)
Utility method for encrypting a block of data with symmetric encryption. |
static byte[] |
encryptSymmetric(byte[] data,
byte[] key,
int offset,
int length)
Utility method for encrypting a block of data with symmetric encryption. |
static java.security.KeyPair |
generateKeyAsymmetric()
Utility method which will generate a non-weak DES key for applications to use. |
static byte[] |
generateKeySymmetric()
Utility method which will generate a non-weak DES key for applications to use. |
static byte[] |
hash(byte[] input)
Utility method for determining the hash of a byte[] using a secure hashing algorithm. |
static byte[] |
hmac(byte[] key,
byte[] text)
Utility method for determining the hmac of a byte[] and key using a secure hashing algorithm. |
static byte[] |
serialize(java.lang.Object o)
Utility method for serializing an object to a byte[]. |
static byte[] |
sign(byte[] data,
java.security.PrivateKey key)
Utility method for signing a block of data with the a private key |
static boolean |
verify(byte[] data,
byte[] sig,
java.security.PublicKey key)
Utility method for verifying a signature |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String ASYMMETRIC_ALGORITHM
public static final java.lang.String DEPRECATED_ASYMMETRIC_ALGORITHM
public static final java.lang.String SYMMETRIC_ALGORITHM
public static final java.lang.String ASYMMETRIC_GENERATOR
public static final java.lang.String SYMMETRIC_GENERATOR
public static final java.lang.String SIGNATURE_ALGORITHM
public static final int SYMMETRIC_KEY_LENGTH
public static final java.lang.String HASH_ALGORITHM
public static final java.lang.String HMAC_ALGORITHM
public static final java.lang.String APOP_ALGORITHM
public static final int HMAC_KEY_LENGTH
public static final byte HMAC_IPAD_BYTE
public static final byte HMAC_OPAD_BYTE
public static final byte[] HMAC_IPAD
public static final byte[] HMAC_OPAD
| Method Detail |
|---|
public static byte[] serialize(java.lang.Object o)
throws java.io.IOException
o - The object to serialize
java.io.IOException - If serialization does not happen properly
public static java.lang.Object deserialize(byte[] data)
throws java.io.IOException,
java.lang.ClassNotFoundException
data - The data to deserialize
java.io.IOException - If deserialization does not happen properly
java.lang.ClassNotFoundException - If the deserialized class is not found
public static byte[] hash(byte[] input)
throws java.lang.SecurityException
input - The input
java.lang.SecurityException - If the hashing does not happen properly
public static byte[] apop(byte[] challenge,
byte[] password)
throws java.lang.SecurityException
password - The passwordchallenge - The challengr
java.lang.SecurityException - If the hashing does not happen properly
public static byte[] hmac(byte[] key,
byte[] text)
throws java.lang.SecurityException
text - The textkey - The key
java.lang.SecurityException - If the hmacing does not happen properly
public static byte[] encryptSymmetric(byte[] data,
byte[] key)
throws java.lang.SecurityException
data - The datakey - The key
java.lang.SecurityException - If the encryption does not happen properly
public static byte[] encryptSymmetric(byte[] data,
byte[] key,
int offset,
int length)
throws java.lang.SecurityException
data - The datakey - The keyoffset - The offset into the datalength - The length of data to write
java.lang.SecurityException - If the encryption does not happen properly
public static byte[] decryptSymmetric(byte[] data,
byte[] key)
throws java.lang.SecurityException
data - The data to decryptkey - The key
java.lang.SecurityException - If the decryption does not happen properly
public static byte[] sign(byte[] data,
java.security.PrivateKey key)
throws java.lang.SecurityException
data - The datakey - The key to use to sign
java.lang.SecurityException - If the signing does not happen properly
public static boolean verify(byte[] data,
byte[] sig,
java.security.PublicKey key)
throws java.lang.SecurityException
data - The data to verifysig - The proposed signaturekey - The key to verify against
java.lang.SecurityException - If the verification does not happen properly
public static byte[] encryptAsymmetric(byte[] data,
java.security.PublicKey key)
throws java.lang.SecurityException
data - The data to encryptkey - The key to encrypt with
java.lang.SecurityException - If the encryption does not happen properly
public static byte[] decryptAsymmetric(byte[] data,
java.security.PrivateKey key)
throws java.lang.SecurityException
data - The data to decryptkey - The private key to use
java.lang.SecurityException - If the decryption does not happen properlypublic static byte[] generateKeySymmetric()
public static java.security.KeyPair generateKeyAsymmetric()
|
Rice Pastry API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||