net.i2p.router.news

## Class BlocklistEntries

- java.lang.Object
- - net.i2p.router.news.BlocklistEntries

-     public class BlocklistEntries
      extends Object

  Data structure and management for I2P router blocklist entries.

  Represents a signed blocklist containing router identifiers to be blocked or unblocked, with support for cryptographic signature verification and timestamp validation.

  Provides methods for loading, verifying, and managing blocklist entries with security checks to prevent expired or invalid blocklists. Includes command-line tool for creating signed blocklist files from input text.

  All String fields may be null to accommodate optional metadata elements in blocklist feeds.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `List<String>` | `entries` List of entries to block.
    `static int` | `MAX_ENTRIES` Maximum number of entries allowed in a blocklist.
    `static long` | `MAX_FUTURE`
    `List<String>` | `removes` List of entries to unblock.
    `String` | `sig` Signature in type:base64 format.
    `String` | `signer` Signer certificate name.
    `String` | `supdated` Updated timestamp as ISO 3339 date string.
    `long` | `updated` Updated timestamp as milliseconds since epoch.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `BlocklistEntries(int capacity)` Creates a new BlocklistEntries with the specified capacity.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `isVerified()` Check if the blocklist signature has been verified.
    `static void` | `main(String[] args)` BlocklistEntries [-p keystorepw] input.txt keystore.ks you@mail.i2p File format: One entry per line, # starts a comment, ! starts an unblock entry.
    `boolean` | `verify(I2PAppContext ctx)` Verify the blocklist signature.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### entries

          public final List<String> entries

      List of entries to block. Each entry is an IPv4/IPv6 address or base64 router hash.

    - #### MAX_ENTRIES

          public static final int MAX_ENTRIES

      Maximum number of entries allowed in a blocklist.
      See Also:
        Constant Field Values

    - #### MAX_FUTURE

          public static final long MAX_FUTURE

      See Also:
        Constant Field Values

    - #### removes

          public final List<String> removes

      List of entries to unblock.

    - #### sig

          public String sig

      Signature in type:base64 format.

    - #### signer

          public String signer

      Signer certificate name.

    - #### supdated

          public String supdated

      Updated timestamp as ISO 3339 date string.

    - #### updated

          public long updated

      Updated timestamp as milliseconds since epoch.

  - ### Constructor Detail

    - #### BlocklistEntries

          public BlocklistEntries(int capacity)

      Creates a new BlocklistEntries with the specified capacity.
      Parameters:
        `capacity` - the initial capacity for the entries list

  - ### Method Detail

    - #### isVerified

          public boolean isVerified()

      Check if the blocklist signature has been verified.
      Returns:
        true if verified, false otherwise

    - #### main

          public static void main(String[] args)

      BlocklistEntries [-p keystorepw] input.txt keystore.ks you@mail.i2p File format: One entry per line, # starts a comment, ! starts an unblock entry. Single IPv4 or IPv6 address only (no mask allowed), or 44-char base 64 router hash. See MAX_ENTRIES above.

    - #### verify

          public boolean verify(I2PAppContext ctx)

      Verify the blocklist signature.
      Parameters:
        `ctx` - the application context
      Returns:
        true if signature is valid, false otherwise