java.lang.Object
net.i2p.data.BlindData

public class BlindDataextends Object
Cache data for EdDSA key blinding as specified in Proposal 123: New NetDb Entries.

BlindData provides the infrastructure for cryptographic key blinding in I2P:

  • Manages blinded and unblinded EdDSA signing key pairs
  • Supports multiple authentication methods for encrypted LeaseSets
  • Caches computed blinded keys and related metadata
  • Handles time-based key rotation and expiration
  • Generates blinded destination addresses (.b32.i2p)

Key Components:

  • Key Blinding: Transforms clear signing keys into blinded equivalents
  • Authentication: Supports DH, PSK, and no-authentication modes
  • Caching: Stores computed values to avoid expensive recalculation
  • Address Generation: Creates blinded .b32 addresses for services

Authentication Types:

  • AUTH_NONE - No authentication required
  • AUTH_DH - Diffie-Hellman key exchange for per-client keys
  • AUTH_PSK - Pre-shared key authentication

Usage Scenarios:

  • Encrypted LeaseSets: Generate blinded keys for restricted access
  • Destination Blinding: Create anonymous service endpoints
  • Access Control: Implement authentication for private services
  • Key Rotation: Manage time-based blinded key updates

Security Considerations:

  • Blinded keys provide unlinkability between clear and blinded identities
  • Authentication data must be securely stored and transmitted
  • Key rotation intervals should balance security and usability
  • Proper validation of blinded signatures is essential

Implementation Status: PRELIMINARY - Subject to change as proposal evolves.

  • Field Details

    • _context

      private final I2PAppContext _context
      The app context.
    • _clearSPK

      private final SigningPublicKey _clearSPK
      The clear signing key of the destination.
    • _secret

      private final String _secret
      The secret code required to use the destination.
    • _blindSPK

      private volatile SigningPublicKey _blindSPK
      The blinded signing key, once calculated.
    • _blindType

      private final SigType _blindType
      The signature type of the blinded key.
    • _authType

      private final int _authType
      The authorization type of the destination.
    • _authKey

      private final PrivateKey _authKey
      The key proving the authorization, if any.
    • _blindHash

      private volatile Hash _blindHash
      The hash of the blinded destination.
    • _alpha

      private volatile SigningPrivateKey _alpha
      The blinding private key, for the server side.
    • _dest

      private volatile Destination _dest
      The blinded destination, once calculated.
    • _routingKeyGenMod

      private volatile long _routingKeyGenMod
      Modifier for the blinded routing key derivation.
    • _secretRequired

      private volatile boolean _secretRequired
      True if the secret code must be presented.
    • _authRequired

      private volatile boolean _authRequired
      True if the authorization key must be presented.
    • _date

      private volatile long _date
      When the blind data was created.
    • _expiration

      private volatile long _expiration
      When the blind data expires.
    • _b32

      private volatile String _b32
      Cached base32 address of the destination.
    • AUTH_NONE

      public static final int AUTH_NONE
      Bits 3-0 including per-client bit.
      See Also:
    • AUTH_DH

      public static final int AUTH_DH
      Bits 3-0 including per-client bit.
      See Also:
    • AUTH_PSK

      public static final int AUTH_PSK
      Bits 3-0 including per-client bit.
      See Also:
    • AUTH_ON

      public static final int AUTH_ON
      Enabled, unspecified type.
      See Also:
  • Constructor Details

    • BlindData

      public BlindData(I2PAppContext ctx, Destination dest, SigType blindType, String secret)
      Creates a new BlindData instance for the given destination.
      Parameters:
      ctx - the application context
      dest - the destination, whose signing public key is the one blinded; must be non-null
      blindType - the type of blinded signature
      secret - may be null or zero-length
      Throws:
      IllegalArgumentException - on various errors
    • BlindData

      public BlindData(I2PAppContext ctx, Destination dest, SigType blindType, String secret, int authType, PrivateKey authKey)
      Creates a new BlindData instance for the given destination with authentication.
      Parameters:
      ctx - the application context
      dest - the destination, whose signing public key is the one blinded; must be non-null
      blindType - the type of blinded signature
      secret - may be null or zero-length
      authType - the authentication type
      authKey - the authentication key
      Throws:
      IllegalArgumentException - on various errors
    • BlindData

      public BlindData(I2PAppContext ctx, SigningPublicKey spk, SigType blindType, String secret)
      Creates a new BlindData instance for the given signing public key.
      Parameters:
      ctx - the application context
      spk - the signing public key
      blindType - the type of blinded signature
      secret - may be null or zero-length
      Throws:
      IllegalArgumentException - on various errors
    • BlindData

      public BlindData(I2PAppContext ctx, SigningPublicKey spk, SigType blindType, String secret, int authType, PrivateKey authKey)
      Creates a new BlindData instance for the given signing public key with authentication.
      Parameters:
      ctx - the application context
      spk - the signing public key
      blindType - the type of blinded signature
      secret - may be null or zero-length
      authType - the authentication type
      authKey - the authentication key
      Throws:
      IllegalArgumentException - on various errors
  • Method Details

    • getUnblindedPubKey

      public SigningPublicKey getUnblindedPubKey()
      Gets the unblinded signing public key.
      Returns:
      The unblinded SPK, non-null
    • getBlindedSigType

      public SigType getBlindedSigType()
      Gets the type of the blinded signature.
      Returns:
      The type of the blinded key
    • getBlindedPubKey

      public SigningPublicKey getBlindedPubKey()
      Gets the blinded signing public key for the current day.
      Returns:
      The blinded key for the current day, non-null
    • getDestHash

      public Hash getDestHash()
      Gets the destination hash if known.
      Returns:
      The hash of the destination if known, or null
    • getBlindedHash

      public Hash getBlindedHash()
      Gets the hash of the blinded key for the current day.
      Returns:
      The hash of the blinded key for the current day
    • getAlpha

      public SigningPrivateKey getAlpha()
      Gets the alpha value for the current day.
      Returns:
      Alpha for the current day
    • getDestination

      public Destination getDestination()
      Gets the destination if known.
      Returns:
      null if unknown
    • setDestination

      public void setDestination(Destination d)
      Sets the destination for this blinded data.
      Parameters:
      d - the destination to set
      Throws:
      IllegalArgumentException - on SigningPublicKey mismatch
    • getSecret

      public String getSecret()
      Gets the secret if set.
      Returns:
      null if none
    • getAuthType

      public int getAuthType()
      Gets the authentication type.
      Returns:
      0 for no client auth, 1 for DH, 3 for PSK
    • getAuthPrivKey

      public PrivateKey getAuthPrivKey()
      Gets the authentication private key.
      Returns:
      null for no client auth
    • calculate

      private void calculate()
      Calculates the blinded key, hash and destination.
    • toBase32

      public String toBase32()
      Encodes the blinded key in b33 format.
      Returns:
      the b33 encoded string
    • setSecretRequired

      public void setSecretRequired()
      Marks that a secret is required for this blinded key.
    • getSecretRequired

      public boolean getSecretRequired()
      Checks if a secret is required.
      Returns:
      true if a secret is required
    • setAuthRequired

      public void setAuthRequired()
      Marks that authentication is required for this blinded key.
    • getAuthRequired

      public boolean getAuthRequired()
      Checks if authentication is required.
      Returns:
      true if authentication is required
    • setDate

      public void setDate(long date)
      Creation date. Absolute timestamp.
      Parameters:
      date - the creation date in milliseconds
    • getDate

      public long getDate()
      Creation date. Absolute timestamp. Returns zero if not specified.
      Returns:
      creation date or as overridden by setDate(long)
    • setExpiration

      public void setExpiration(long date)
      Expiration date. Absolute timestamp.
      Parameters:
      date - the expiration date in milliseconds
    • getExpiration

      public long getExpiration()
      Expiration date. Absolute timestamp. Returns zero if not specified.
      Returns:
      expiration date or as overridden by setExpiration(long)
    • toString

      public String toString()
      Overrides:
      toString in class Object