Interface CipherProvider
- All Known Implementing Classes:
JCECipherProvider
public interface CipherProvider
A CipherProvider is a wrapper for a Cipher class in JCE.
This service is only available when run on JDK1.2 or beyond.
To use this service, either the SunJCE or an alternative clean room
implementation of the JCE must be installed.
To use a CipherProvider to encrypt or decrypt, it needs 3 things:
1) A CipherProvider that is initialized to ENCRYPT or DECRYPT
2) A secret Key for the encryption/decryption
3) An Initialization Vector (IvParameterSpec) that is used to create some
randomness in the encryption
See $WS/docs/funcspec/mulan/configurableEncryption.html
See http://java.sun.com/products/JDK/1.1/docs/guide/security/CryptoSpec.html
See http://java.sun.com/products/JDK/1.2/docs/guide/security/CryptoSpec.html
See http://java.sun.com/products/jdk/1.2/jce/index.html
-
Method Summary
Modifier and TypeMethodDescriptionint
decrypt
(byte[] ciphertext, int offset, int length, byte[] cleartext, int outputOffset) Decrypt data - use only with Cipher that has been initialized with CipherFactory.DECRYPT.int
encrypt
(byte[] cleartext, int offset, int length, byte[] ciphertext, int outputOffset) Encrypt data - use only with Cipher that has been initialized with CipherFactory.ENCRYPT.int
Returns the encryption block size used during creation of the encrypted database
-
Method Details
-
encrypt
int encrypt(byte[] cleartext, int offset, int length, byte[] ciphertext, int outputOffset) throws StandardException Encrypt data - use only with Cipher that has been initialized with CipherFactory.ENCRYPT.- Parameters:
cleartext
- the byte array containing the cleartextoffset
- encrypt from this byte offset in the cleartextlength
- encrypt this many bytes starting from offsetciphertext
- the byte array to store the ciphertextoutputOffset
- the offset into the ciphertext array the output should go If cleartext and ciphertext are the same array, caller must be careful to not overwrite the cleartext before it is scrambled.- Returns:
- The number of bytes stored in ciphertext.
- Throws:
StandardException
- Standard Derby Error Policy
-
decrypt
int decrypt(byte[] ciphertext, int offset, int length, byte[] cleartext, int outputOffset) throws StandardException Decrypt data - use only with Cipher that has been initialized with CipherFactory.DECRYPT.- Parameters:
ciphertext
- the byte array containing the ciphertextoffset
- decrypt from this byte offset in the ciphertextlength
- decrypt this many bytes starting from offsetcleartext
- the byte array to store the cleartextoutputOffset
- the offset into the cleartext array the output should go If cleartext and ciphertext are the same array, caller must be careful to not overwrite the ciphertext before it is un-scrambled.- Returns:
- The number of bytes stored in cleartext.
- Throws:
StandardException
- Standard Derby Error Policy
-
getEncryptionBlockSize
int getEncryptionBlockSize()Returns the encryption block size used during creation of the encrypted database
-