Class LazyMessageCryptoHandler

    • Method Detail

      • setMaxInputLength

        public void setMaxInputLength​(long size)
        Description copied from interface: MessageCryptoHandler
        Informs this handler of an upper bound on the input data size. The handler will throw an exception if this bound is exceeded, and may use it to perform performance optimizations as well. If this method is called multiple times, the smallest bound will be used.
        Specified by:
        setMaxInputLength in interface MessageCryptoHandler
        Parameters:
        size - An upper bound on the input data size.
      • isComplete

        public boolean isComplete()
        Description copied from interface: CryptoHandler
        For decrypt and parsing flows returns true when this has handled as many bytes as it can. This usually means that it has reached the end of an object, file, or other delimited stream.
        Specified by:
        isComplete in interface CryptoHandler
      • getEncryptionContext

        public Map<String,​String> getEncryptionContext()
        Description copied from interface: MessageCryptoHandler
        Return the encryption context used in the generation of the data key used for the encryption of content.

        During decryption, this value should be obtained by parsing the ciphertext headers that encodes this value.

        Specified by:
        getEncryptionContext in interface MessageCryptoHandler
        Returns:
        the key-value map containing the encryption context.
      • processBytes

        public ProcessingSummary processBytes​(byte[] in,
                                              int inOff,
                                              int inLen,
                                              byte[] out,
                                              int outOff)
        Description copied from interface: CryptoHandler
        Process a block of bytes from in putting the result into out.
        Specified by:
        processBytes in interface CryptoHandler
        Parameters:
        in - the input byte array.
        inOff - the offset into the in array where the data to be processed starts.
        inLen - the number of bytes to be processed.
        out - the output buffer the processed bytes go into.
        outOff - the offset into the output byte array the processed data starts at.
        Returns:
        the number of bytes written to out and the number of bytes parsed.
      • doFinal

        public int doFinal​(byte[] out,
                           int outOff)
        Description copied from interface: CryptoHandler
        Finish processing of the bytes.
        Specified by:
        doFinal in interface CryptoHandler
        Parameters:
        out - the output buffer for copying any remaining output data.
        outOff - offset into out to start copying the output data.
        Returns:
        number of bytes written into out.
      • estimateFinalOutputSize

        public int estimateFinalOutputSize()
        Description copied from interface: CryptoHandler
        Return the size of the output buffer required for a call to CryptoHandler.doFinal(byte[], int).

        Note this method is allowed to return an estimation of the output size that is greater than the actual size of the output. Returning an estimate that is lesser than the actual size of the output will result in underflow exceptions.

        Specified by:
        estimateFinalOutputSize in interface CryptoHandler
        Returns:
        the space required to accomodate a call to CryptoHandler.doFinal(byte[], int)