|
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.jppf.security.CryptoUtils
public class CryptoUtils
Utility methods to handle encryption and decryption, digital signing, and key exchange protocols.
| Constructor Summary | |
|---|---|
CryptoUtils()
|
|
| Method Summary | |
|---|---|
static byte[] |
decrypt(byte[] data)
Encrypt some data. |
static byte[] |
decrypt(SecretKey key,
byte[] data)
Encrypt some data. |
static byte[] |
encrypt(byte[] data)
Encrypt some data. |
static byte[] |
encrypt(SecretKey key,
byte[] data)
Encrypt some data using athe specified key. |
static KeyPair |
generateDHKeyPair()
Generate a Diffie Hellman private/public pair of keys. |
static KeyPair |
generateKeyPair()
Generate a private/public pair of keys. |
static SecretKey |
generateSecretKey()
Generate a secret key. |
static byte[] |
generateSignature(byte[] data)
Digitally sign some data. |
static SecretKey |
getSecretKey()
Get the secret key used for encryption and decryption. |
static SecretKey |
getSecretKeyFromEncoded(byte[] encoded)
Get a secret key from its encoded representation. |
static void |
main(String... args)
Entry pont to test this class. |
static byte[] |
readKeyFile(String filename)
Read a public or private key from a file. |
static boolean |
verifySignature(byte[] signature,
byte[] data)
Check a digital signature for some data. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CryptoUtils()
| Method Detail |
|---|
public static void main(String... args)
args - no used.
public static KeyPair generateKeyPair()
throws Exception
KeyPair instance.
Exception - if an exception is raised while generating the pair of keys.
public static KeyPair generateDHKeyPair()
throws Exception
KeyPair instance.
Exception - if an exception is raised while generating the pair of keys.
public static SecretKey generateSecretKey()
throws Exception
SecretKey instance.
Exception - if th ekey could not be generated.
public static byte[] readKeyFile(String filename)
throws IOException
filename - the name of the file to read the key from.
IOException - if an exception is raised while readsing the file.
public static byte[] generateSignature(byte[] data)
throws Exception
data - the data to sign.
Exception - if an exception is raised while generating the signature.
public static boolean verifySignature(byte[] signature,
byte[] data)
throws Exception
signature - data signature.data - the signed data.
Exception - if an exception is raised while generating the signature.
public static SecretKey getSecretKey()
throws Exception
SecretKey instance.
Exception - if the secret key could not be obtained.
public static SecretKey getSecretKeyFromEncoded(byte[] encoded)
throws Exception
encoded - the secret key in encoded format.
SecretKey instance.
Exception - if the secret key could not be obtained.
public static byte[] encrypt(byte[] data)
throws Exception
data - the data as an array of bytes.
Exception - if the data encryption failed.
public static byte[] encrypt(SecretKey key,
byte[] data)
throws Exception
key - the key to use for encryption.data - the data as an array of bytes.
Exception - if the data encryption failed.
public static byte[] decrypt(byte[] data)
throws Exception
data - the data as an array of bytes.
Exception - if the data encryption failed.
public static byte[] decrypt(SecretKey key,
byte[] data)
throws Exception
key - the key to use for decryption.data - the data as an array of bytes.
Exception - if the data encryption failed.
|
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||