Package org.refcodes.forwardsecrecy
Class EncryptionProviderImpl
- java.lang.Object
-
- org.refcodes.forwardsecrecy.EncryptionProviderImpl
-
- All Implemented Interfaces:
EncryptionProvider
,org.refcodes.security.Encrypter<java.lang.String,java.lang.String,org.refcodes.security.EncryptionException>
public class EncryptionProviderImpl extends java.lang.Object implements EncryptionProvider
This class is a basic implementation of theEncryptionProvider
interface.
-
-
Constructor Summary
Constructors Constructor Description EncryptionProviderImpl(EncryptionService aEncryptionService)
Constructs theEncryptionProvider
using AES as implemented by theBouncyCastleProvider
.EncryptionProviderImpl(EncryptionService aEncryptionService, java.security.Provider aJceProvider, java.lang.String aJceAlgorithm)
Constructs theEncryptionProvider
with the givenEncryptionService
and with the specified JCEProvider
as well as the according JCE algorithm.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
nextCipherVersion()
Forces a next valid cipher to be requested and used.int
toEncrypted(byte[] aInput, int aInputOffset, int aInputLength, byte[] aOutput, int aOutputOffset)
java.lang.String
toEncrypted(java.lang.String aInput)
-
-
-
Constructor Detail
-
EncryptionProviderImpl
public EncryptionProviderImpl(EncryptionService aEncryptionService, java.security.Provider aJceProvider, java.lang.String aJceAlgorithm)
Constructs theEncryptionProvider
with the givenEncryptionService
and with the specified JCEProvider
as well as the according JCE algorithm.- Parameters:
aEncryptionService
- TheEncryptionService
to be used by the provider.aJceProvider
- The JCEProvider
to be used.aJceAlgorithm
- the JCE algorithm to be used by the JCEProvider
.
-
EncryptionProviderImpl
public EncryptionProviderImpl(EncryptionService aEncryptionService)
Constructs theEncryptionProvider
using AES as implemented by theBouncyCastleProvider
.- Parameters:
aEncryptionService
- The service to be used by the provider.
-
-
Method Detail
-
toEncrypted
public java.lang.String toEncrypted(java.lang.String aInput) throws org.refcodes.security.EncryptionException
- Specified by:
toEncrypted
in interfaceorg.refcodes.security.Encrypter<java.lang.String,java.lang.String,org.refcodes.security.EncryptionException>
- Specified by:
toEncrypted
in interfaceEncryptionProvider
- Throws:
org.refcodes.security.EncryptionException
-
toEncrypted
public int toEncrypted(byte[] aInput, int aInputOffset, int aInputLength, byte[] aOutput, int aOutputOffset) throws javax.crypto.ShortBufferException, org.refcodes.security.EncryptionException
- Specified by:
toEncrypted
in interfaceorg.refcodes.security.Encrypter<java.lang.String,java.lang.String,org.refcodes.security.EncryptionException>
- Throws:
javax.crypto.ShortBufferException
org.refcodes.security.EncryptionException
-
nextCipherVersion
public void nextCipherVersion()
Forces a next valid cipher to be requested and used.- Specified by:
nextCipherVersion
in interfaceEncryptionProvider
-
-