java.lang.Object
net.i2p.router.LeaseSetKeys

public class LeaseSetKeysextends Object
Wrap up the keys given to the router when a destination connects to it. Used by KeyManager, ClientMessageEventListener, GarlicMessageReceiver.
  • Field Details

    • _revocationKey

      private final SigningPrivateKey _revocationKey
      Key that revokes the lease set.
    • _decryptionKey

      private final PrivateKey _decryptionKey
      The ElGamal decryption key.
    • _decryptionKeyEC

      private final PrivateKey _decryptionKeyEC
      The ECIES decryption key.
    • _decryptionKeyPQ

      private final PrivateKey _decryptionKeyPQ
      The post-quantum decryption key.
    • SET_ELG

      public static final Set<EncType> SET_ELG
      Unmodifiable, ElGamal only.
    • SET_EC

      public static final Set<EncType> SET_EC
      Unmodifiable, ECIES-X25519 only.
    • SET_BOTH

      public static final Set<EncType> SET_BOTH
      Unmodifiable, ElGamal and ECIES-X25519.
    • SET_NONE

      private static final Set<EncType> SET_NONE
      The empty set, for a lease set that accepts nothing.
    • SET_PQ1

      public static final Set<EncType> SET_PQ1
      Unmodifiable, PQ only.
    • SET_PQ2

      public static final Set<EncType> SET_PQ2
      Unmodifiable, PQ only.
    • SET_PQ3

      public static final Set<EncType> SET_PQ3
      Unmodifiable, PQ only.
    • SET_EC_PQ1

      public static final Set<EncType> SET_EC_PQ1
      Unmodifiable, ECIES-X25519 and PQ only.
    • SET_EC_PQ2

      public static final Set<EncType> SET_EC_PQ2
      Unmodifiable, ECIES-X25519 and PQ only.
    • SET_EC_PQ3

      public static final Set<EncType> SET_EC_PQ3
      Unmodifiable, ECIES-X25519 and PQ only.
    • SET_EC_PQ_ALL

      public static final Set<EncType> SET_EC_PQ_ALL
      Unmodifiable, ECIES-X25519 and PQ only.
  • Constructor Details

    • LeaseSetKeys

      public LeaseSetKeys(Destination dest, SigningPrivateKey revocationKey, PrivateKey decryptionKey)
      Client with a single key.
      Parameters:
      dest - not read; the LeaseSetKeys constructor shares its signature with the server-side variant
      revocationKey - unused, may be null
      decryptionKey - non-null
    • LeaseSetKeys

      public LeaseSetKeys(Destination dest, SigningPrivateKey revocationKey, List<PrivateKey> decryptionKeys)
      Client with multiple keys

      The ONLY valid combinations are X25519 + ElG or X25519 + (MLKEM512 OR MLKEM768 OR MLKEM1024). Other combinations will throw IllegalArgumentException.

      Parameters:
      dest - not read; the LeaseSetKeys constructor shares its signature with the server-side variant
      revocationKey - unused, may be null
      decryptionKeys - non-null, non-empty
      Throws:
      IllegalArgumentException - if the list is empty, holds two keys of the same encryption type, mixes ElGamal with a PQ key, or holds an unrecognized type
  • Method Details

    • getRevocationKey

      public SigningPrivateKey getRevocationKey()
      Key with which a LeaseSet can be revoked (by republishing it with no Leases)

      Deprecated, unused.

      Returns:
      the revocation key
    • getDecryptionKey

      public PrivateKey getDecryptionKey()
      Decryption key which can open up garlic messages encrypted to the LeaseSet's public key. This is used because the general public does not know on what router the destination is connected and as such can't encrypt to that router's normal public key.
      Returns:
      ElGamal key or null if the LS does not support ElGamal
    • getDecryptionKey

      public PrivateKey getDecryptionKey(EncType type)
      Decryption key which can open up garlic messages encrypted to the LeaseSet's public key. This is used because the general public does not know on what router the destination is connected and as such can't encrypt to that router's normal public key.
      Parameters:
      type - encryption type whose matching key is wanted; a PQ type must match the stored key
      Returns:
      key of the specified type or null if the LS does not support that type
    • getPQDecryptionKey

      public PrivateKey getPQDecryptionKey()
      The PQ decryption key of any type, or null if the LS does not support PQ.
      Returns:
      PQ key (any type) or null if the LS does not support PQ
    • isSupported

      public boolean isSupported(EncType type)
      Do we support this type of encryption?
      Parameters:
      type - the encryption type to test; true comes back when a key of that type is present
      Returns:
      true if a key of that type is held; false for an unrecognized type
    • getSupportedEncryption

      public Set<EncType> getSupportedEncryption()
      The types of encryption supported by this LeaseSet.
      Returns:
      the supported encryption