From 198f89bc50a44c17ae9227629f2f7b4b970c1268 Mon Sep 17 00:00:00 2001 From: zzz <zzz@mail.i2p> Date: Tue, 11 Feb 2025 21:22:14 +0000 Subject: [PATCH] Data: Fix KeysAndCert.equals() --- core/java/src/net/i2p/data/KeysAndCert.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/core/java/src/net/i2p/data/KeysAndCert.java b/core/java/src/net/i2p/data/KeysAndCert.java index 85e0f90aa8..74b792dff6 100644 --- a/core/java/src/net/i2p/data/KeysAndCert.java +++ b/core/java/src/net/i2p/data/KeysAndCert.java @@ -267,8 +267,11 @@ public class KeysAndCert extends DataStructureImpl { return DataHelper.eq(_signingKey, ident._signingKey) && DataHelper.eq(_publicKey, ident._publicKey) - && Arrays.equals(_padding, ident._padding) - && DataHelper.eq(_certificate, ident._certificate); + && DataHelper.eq(_certificate, ident._certificate) + && (Arrays.equals(_padding, ident._padding) || + // failsafe as some code paths may not compress padding + ((_paddingBlocks > 1 || ident._paddingBlocks > 1) && + Arrays.equals(getPadding(), ident.getPadding()))); } /** the signing key has enough randomness in it to use it by itself for speed */ -- GitLab