Class OxalisCipher
- java.lang.Object
-
- network.oxalis.statistics.security.OxalisCipher
-
public class OxalisCipher extends Object
Oxalis' cipher implementation. Encapsulates information required for encryption and decryption of data using a symmetric key.- Author:
- steinar Date: 06.05.13 Time: 21:22
-
-
Field Summary
Fields Modifier and Type Field Description static StringSYMMETRIC_KEY_ALGORITHMstatic StringWRAPPED_SYMMETRIC_KEY_HEADER_NAMEName of our encrypted (wrapped) symmetric key.
-
Constructor Summary
Constructors Constructor Description OxalisCipher()OxalisCipher(SecretKey secretKey)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description InputStreamdecryptStream(InputStream inputStream)Wraps the supplied InputStream in a decrypted cipher stream, i.e.OutputStreamencryptStream(OutputStream outputStream)Wraps the supplied OutputStream in a encrypted cipher stream, i.e.SecretKeygetSecretKey()
-
-
-
Field Detail
-
SYMMETRIC_KEY_ALGORITHM
public static final String SYMMETRIC_KEY_ALGORITHM
- See Also:
- Constant Field Values
-
WRAPPED_SYMMETRIC_KEY_HEADER_NAME
public static final String WRAPPED_SYMMETRIC_KEY_HEADER_NAME
Name of our encrypted (wrapped) symmetric key. Typically used in HTTP headers, name and value pairs, etc.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
OxalisCipher
public OxalisCipher()
-
OxalisCipher
public OxalisCipher(SecretKey secretKey)
-
-
Method Detail
-
encryptStream
public OutputStream encryptStream(OutputStream outputStream)
Wraps the supplied OutputStream in a encrypted cipher stream, i.e. every plain text byte written into the new OutputStream is encrypted using our SecretKey.- Parameters:
outputStream- the plaint text output stream to encrypted- Returns:
- a new OutputStream which will encrypt every byte written to it.
- See Also:
decryptStream(java.io.InputStream)
-
decryptStream
public InputStream decryptStream(InputStream inputStream)
Wraps the supplied InputStream in a decrypted cipher stream, i.e. every encrypted byte read from the new InputStream reads is decrypted using our SecretKey.- Parameters:
inputStream- the encrypted input stream- Returns:
- new InputStream which will decrypt every byte read from it.
-
getSecretKey
public SecretKey getSecretKey()
-
-