Skip to content

Commit

Permalink
fix return value for cms migration of signer information (#165)
Browse files Browse the repository at this point in the history
Co-authored-by: Felix Dittrich <[email protected]>
  • Loading branch information
bergmann-dierk and f11h authored Mar 21, 2022
1 parent ef805c9 commit 7f1db2e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ public List<CmsPackageDto> getCmsPackage(String country) {
return signerInformationRepository
.getByCertificateTypeAndCountry(SignerInformationEntity.CertificateType.DSC, country)
.stream()
.map(it -> new CmsPackageDto(it.getRawData(), it.getId(), CmsPackageDto.CmsPackageTypeDto.DSC))
.map(it -> new CmsPackageDto(it.getSignature(), it.getId(), CmsPackageDto.CmsPackageTypeDto.DSC))
.collect(Collectors.toList());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ void testAllCertTypes() throws Exception {
X509Certificate certDscEu = CertificateTestUtils.generateCertificate(keyPairGenerator.generateKeyPair(), countryCode, "Test");
String cmsBase64 = Base64.getEncoder().encodeToString(certDscEu.getEncoded());

createSignerInfo(cmsBase64, certDscEu);
createSignerInfo(cmsBase64, certDscEu, "signature1");
createRevocation(cmsBase64);
createValidationEntry(cmsBase64);

Expand All @@ -133,8 +133,11 @@ void testAllCertTypes() throws Exception {
.header(dgcConfigProperties.getCertAuth().getHeaderFields().getDistinguishedName(), authCertSubject))
.andExpect(jsonPath("$", hasSize(3)))
.andExpect(jsonPath("$[0].type", is(CmsPackageDto.CmsPackageTypeDto.DSC.name())))
.andExpect(jsonPath("$[0].cms", is("signature1")))
.andExpect(jsonPath("$[1].type", is(CmsPackageDto.CmsPackageTypeDto.REVOCATION_LIST.name())))
.andExpect(jsonPath("$[2].type", is(CmsPackageDto.CmsPackageTypeDto.VALIDATION_RULE.name())));
.andExpect(jsonPath("$[1].cms", is(cmsBase64)))
.andExpect(jsonPath("$[2].type", is(CmsPackageDto.CmsPackageTypeDto.VALIDATION_RULE.name())))
.andExpect(jsonPath("$[2].cms", is(cmsBase64)));
}

@Test
Expand Down Expand Up @@ -597,10 +600,10 @@ void testUpdateRevocationWrongCountry() throws Exception {
.andExpect(jsonPath("$.code", is("0x021")));
}

private void createSignerInfo(final String cmsBase64, final X509Certificate certDscEu) {
private void createSignerInfo(final String cmsBase64, final X509Certificate certDscEu, final String signature) {
signerInformationRepository.save(new SignerInformationEntity(
null, ZonedDateTime.now(), countryCode, certificateUtils.getCertThumbprint(certDscEu),
cmsBase64, "sig1", SignerInformationEntity.CertificateType.DSC
cmsBase64, signature, SignerInformationEntity.CertificateType.DSC
));
}

Expand Down

0 comments on commit 7f1db2e

Please sign in to comment.