Skip to content

Commit

Permalink
BD-1730: Legge til krypteringsnøkkelversjon ved henting av eksisteren…
Browse files Browse the repository at this point in the history
…de blob (#558)
  • Loading branch information
s148719 authored Oct 4, 2023
1 parent a2bb6b8 commit 2e93ddc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -286,14 +286,10 @@ public FarskapserklaeringDto oppdatereStatusSigneringsjobb(
idFarskapserklaering, statusQueryToken, fnrPaaloggetPerson);
}

var forelderrolle = personopplysningService.bestemmeForelderrolle(fnrPaaloggetPerson);
var forelder = persistenceService.henteForelderForIdent(fnrPaaloggetPerson);

log.error(
"Fant ikke farskapserklæring med id {} i databasen for person med forelderrolle {} og forelderid {}.",
SIKKER_LOGG.error(
"Fant ikke farskapserklæring med id {} i databasen for person med personident {}.",
idFarskapserklaering,
forelderrolle,
forelder.isPresent() ? forelder.get().getId() : "ukjent");
fnrPaaloggetPerson);

throw new RessursIkkeFunnetException(Feilkode.FANT_IKKE_FARSKAPSERKLAERING);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public Optional<BlobIdGcp> getExistingBlobIdGcp(String bucket, String documentNa
: Optional.of(
BlobIdGcp.builder()
.bucket(blobId.get().getBucket())
.encryptionKeyVersion(gcpStorageManager.getEncryptionKeyVersion())
.name(blobId.get().getName())
.generation(blobId.get().getGeneration())
.build());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ public boolean deleteContentFromBucket(String bucketName, String documentName) {
return storage.delete(BlobId.of(bucketName, documentName));
}

public int getEncryptionKeyVersion() {
return encryptionProvider.getKeyVersion();
}

private byte[] decryptFile(byte[] file, BlobInfo blobInfo) throws GeneralSecurityException {

// Based on example from https://cloud.google.com/kms/docs/client-side-encryption
Expand Down

0 comments on commit 2e93ddc

Please sign in to comment.