-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix expiration * hcert kotlin update * fix backend issuing for hcert kotlin 1.0.1 * fix checkstyle
- Loading branch information
Showing
13 changed files
with
191 additions
and
151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,6 @@ | |
@Data | ||
public class EgdcCodeData { | ||
String dgci; | ||
String qrcCode; | ||
String qrCode; | ||
String tan; | ||
} |
49 changes: 0 additions & 49 deletions
49
src/main/java/eu/europa/ec/dgc/issuance/service/ConfigurableCborService.java
This file was deleted.
Oops, something went wrong.
43 changes: 43 additions & 0 deletions
43
src/main/java/eu/europa/ec/dgc/issuance/service/ConfigurableCwtService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package eu.europa.ec.dgc.issuance.service; | ||
|
||
import com.upokecenter.cbor.CBORObject; | ||
import ehn.techiop.hcert.kotlin.chain.CwtService; | ||
import ehn.techiop.hcert.kotlin.chain.VerificationResult; | ||
import ehn.techiop.hcert.kotlin.crypto.CwtHeaderKeys; | ||
import ehn.techiop.hcert.kotlin.data.GreenCertificate; | ||
import eu.europa.ec.dgc.issuance.config.IssuanceConfigProperties; | ||
import kotlinx.serialization.json.Json; | ||
import lombok.RequiredArgsConstructor; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
public class ConfigurableCwtService implements CwtService { | ||
private final ExpirationService expirationService; | ||
private final IssuanceConfigProperties issuanceConfigProperties; | ||
|
||
@NotNull | ||
@Override | ||
public byte[] decode(@NotNull byte[] bytes, @NotNull VerificationResult verificationResult) { | ||
throw new UnsupportedOperationException("decoding not supported"); | ||
} | ||
|
||
@NotNull | ||
@Override | ||
public byte[] encode(@NotNull byte[] bytes) { | ||
CBORObject cwtMap = CBORObject.NewMap(); | ||
cwtMap.Add(CwtHeaderKeys.ISSUER.getIntVal(), issuanceConfigProperties.getCountryCode()); | ||
CBORObject dcc = CBORObject.DecodeFromBytes(bytes); | ||
GreenCertificate greenCertificate = Json.Default.decodeFromString(GreenCertificate.Companion.serializer(), | ||
dcc.ToJSONString()); | ||
ExpirationService.CwtTimeFields cwtTimes = expirationService.calculateCwtExpiration(greenCertificate); | ||
|
||
cwtMap.Add(CwtHeaderKeys.ISSUED_AT.getIntVal(), cwtTimes.issuedAt); | ||
cwtMap.Add(CwtHeaderKeys.EXPIRATION.getIntVal(), cwtTimes.expiration); | ||
CBORObject hcertMap = CBORObject.NewMap(); | ||
hcertMap.Add(CwtHeaderKeys.EUDGC_IN_HCERT.getIntVal(),dcc); | ||
cwtMap.Add(CwtHeaderKeys.HCERT.getIntVal(), hcertMap); | ||
return cwtMap.EncodeToBytes(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.