|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||

java.lang.Objectde.unikassel.android.sdcframework.util.facade.Encryption
public final class Encryption
Utility class for encryption and checksums.
| Field Summary | |
|---|---|
static String |
PRIVATE_KEY_FILE
private key file name |
static String |
PUBLIC_KEY_FILE
public key file name |
private static String |
RSA_ALGORITHM
The RSA algorithm description |
private static String |
RSA_ENCRYPTION
The RSA transformation description for encryption |
private static int |
RSA_KEY_LENGTH
The RSA key length |
| Constructor Summary | |
|---|---|
Encryption()
|
|
| Method Summary | |
|---|---|
static KeyPair |
createRSAKeyPair()
Method to create an RSA key pair of RSA_KEY_LENGTH bit length and save the key bytes to files. |
static boolean |
decryptRSA(PrivateKey key,
File srcFile,
File destFile)
Method for RSA file decryption |
static boolean |
encryptRSA(PublicKey key,
File srcFile,
File destFile)
Method for RSA file encryption |
static String |
md5(String text)
Method to create an MD5 hash for a given string |
static PrivateKey |
readPrivateKeyFromFile(File file)
Method to read a private key from file |
static PublicKey |
readPublicKeyFromFile(File file)
Method to read a public key from file |
static PublicKey |
readPublicKeyFromStream(InputStream is)
Method to read a public key from an input stream |
private static byte[] |
readRSAKeyFromFile(File file)
Method to store a public or a private RSA key bytes |
static byte[] |
readRSAKeyFromStream(InputStream is)
Method to store a public or a private RSA key bytes |
static void |
saveRSAKeyToFile(String file,
byte[] bytes)
Method to store a public or a private RSA key bytes |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String PRIVATE_KEY_FILE
public static final String PUBLIC_KEY_FILE
private static final int RSA_KEY_LENGTH
private static final String RSA_ALGORITHM
private static final String RSA_ENCRYPTION
| Constructor Detail |
|---|
public Encryption()
| Method Detail |
|---|
public static final String md5(String text)
text - the string to create MD5 hash for
public static final boolean encryptRSA(PublicKey key,
File srcFile,
File destFile)
key - the public key to use for encryptionsrcFile - the source file to encryptdestFile - the file to store encrypted data in
public static final boolean decryptRSA(PrivateKey key,
File srcFile,
File destFile)
key - the private key to use for decryptionsrcFile - the source file to decryptdestFile - the file to store decrypted data in
public static final KeyPair createRSAKeyPair()
public static final void saveRSAKeyToFile(String file,
byte[] bytes)
throws IOException
file - the file to save the key intobytes - the key bytes
IOExceptionpublic static final PublicKey readPublicKeyFromFile(File file)
file - the file to read the public key from
public static final PublicKey readPublicKeyFromStream(InputStream is)
is - the input stream to read from
public static final PrivateKey readPrivateKeyFromFile(File file)
file - the file to read the private key from
private static final byte[] readRSAKeyFromFile(File file)
throws IOException
file - the file to read the public key from
IOException
public static final byte[] readRSAKeyFromStream(InputStream is)
throws IOException
is - the input stream to read the public key from
IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||