From ba5af15c6f08aabbbd2dde9a04a0b5af7feeae32 Mon Sep 17 00:00:00 2001 From: str4d <str4d@mail.i2p> Date: Tue, 21 Jul 2015 01:19:37 +0000 Subject: [PATCH] Fix KeyCert bug --- core/java/src/net/i2p/data/KeyCertificate.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/java/src/net/i2p/data/KeyCertificate.java b/core/java/src/net/i2p/data/KeyCertificate.java index 904f773885..86078658fe 100644 --- a/core/java/src/net/i2p/data/KeyCertificate.java +++ b/core/java/src/net/i2p/data/KeyCertificate.java @@ -122,7 +122,7 @@ public class KeyCertificate extends Certificate { /** * Signing Key extra data, if any, is first in the array. * Crypto Key extra data, if any, is second in the array, - * at offset max(0, 128 - getSigType().getPubkeyLen() + * at offset max(0, getSigType().getPubkeyLen() - 128) * * @return null if unset or none */ @@ -148,7 +148,7 @@ public class KeyCertificate extends Certificate { SigType type = getSigType(); if (type == null) throw new UnsupportedOperationException("unknown sig type"); - int extra = 128 - type.getPubkeyLen(); + int extra = Math.max(0, type.getPubkeyLen() - 128); if (_payload.length == HEADER_LENGTH + extra) return getExtraKeyData(); byte[] rv = new byte[extra]; -- GitLab