* Streaming: Fix P521 and RSA sig types

This commit is contained in:
zzz
2014-08-27 22:43:44 +00:00
parent 387629372b
commit 588ab86abb
3 changed files with 14 additions and 5 deletions

View File

@ -104,7 +104,8 @@ public class Destination extends KeysAndCert {
}
/**
* deprecated, used only by Packet.java in streaming
* Deprecated, used only by Packet.java in streaming.
* Broken for sig types P521 and RSA before 0.9.15
* @return the written length (NOT the new offset)
*/
public int writeBytes(byte target[], int offset) {
@ -115,8 +116,9 @@ public class Destination extends KeysAndCert {
System.arraycopy(_padding, 0, target, cur, _padding.length);
cur += _padding.length;
}
System.arraycopy(_signingKey.getData(), 0, target, cur, _signingKey.length());
cur += _signingKey.length();
int spkTrunc = Math.min(SigningPublicKey.KEYSIZE_BYTES, _signingKey.length());
System.arraycopy(_signingKey.getData(), 0, target, cur, spkTrunc);
cur += spkTrunc;
cur += _certificate.writeBytes(target, cur);
return cur - offset;
}