Class DeflateHelper


  • @ThreadSafe
    public class DeflateHelper
    extends Object
    Deflate (RFC 1951) helper methods, intended for use by JWE encrypters and decrypters. This class is thread-safe.
    Version:
    2014-07-08
    Author:
    Vladimir Dzhuvinov
    • Method Detail

      • applyCompression

        public static byte[] applyCompression​(JWEHeader jweHeader,
                                              byte[] bytes)
                                       throws JOSEException
        Applies compression to the specified plain text if requested.
        Parameters:
        jweHeader - The JWE header. Must not be null.
        bytes - The plain text bytes. Must not be null.
        Returns:
        The bytes to encrypt.
        Throws:
        JOSEException - If compression failed or the requested compression algorithm is not supported.
      • applyDecompression

        public static byte[] applyDecompression​(JWEHeader jweHeader,
                                                byte[] bytes)
                                         throws JOSEException
        Applies decompression to the specified plain text if requested.
        Parameters:
        jweHeader - The JWE header. Must not be null.
        bytes - The plain text bytes. Must not be null.
        Returns:
        The output bytes, decompressed if requested.
        Throws:
        JOSEException - If decompression failed or the requested compression algorithm is not supported.