Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-6616

need always close the CipherOutputStream when the encryption is done to get the complete content

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 3.0.7, 3.1.4
    • None
    • None
    • Unknown

    Description

      The flush method of CipherOutputStream can't guarantee to flush all content, the java doc says

      Flushes this output stream by forcing any buffered output bytes that have already been processed by the encapsulated cipher object to be written out.
      
       
      
      Any bytes buffered by the encapsulated cipher and waiting to be processed by it will not be written out. For example, if the encapsulated cipher is a block cipher, and the total number of bytes written using one of the write methods is less than the cipher's block size, no bytes will be written out.
      
      

      So the behavior could vary depend on different platforms/JVMs, I can see CachedWriterTest and CachedOutputStreamTest failed(when CipherOutputStream is used) on some platform due to miss the last padding of the encrypt content

      Attachments

        Activity

          People

            ffang Freeman Yue Fang
            ffang Freeman Yue Fang
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: