java.lang.Object
net.i2p.data.BlindData
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 requiredAUTH_DH- Diffie-Hellman key exchange for per-client keysAUTH_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 Summary
Modifier and TypeFieldDescriptionprivate SigningPrivateKeyThe blinding private key, for the server side.private final PrivateKeyThe key proving the authorization, if any.private booleanTrue if the authorization key must be presented.private final intThe authorization type of the destination.private StringCached base32 address of the destination.private HashThe hash of the blinded destination.private SigningPublicKeyThe blinded signing key, once calculated.private final SigTypeThe signature type of the blinded key.private final SigningPublicKeyThe clear signing key of the destination.private final I2PAppContextThe app context.private longWhen the blind data was created.private DestinationThe blinded destination, once calculated.private longWhen the blind data expires.private longModifier for the blinded routing key derivation.private final StringThe secret code required to use the destination.private booleanTrue if the secret code must be presented.static final intBits 3-0 including per-client bit.static final intBits 3-0 including per-client bit.static final intEnabled, unspecified type.static final intBits 3-0 including per-client bit.Constructor Summary
ConstructorsConstructorDescriptionBlindData(I2PAppContext ctx, Destination dest, SigType blindType, String secret) Creates a new BlindData instance for the given destination.BlindData(I2PAppContext ctx, Destination dest, SigType blindType, String secret, int authType, PrivateKey authKey) Creates a new BlindData instance for the given destination with authentication.BlindData(I2PAppContext ctx, SigningPublicKey spk, SigType blindType, String secret) Creates a new BlindData instance for the given signing public key.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.Method Summary
Modifier and TypeMethodDescriptionprivate voidCalculates the blinded key, hash and destination.getAlpha()Gets the alpha value for the current day.Gets the authentication private key.booleanChecks if authentication is required.intGets the authentication type.Gets the hash of the blinded key for the current day.Gets the blinded signing public key for the current day.Gets the type of the blinded signature.longgetDate()Creation date.Gets the destination hash if known.Gets the destination if known.longExpiration date.Gets the secret if set.booleanChecks if a secret is required.Gets the unblinded signing public key.voidMarks that authentication is required for this blinded key.voidsetDate(long date) Creation date.voidSets the destination for this blinded data.voidsetExpiration(long date) Expiration date.voidMarks that a secret is required for this blinded key.toBase32()Encodes the blinded key in b33 format.toString()
Field Details
_context
The app context._clearSPK
The clear signing key of the destination._secret
The secret code required to use the destination._blindSPK
The blinded signing key, once calculated._blindType
The signature type of the blinded key._authType
private final int _authTypeThe authorization type of the destination._authKey
The key proving the authorization, if any._blindHash
The hash of the blinded destination._alpha
The blinding private key, for the server side._dest
The blinded destination, once calculated._routingKeyGenMod
private volatile long _routingKeyGenModModifier for the blinded routing key derivation._secretRequired
private volatile boolean _secretRequiredTrue if the secret code must be presented._authRequired
private volatile boolean _authRequiredTrue if the authorization key must be presented._date
private volatile long _dateWhen the blind data was created._expiration
private volatile long _expirationWhen the blind data expires._b32
Cached base32 address of the destination.AUTH_NONE
AUTH_DH
AUTH_PSK
AUTH_ON
Constructor Details
BlindData
Creates a new BlindData instance for the given destination.- Parameters:
ctx- the application contextdest- the destination, whose signing public key is the one blinded; must be non-nullblindType- the type of blinded signaturesecret- 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 contextdest- the destination, whose signing public key is the one blinded; must be non-nullblindType- the type of blinded signaturesecret- may be null or zero-lengthauthType- the authentication typeauthKey- the authentication key- Throws:
IllegalArgumentException- on various errors
BlindData
Creates a new BlindData instance for the given signing public key.- Parameters:
ctx- the application contextspk- the signing public keyblindType- the type of blinded signaturesecret- 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 contextspk- the signing public keyblindType- the type of blinded signaturesecret- may be null or zero-lengthauthType- the authentication typeauthKey- the authentication key- Throws:
IllegalArgumentException- on various errors
Method Details
getUnblindedPubKey
Gets the unblinded signing public key.- Returns:
- The unblinded SPK, non-null
getBlindedSigType
Gets the type of the blinded signature.- Returns:
- The type of the blinded key
getBlindedPubKey
Gets the blinded signing public key for the current day.- Returns:
- The blinded key for the current day, non-null
getDestHash
Gets the destination hash if known.- Returns:
- The hash of the destination if known, or null
getBlindedHash
Gets the hash of the blinded key for the current day.- Returns:
- The hash of the blinded key for the current day
getAlpha
Gets the alpha value for the current day.- Returns:
- Alpha for the current day
getDestination
setDestination
Sets the destination for this blinded data.- Parameters:
d- the destination to set- Throws:
IllegalArgumentException- on SigningPublicKey mismatch
getSecret
getAuthType
public int getAuthType()Gets the authentication type.- Returns:
- 0 for no client auth, 1 for DH, 3 for PSK
getAuthPrivKey
Gets the authentication private key.- Returns:
- null for no client auth
calculate
private void calculate()Calculates the blinded key, hash and destination.toBase32
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