I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit ba5af15c authored by str4d's avatar str4d
Browse files

Fix KeyCert bug

parent 9af197e5
No related branches found
No related tags found
No related merge requests found
...@@ -122,7 +122,7 @@ public class KeyCertificate extends Certificate { ...@@ -122,7 +122,7 @@ public class KeyCertificate extends Certificate {
/** /**
* Signing Key extra data, if any, is first in the array. * Signing Key extra data, if any, is first in the array.
* Crypto Key extra data, if any, is second 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 * @return null if unset or none
*/ */
...@@ -148,7 +148,7 @@ public class KeyCertificate extends Certificate { ...@@ -148,7 +148,7 @@ public class KeyCertificate extends Certificate {
SigType type = getSigType(); SigType type = getSigType();
if (type == null) if (type == null)
throw new UnsupportedOperationException("unknown sig type"); 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) if (_payload.length == HEADER_LENGTH + extra)
return getExtraKeyData(); return getExtraKeyData();
byte[] rv = new byte[extra]; byte[] rv = new byte[extra];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment