Skip to content
Snippets Groups Projects
Unverified Commit cac2df7a authored by Matthias Urhahn's avatar Matthias Urhahn Committed by GitHub
Browse files

Base structures for decoding/decrypting the test certificate. (#3335)

parent db83ce16
No related branches found
No related tags found
No related merge requests found
package de.rki.coronawarnapp.covidcertificate.cryptography
import dagger.Reusable
import okio.ByteString
import javax.inject.Inject
@Reusable
class AesCryptography @Inject constructor() {
fun decrypt(
decryptionKey: ByteArray,
encryptedData: ByteString
): ByteArray {
throw NotImplementedError()
}
}
package de.rki.coronawarnapp.covidcertificate.test
import de.rki.coronawarnapp.vaccination.core.certificate.CoseCertificateHeader
data class TestCertificateData(
val header: CoseCertificateHeader,
val certificate: TestCertificateDccV1,
)
package de.rki.coronawarnapp.covidcertificate.test
import com.google.gson.annotations.SerializedName
import org.joda.time.Instant
import org.joda.time.LocalDate
data class TestCertificateDccV1(
@SerializedName("ver") val version: String,
@SerializedName("nam") val nameData: NameData,
@SerializedName("dob") val dob: String,
@SerializedName("v") val testCertificateData: List<TestCertificateData>,
) {
data class NameData(
@SerializedName("fn") val familyName: String?,
@SerializedName("fnt") val familyNameStandardized: String,
@SerializedName("gn") val givenName: String?,
@SerializedName("gnt") val givenNameStandardized: String?,
)
data class TestCertificateData(
// Disease or agent targeted, e.g. "tg": "840539006"
@SerializedName("tg") val targetId: String,
// Vaccine or prophylaxis, e.g. "vp": "1119349007"
@SerializedName("vp") val vaccineId: String,
// Vaccine medicinal product,e.g. "mp": "EU/1/20/1528",
@SerializedName("mp") val medicalProductId: String,
// Marketing Authorization Holder, e.g. "ma": "ORG-100030215",
@SerializedName("ma") val marketAuthorizationHolderId: String,
// Date/Time of Sample Collection (required)
// "sc": "2021-04-13T14:20:00+00:00",
@SerializedName("sc") val sampleCollectedAt: Instant,
// Date/Time of Test Result
// "dr": "2021-04-13T14:40:01+00:00",
@SerializedName("dr") val testResultAt: Instant,
// Testing Center (required)
// "tc": "GGD Fryslân, L-Heliconweg",
@SerializedName("tc") val testCenter: String,
// Country of Vaccination, e.g. "co": "NL"
@SerializedName("co") val countryOfVaccination: String,
// Certificate Issuer, e.g. "is": "Ministry of Public Health, Welfare and Sport",
@SerializedName("is") val certificateIssuer: String,
// Unique Certificate Identifier, e.g. "ci": "urn:uvci:01:NL:PlA8UWS60Z4RZXVALl6GAZ"
@SerializedName("ci") val uniqueCertificateIdentifier: String
)
val dateOfBirth: LocalDate
get() = LocalDate.parse(dob)
}
package de.rki.coronawarnapp.covidcertificate.test
data class TestCertificateQRCode(
val qrCode: String,
val testCertificateData: TestCertificateData,
)
package de.rki.coronawarnapp.covidcertificate.test
import dagger.Reusable
import okio.ByteString
import javax.inject.Inject
@Reusable
class TestCertificateQRCodeExtractor @Inject constructor() {
/**
* May throw an **[InvalidHealthCertificateException]**
*/
fun extract(
decryptionKey: ByteArray,
encryptedCoseComponents: ByteString,
): TestCertificateData {
throw NotImplementedError()
}
/**
* May throw an **[InvalidHealthCertificateException]**
*/
fun extract(qrCode: String): TestCertificateQRCode {
throw NotImplementedError()
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment