Package io.netty.handler.ssl
Class ZlibCertificateCompressionAlgorithm
- java.lang.Object
-
- io.netty.handler.ssl.ZlibCertificateCompressionAlgorithm
-
- All Implemented Interfaces:
OpenSslCertificateCompressionAlgorithm
public final class ZlibCertificateCompressionAlgorithm extends java.lang.Object implements OpenSslCertificateCompressionAlgorithm
The zlib certificate compression algorithm (ID 1) as defined by RFC 8879.This is the default algorithm used by
OpenSslCertificateCompressionConfig. Use it to keep zlib when supplying a custom configuration. The singleton is thread-safe.
-
-
Field Summary
Fields Modifier and Type Field Description private static intALGORITHM_IDprivate static intBUFFER_SIZEstatic ZlibCertificateCompressionAlgorithmINSTANCEThe shared instance.private static intMAX_UNCOMPRESSED_CERTIFICATE_LENGTH
-
Constructor Summary
Constructors Modifier Constructor Description privateZlibCertificateCompressionAlgorithm()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intalgorithmId()Return the ID for the compression algorithm provided for by a given implementation.byte[]compress(javax.net.ssl.SSLEngine engine, byte[] uncompressedCertificate)Compress the given input with the specified algorithm and return the compressed bytes.byte[]decompress(javax.net.ssl.SSLEngine engine, int uncompressedLen, byte[] compressedCertificate)Decompress the given input with the specified algorithm and return the decompressed bytes.
-
-
-
Field Detail
-
INSTANCE
public static final ZlibCertificateCompressionAlgorithm INSTANCE
The shared instance.
-
ALGORITHM_ID
private static final int ALGORITHM_ID
- See Also:
- Constant Field Values
-
BUFFER_SIZE
private static final int BUFFER_SIZE
- See Also:
- Constant Field Values
-
MAX_UNCOMPRESSED_CERTIFICATE_LENGTH
private static final int MAX_UNCOMPRESSED_CERTIFICATE_LENGTH
- See Also:
- Constant Field Values
-
-
Method Detail
-
compress
public byte[] compress(javax.net.ssl.SSLEngine engine, byte[] uncompressedCertificate)Description copied from interface:OpenSslCertificateCompressionAlgorithmCompress the given input with the specified algorithm and return the compressed bytes.- Specified by:
compressin interfaceOpenSslCertificateCompressionAlgorithm- Parameters:
engine- theSSLEngineuncompressedCertificate- the uncompressed certificate- Returns:
- the compressed form of the certificate
-
decompress
public byte[] decompress(javax.net.ssl.SSLEngine engine, int uncompressedLen, byte[] compressedCertificate) throws java.util.zip.DataFormatExceptionDescription copied from interface:OpenSslCertificateCompressionAlgorithmDecompress the given input with the specified algorithm and return the decompressed bytes.Implementation Security Considerations
Implementations SHOULD bound the memory usage when decompressing the CompressedCertificate message.
Implementations MUST limit the size of the resulting decompressed chain to the specified
uncompressedLen, and they MUST abort the connection (throw an exception) if the size of the output of the decompression function exceeds that limit.- Specified by:
decompressin interfaceOpenSslCertificateCompressionAlgorithm- Parameters:
engine- theSSLEngineuncompressedLen- the expected length of the decompressed certificate that will be returned.compressedCertificate- the compressed form of the certificate- Returns:
- the decompressed form of the certificate
- Throws:
java.util.zip.DataFormatException
-
algorithmId
public int algorithmId()
Description copied from interface:OpenSslCertificateCompressionAlgorithmReturn the ID for the compression algorithm provided for by a given implementation.- Specified by:
algorithmIdin interfaceOpenSslCertificateCompressionAlgorithm- Returns:
- compression algorithm ID as specified by RFC8879.
-
-