#[non_exhaustive]pub enum CryptoType {
ElGamal,
EciesP256,
EciesX25519,
EciesMlkem512X25519,
EciesMlkem768X25519,
EciesMlkem1024X25519,
}Expand description
An encryption algorithm a destination’s LeaseSet2 can advertise as usable – see
I2pRouter::create_persistent_destination’s encryption_types parameter.
Values are libi2pd’s protocol-level CryptoKeyType (libi2pd/Identity.h). This covers only
the advertised encryption capability, never the identity certificate, which is ElGamal either
way (see I2pRouter::generate_keys).
An empty encryption_types slice already gets libi2pd’s hybrid default
(ElGamal + ECIES-X25519, plus ML-KEM-768 on a post-quantum-capable backend); explicit values
only ever narrow that. The EciesMlkem* variants are new enough that older peers may not
understand a destination advertising one, so they trade reachability for long-term
confidentiality.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
ElGamal
The original ElGamal scheme. For old persisted keys only.
EciesP256
ECIES on the P-256 curve with AES-256-CBC. Not widely used on the I2P network.
EciesX25519
ECIES-X25519-AEAD (ChaCha20/Poly1305). The I2P network’s current default.
EciesMlkem512X25519
ECIES-X25519-AEAD hybridized with ML-KEM-512 (NIST PQC category 1).
EciesMlkem768X25519
ECIES-X25519-AEAD hybridized with ML-KEM-768 (NIST PQC category 3).
EciesMlkem1024X25519
ECIES-X25519-AEAD hybridized with ML-KEM-1024 (NIST PQC category 5).
Implementations§
Source§impl CryptoType
impl CryptoType
Sourcepub fn is_supported(self) -> bool
pub fn is_supported(self) -> bool
Whether the linked crypto backend can actually perform this algorithm. Always true for
the classical types; for the EciesMlkem* ones it runs a real
generate/encapsulate/decapsulate round trip through libi2pd’s MLKEMKeys rather than
checking a feature flag. Sub-millisecond but not free – cache it, don’t call it per
connection. Needs no running router.
Check this before naming an EciesMlkem* type in
create_persistent_destination: a LeaseSet2
advertising only algorithms this router cannot perform leaves the destination
unreachable, with nothing in the address or the creation result to say so.
Trait Implementations§
Source§impl Clone for CryptoType
impl Clone for CryptoType
Source§fn clone(&self) -> CryptoType
fn clone(&self) -> CryptoType
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more