Interface CertificateCompressionAlgo


public interface CertificateCompressionAlgo
Provides compression/decompression implementations for TLS Certificate Compression (RFC 8879).
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
     
    static final int
     
    static final int
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Return the ID for the compression algorithm provided for by a given implementation.
    byte[]
    compress(long ssl, byte[] input)
    Compress the given input with the specified algorithm and return the compressed bytes.
    byte[]
    decompress(long ssl, int uncompressedLen, byte[] input)
    Decompress the given input with the specified algorithm and return the decompressed bytes.
  • Field Details

    • TLS_EXT_CERT_COMPRESSION_ZLIB

      static final int TLS_EXT_CERT_COMPRESSION_ZLIB
    • TLS_EXT_CERT_COMPRESSION_BROTLI

      static final int TLS_EXT_CERT_COMPRESSION_BROTLI
    • TLS_EXT_CERT_COMPRESSION_ZSTD

      static final int TLS_EXT_CERT_COMPRESSION_ZSTD
  • Method Details

    • compress

      byte[] compress(long ssl, byte[] input) throws Exception
      Compress the given input with the specified algorithm and return the compressed bytes.
      Parameters:
      ssl - the SSL instance
      input - the uncompressed form of the certificate
      Returns:
      the compressed form of the certificate
      Throws:
      Exception - thrown if an error occurs while compressing
    • decompress

      byte[] decompress(long ssl, int uncompressedLen, byte[] input) throws Exception
      Decompress 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.

      Parameters:
      ssl - the SSL instance
      uncompressedLen - the expected length of the uncompressed certificate
      input - the compressed form of the certificate
      Returns:
      the decompressed form of the certificate
      Throws:
      Exception - thrown if an error occurs while decompressing or output size exceeds uncompressedLen
    • algorithmId

      int algorithmId()
      Return the ID for the compression algorithm provided for by a given implementation.
      Returns:
      compression algorithm ID as specified by RFC8879
       TLS_EXT_CERT_COMPRESSION_ZLIB
       TLS_EXT_CERT_COMPRESSION_BROTLI
       TLS_EXT_CERT_COMPRESSION_ZSTD