@@ -26,11 +26,9 @@ import COSE.HeaderKeys
2626import com.fasterxml.jackson.dataformat.cbor.databind.CBORMapper
2727import com.upokecenter.cbor.CBORObject
2828import dgca.verifier.app.decoder.base45.Base45Decoder
29- import dgca.verifier.app.decoder.cose.CoseService
3029import dgca.verifier.app.decoder.cwt.CwtHeaderKeys
3130import dgca.verifier.app.decoder.model.CoseData
3231import dgca.verifier.app.decoder.model.GreenCertificate
33- import java.time.Instant
3432import java.util.zip.InflaterInputStream
3533
3634@ExperimentalUnsignedTypes
@@ -88,10 +86,10 @@ class DefaultCertificateDecoder(private val base45Decoder: Base45Decoder) :
8886 val messageObject = CBORObject .DecodeFromBytes (this )
8987 val content = messageObject[2 ].GetByteString ()
9088 val rgbProtected = messageObject[0 ].GetByteString ()
91- var rgbUnprotected = messageObject[1 ];
89+ val rgbUnprotected = messageObject[1 ]
9290 val key = HeaderKeys .KID .AsCBOR ()
9391
94- if (! CBORObject .DecodeFromBytes (rgbProtected).keys.contains(key)) {
92+ if (! CBORObject .DecodeFromBytes (rgbProtected).keys.contains(key)) {
9593 val objunprotected = rgbUnprotected.get(key).GetByteString ()
9694 return CoseData (content, objunprotected)
9795 }
@@ -101,13 +99,6 @@ class DefaultCertificateDecoder(private val base45Decoder: Base45Decoder) :
10199
102100 private fun ByteArray.decodeGreenCertificate (): GreenCertificate ? {
103101 val map = CBORObject .DecodeFromBytes (this )
104-
105- val issuedAt = Instant .ofEpochSecond(map[CwtHeaderKeys .ISSUED_AT .asCBOR()].AsInt64 ())
106- if (issuedAt.isAfter(Instant .now())) throw IllegalArgumentException (" IssuedAt not correct: $issuedAt " )
107-
108- val expirationTime = Instant .ofEpochSecond(map[CwtHeaderKeys .EXPIRATION .asCBOR()].AsInt64 ())
109- if (expirationTime.isBefore(Instant .now())) throw IllegalArgumentException (" Expiration not correct: $expirationTime " )
110-
111102 val hcert = map[CwtHeaderKeys .HCERT .asCBOR()]
112103 val hcertv1 = hcert[CBORObject .FromObject (1 )].EncodeToBytes ()
113104
0 commit comments