Data: Ensure RouterIdent padding is compressed when read in

Did not affect most Destination creation code paths because they
are generally created via Destination.create(), not via readBytes(InputStream)

Add new more efficient method to indicate if padding was compressed
This commit is contained in:
zzz
2025-02-07 10:54:14 -05:00
parent f1e95d96b3
commit ceba7f290e

View File

@ -147,6 +147,14 @@ public class KeysAndCert extends DataStructureImpl {
_padding = padding;
compressPadding();
}
/**
* Is there compressible padding?
* @since 0.9.66
*/
public boolean isCompressible() {
return _paddingBlocks > 1;
}
/**
* @throws IllegalStateException if data already set
@ -165,6 +173,7 @@ public class KeysAndCert extends DataStructureImpl {
byte[] pad1 = pk.getPadding(kcert);
byte[] pad2 = spk.getPadding(kcert);
_padding = combinePadding(pad1, pad2);
compressPadding();
_certificate = kcert;
} else {
_publicKey = pk;