Package org.refcodes.security
Interface Decrypter<DEC,ENC,EXC extends DecryptionException>
-
- Type Parameters:
DEC- the generic typeENC- the generic typeEXC- the generic type
public interface Decrypter<DEC,ENC,EXC extends DecryptionException>Plain interface for providing straight forward decryption functionality as oftoDecrypted(Object)and for forcing your plain functionality to provide a bridge to the Java Cryptographic Extension (JCE) framework'sCipherSpias oftoDecrypted(byte[], int, int, byte[], int). This way you can use your algorithms outside the JCE framework. This may be necessary when your Java's security settings prevent running your own JCE extensions from inside an (Oracle-) unsigned JAR.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description inttoDecrypted(byte[] aInput, int aInputOffset, int aInputLength, byte[] aOutput, int aOutputOffset)For compatibility with the java.security framework, especially to be integrated in a sub-class of theCipherSpi.DECtoDecrypted(ENC aInput)You pass in data of a given type and you get decrypted data of (another) given type.
-
-
-
Method Detail
-
toDecrypted
DEC toDecrypted(ENC aInput) throws EXC extends DecryptionException
You pass in data of a given type and you get decrypted data of (another) given type.- Parameters:
aInput- The input data to be decrypted.- Returns:
- The decrypted output data.
- Throws:
EXC- Thrown in case something went wrong upon decryption.EXC extends DecryptionException
-
toDecrypted
int toDecrypted(byte[] aInput, int aInputOffset, int aInputLength, byte[] aOutput, int aOutputOffset) throws javax.crypto.ShortBufferException, DecryptionExceptionFor compatibility with the java.security framework, especially to be integrated in a sub-class of theCipherSpi.- Parameters:
aInput- The input to be decrypted.aInputOffset- The offset to start decryption.aInputLength- The length to be decryptedaOutput- The output where to decrypt to.aOutputOffset- The offset where to start writing the decrypted output.- Returns:
- The number of bytes decrypted.
- Throws:
javax.crypto.ShortBufferException- In case you provided lengths and offsets not fitting with the provided arrays.DecryptionException- Thrown in case a decryption issue occurred regarding theDecrypter. Probably the configuration of yourEncrypterdoes not fit the one of theDecrypter.
-
-