Merge branch '190-key-manager-duplicates' into 'master'

Fix off-by-one error in key rotation

Fixes #190.

See merge request !32
This commit is contained in:
str4d
2015-12-23 19:41:21 +00:00
2 changed files with 7 additions and 1 deletions

View File

@@ -11,6 +11,12 @@ public class TransportKeys {
public TransportKeys(TransportId transportId, IncomingKeys inPrev,
IncomingKeys inCurr, IncomingKeys inNext, OutgoingKeys outCurr) {
if (inPrev.getRotationPeriod() != inCurr.getRotationPeriod() - 1)
throw new IllegalArgumentException();
if (inNext.getRotationPeriod() != inCurr.getRotationPeriod() + 1)
throw new IllegalArgumentException();
if (outCurr.getRotationPeriod() != inCurr.getRotationPeriod())
throw new IllegalArgumentException();
this.transportId = transportId;
this.inPrev = inPrev;
this.inCurr = inCurr;