Class 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 the EncryptionProvider interface.
    • Constructor Detail

      • EncryptionProviderImpl

        public EncryptionProviderImpl​(EncryptionService aEncryptionService,
                                      java.security.Provider aJceProvider,
                                      java.lang.String aJceAlgorithm)
        Constructs the EncryptionProvider with the given EncryptionService and with the specified JCE Provider as well as the according JCE algorithm.
        Parameters:
        aEncryptionService - The EncryptionService to be used by the provider.
        aJceProvider - The JCE Provider to be used.
        aJceAlgorithm - the JCE algorithm to be used by the JCE Provider.
      • EncryptionProviderImpl

        public EncryptionProviderImpl​(EncryptionService aEncryptionService)
        Constructs the EncryptionProvider using AES as implemented by the BouncyCastleProvider.
        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 interface org.refcodes.security.Encrypter<java.lang.String,java.lang.String,org.refcodes.security.EncryptionException>
        Specified by:
        toEncrypted in interface EncryptionProvider
        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 interface org.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 interface EncryptionProvider