Pumpkin-MC/Pumpkin · error · EncryptionError

failed to decrypt shared secret

Error message

failed to decrypt shared secret

What it means

EncryptionError variant thrown during the Java login encryption handshake when the client's encrypted shared secret cannot be decrypted with the server's private key. The client key pair or handshake response is wrong.

Solutions

  1. Abort the connection with a bad-encryption kick
  2. Log the failure at debug level
  3. Verify the client used the public key from the encryption request
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at crates/pumpkin/src/net/mod.rs:424 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Pumpkin-MC/Pumpkin@8d4639e25a (2026-09-09). Data as JSON: /api/errors/ce1059ddcf2e30d0. Report an issue: GitHub.

Appendix: source

Thrown at crates/pumpkin/src/net/mod.rs:424

        );
        return Some(match entry.expires {
            Some(expires) => text.add_child(TextComponent::translate_cross(
                translation::java::MULTIPLAYER_DISCONNECT_BANNED_IP_EXPIRATION,
                translation::java::MULTIPLAYER_DISCONNECT_BANNED_IP_EXPIRATION,
                [TextComponent::text(
                    expires.format(FORMAT_DESCRIPTION).unwrap_or_default(),
                )],
            )),
            None => text,
        });
    }

    None
}

#[derive(Error, Debug)]
pub enum EncryptionError {
    #[error("failed to decrypt shared secret")]
    FailedDecrypt,
    #[error("shared secret has the wrong length")]
    SharedWrongLength,
    #[error("encryption is already enabled")]
    AlreadyEncrypted,
    #[error("no encryption request is pending")]
    NoPendingVerifyToken,
    #[error("verify token does not match")]
    VerifyTokenMismatch,
}

fn is_valid_player_name(name: &str) -> bool {
    if name.len() > 16 {
        return false;
    }
    !name.chars().any(|c| c.is_control() || c == ' ')
}

View on GitHub (pinned to 8d4639e25a)