Commit c6af8f1c authored by calocedre TAC's avatar calocedre TAC
Browse files

fix location message encryption and qr-code start time set

parent 1a8135ec
Pipeline #226143 failed with stage
in 1 minute and 39 seconds
......@@ -85,7 +85,7 @@ public class Location {
}
protected byte[] getLocationSpecificPartEncrypted() throws CleaEncryptionException {
if (this.locationSpecificPart.isLocationContactMessagePresent()) {
if (Objects.nonNull(this.contact)) {
this.locationSpecificPart.setEncryptedLocationContactMessage(this.getLocationContactMessageEncrypted());
}
return new LocationSpecificPartEncoder(this.serverAuthorityPublicKey).encode(locationSpecificPart);
......@@ -107,7 +107,8 @@ public class Location {
}
protected void setQrCodeValidityStartTime(int periodStartTime, int qrCodeValidityStartTime) {
if (this.locationSpecificPart.getQrCodeRenewalInterval() == 0) {
if ((this.locationSpecificPart.getQrCodeRenewalInterval() == 0)
&& (this.locationSpecificPart.getQrCodeValidityStartTime() != 0)) {
log.warn("Cannot update QrCode validity start time. No renewal specified!");
return;
}
......
......@@ -138,10 +138,12 @@ class LocationSpecificPartTest {
/* Encode a LSP with location */
String encryptedLocationSpecificPart = location.getLocationSpecificPartEncryptedBase64();
assertThat(encryptedLocationSpecificPart).isNotNull();
/* Decode the encoded LSP */
LocationSpecificPart decodedLsp = new LocationSpecificPartDecoder(serverAuthorityKeyPair[0]).decrypt(encryptedLocationSpecificPart);
assertThat(decodedLsp).isEqualTo(lsp);
assertThat(lsp.getEncryptedLocationContactMessage()).isNotNull();
}
@Test
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment