Project CASUAL
API for CASUAL
 All Classes Namespaces Functions Variables
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
CASUAL.crypto.AES128Handler Class Reference

Public Member Functions

 AES128Handler (File targetFile)
 
boolean encrypt (String output, char[] key)
 
String decrypt (String output, char[] key) throws Exception
 
Cipher getCipher (byte[] key, byte[] iv, int mode) throws NoSuchPaddingException, NoSuchAlgorithmException, InvalidKeyException, InvalidAlgorithmParameterException
 
 AES128Handler (File targetFile)
 
boolean encrypt (String output, char[] key)
 
String decrypt (String output, char[] key) throws Exception
 
Cipher getCipher (byte[] key, byte[] iv, int mode) throws NoSuchPaddingException, NoSuchAlgorithmException, InvalidKeyException, InvalidAlgorithmParameterException
 

Static Public Member Functions

static int getCASPACHeaderLength (File f) throws FileNotFoundException, IOException
 
static int getCASPACHeaderLength (File f) throws FileNotFoundException, IOException
 

Static Public Attributes

static final String header = casualID + revision.length() + revision
 

Detailed Description

provides a way to encrypt and decrypt given a password

Author
Adam Outler adamo.nosp@m.utle.nosp@m.r@gma.nosp@m.il.c.nosp@m.om http://stackoverflow.com/questions/8674018/pbkdf2-with-bouncycastle-in-java inspired by https://www.cigital.com/justice-league-blog/2009/08/14/proper-use-of-javas-securerandom/ inspired by http://stackoverflow.com/questions/1220751/how-to-choose-an-aes-encryption-mode-cbc-ecb-ctr-ocb-cfb severely beaten several times by Pulser

Constructor & Destructor Documentation

CASUAL.crypto.AES128Handler.AES128Handler ( File  targetFile)

loads a file for use in AES128Handler.

Parameters
targetFileFile to be encrypted
CASUAL.crypto.AES128Handler.AES128Handler ( File  targetFile)

loads a file for use in AES128Handler.

Parameters
targetFileFile to be encrypted

Member Function Documentation

String CASUAL.crypto.AES128Handler.decrypt ( String  output,
char[]  key 
) throws Exception

decrypts a file

Parameters
outputstring name of file to output
keypassword issued by encrytper
Returns
name of file written, null if error
Exceptions
java.io.FileNotFoundExceptionif file isn't able to be found
java.lang.Exceptionif crypto error
String CASUAL.crypto.AES128Handler.decrypt ( String  output,
char[]  key 
) throws Exception

decrypts a file

Parameters
outputstring name of file to output
keypassword issued by encrytper
Returns
name of file written, null if error
Exceptions
java.io.FileNotFoundExceptionif file isn't able to be found
java.lang.Exceptionif crypto error
boolean CASUAL.crypto.AES128Handler.encrypt ( String  output,
char[]  key 
)

encrypts a file to the output file. Appends CASPAC Header

Parameters
outputstring location of file output
keypassword
Returns
true if encryption was sucessful
boolean CASUAL.crypto.AES128Handler.encrypt ( String  output,
char[]  key 
)

encrypts a file to the output file. Appends CASPAC Header

Parameters
outputstring location of file output
keypassword
Returns
true if encryption was sucessful
static int CASUAL.crypto.AES128Handler.getCASPACHeaderLength ( File  f) throws FileNotFoundException, IOException
static

will return the length of the CASPAC Header

Parameters
ffile to check
Returns
0 if failed, will be between >18 if valid.
Exceptions
FileNotFoundExceptionif file is not present or deleted
IOExceptionif permission problem.
static int CASUAL.crypto.AES128Handler.getCASPACHeaderLength ( File  f) throws FileNotFoundException, IOException
static

will return the length of the CASPAC Header

Parameters
ffile to check
Returns
0 if failed, will be between >18 if valid.
Exceptions
FileNotFoundExceptionif file is not present or deleted
IOExceptionif permission problem.
Cipher CASUAL.crypto.AES128Handler.getCipher ( byte[]  key,
byte[]  iv,
int  mode 
) throws NoSuchPaddingException, NoSuchAlgorithmException, InvalidKeyException, InvalidAlgorithmParameterException

gets a cypher for encryption

Parameters
keysecret key
ivinitialization vector which is pulled from or appended to the file
modeencryption or decryption key
Returns
cypher to be used for encryption or decryption.
Exceptions
NoSuchPaddingExceptionIf Java implementation is incomplete
NoSuchAlgorithmExceptionIf Java implementation is incomplete
InvalidKeyExceptionIf Java implementation is incomplete
InvalidAlgorithmParameterExceptionIf Java implementation is incomplete
Cipher CASUAL.crypto.AES128Handler.getCipher ( byte[]  key,
byte[]  iv,
int  mode 
) throws NoSuchPaddingException, NoSuchAlgorithmException, InvalidKeyException, InvalidAlgorithmParameterException

gets a cypher for encryption

Parameters
keysecret key
ivinitialization vector which is pulled from or appended to the file
modeencryption or decryption key
Returns
cypher to be used for encryption or decryption.
Exceptions
NoSuchPaddingExceptionIf Java implementation is incomplete
NoSuchAlgorithmExceptionIf Java implementation is incomplete
InvalidKeyExceptionIf Java implementation is incomplete
InvalidAlgorithmParameterExceptionIf Java implementation is incomplete

Member Data Documentation

static final String CASUAL.crypto.AES128Handler.header = casualID + revision.length() + revision
static

Header for the CASPAC


The documentation for this class was generated from the following file: