|
Holger's Java API |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.antelmann.util.CipherKey
public class CipherKey
CipherKey provides a very easy-to-use, yet effective encryption mechanism. The relevant data is transient, so serialization is useless on this instance.
| Field Summary | |
|---|---|
static String |
defaultAlgorithm
|
static int |
defaultIterationCount
|
| Constructor Summary | |
|---|---|
CipherKey(char[] password)
uses PBE with MD5 and DES |
|
CipherKey(char[] password,
String algorithm,
byte[] salt,
int iterationCount)
uses PBE with MD5 and DES |
|
CipherKey(Cipher cipher,
Key key)
|
|
CipherKey(Cipher cipher,
Key key,
AlgorithmParameterSpec paramSpec)
|
|
CipherKey(Cipher cipher,
Key key,
AlgorithmParameterSpec paramSpec,
byte[] salt,
int iterationCount)
|
|
CipherKey(String pwd)
|
|
| Method Summary | |
|---|---|
byte[] |
decode(byte[] encrypted)
|
void |
decode(InputStream in,
OutputStream out)
decodes the given InputStream into the given OutputStream |
String |
decode(String s)
convenience method; requires a base64 string; encoding based on UTF8 |
byte[] |
encode(byte[] plainSource)
|
void |
encode(InputStream in,
OutputStream out)
encodes the given InputStream into the given OutputStream |
String |
encode(String s)
convenience method; returns a base64 string derived from UTF8 encoded bytes |
String |
get(String s)
convenience method; calls and returns the result of decode(String),
but doesn't throw an exception; instead it returns the given string in case of
a failure |
String |
getAlgorithm()
returns the algorithm of the embedded Cipher object |
Cipher |
getDecoder()
fully initializes the Cipher for decoding and returns it. |
static byte[] |
getDefaultSalt()
|
Cipher |
getEncoder()
fully initializes the Cipher for encoding and returns it. |
String |
getKeySignature()
just returns the algorithm, which doesn't say much |
void |
setPassword(char[] password)
only supported with PBEWithMD5AndDES algorithm |
void |
setPassword(char[] password,
byte[] salt,
int iterationCount)
only supported with PBEWithMD5AndDES algorithm |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int defaultIterationCount
public static final String defaultAlgorithm
| Constructor Detail |
|---|
public CipherKey(String pwd)
throws GeneralSecurityException
GeneralSecurityException
public CipherKey(char[] password)
throws GeneralSecurityException
GeneralSecurityException
public CipherKey(char[] password,
String algorithm,
byte[] salt,
int iterationCount)
throws GeneralSecurityException
GeneralSecurityException
public CipherKey(Cipher cipher,
Key key)
public CipherKey(Cipher cipher,
Key key,
AlgorithmParameterSpec paramSpec)
public CipherKey(Cipher cipher,
Key key,
AlgorithmParameterSpec paramSpec,
byte[] salt,
int iterationCount)
| Method Detail |
|---|
public void setPassword(char[] password)
throws GeneralSecurityException
GeneralSecurityException
public void setPassword(char[] password,
byte[] salt,
int iterationCount)
throws GeneralSecurityException
GeneralSecurityExceptionpublic Cipher getEncoder()
public Cipher getDecoder()
public void encode(InputStream in,
OutputStream out)
throws IOException
SynchronousKey
encode in interface SynchronousKeyIOException
public void decode(InputStream in,
OutputStream out)
throws IOException
SynchronousKey
decode in interface SynchronousKeyIOException
public byte[] decode(byte[] encrypted)
throws GeneralSecurityException
GeneralSecurityException
public byte[] encode(byte[] plainSource)
throws GeneralSecurityException
GeneralSecurityException
public String encode(String s)
throws GeneralSecurityException
GeneralSecurityException
public String decode(String s)
throws GeneralSecurityException
GeneralSecurityExceptionpublic String get(String s)
decode(String),
but doesn't throw an exception; instead it returns the given string in case of
a failure
public String getAlgorithm()
public String getKeySignature()
getKeySignature in interface SynchronousKeypublic static byte[] getDefaultSalt()
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||