Class DecryptionProviderImpl

  • All Implemented Interfaces:

    public class DecryptionProviderImpl
    extends java.lang.Object
    implements DecryptionProvider
    This class is a basic implementation of the DecryptionProvider interface.

    ATTENTION: This implementation does not take care of housekeeping. In case this class is to be run as a service, it must provide housekeeping facilities in terms of cleaning up instances contained in internal data structures (such as the hash maps) after a defined period of time those instance were not accessed.

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int toDecrypted​(byte[] aInput, int aInputOffset, int aInputLength, byte[] aOutput, int aOutputOffset)
      java.lang.String toDecrypted​(java.lang.String aInput)
      Encrypts a text with the latest known valid cipher.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DecryptionProviderImpl

        public DecryptionProviderImpl​(DecryptionService aDecryptionService,
                                      java.lang.String aJceAlgorithm)
        Constructs the DecryptionProvider with the given DecryptionService and with the specified JCE Provider as well as the according JCE algorithm.
        aDecryptionService - The DecryptionService to use for getting the known ciphers for decryption
        aJceProvider - The JCE Provider to be used.
        aJceAlgorithm - the JCE algorithm to be used by the JCE Provider.
      • DecryptionProviderImpl

        public DecryptionProviderImpl​(DecryptionService aDecryptionService)
        Constructs the DecryptionProvider using AES as implemented by the BouncyCastleProvider.
        aDecryptionService - The service to use for getting the known ciphers for decryption
    • Method Detail

      • toDecrypted

        public java.lang.String toDecrypted​(java.lang.String aInput)
                                     throws UnknownCipherUidException,
        Encrypts a text with the latest known valid cipher.
        Specified by:
        toDecrypted in interface<java.lang.String,java.lang.String,>
        Specified by:
        toDecrypted in interface DecryptionProvider
        aInput - The text to be encrypted
        The encrypted text with a version prefixed identifying the cipher being used for encryption.
        UnknownCipherUidException - in case the cipher UID prefixed to the encrypted text is unknown
        NoCipherUidException - in case no cipher UID was found prefixed to the provided text.
      • toDecrypted

        public int toDecrypted​(byte[] aInput,
                               int aInputOffset,
                               int aInputLength,
                               byte[] aOutput,
                               int aOutputOffset)
                        throws javax.crypto.ShortBufferException,
        Specified by:
        toDecrypted in interface<java.lang.String,java.lang.String,>