Skip to content

Commit

Permalink
Bugfix for Additional Data (#58)
Browse files Browse the repository at this point in the history
* testcase for Additional Data added, Bugfix in Class

* Update QrCodeTests.kt
  • Loading branch information
SchulzeStTSI authored Aug 26, 2021
1 parent 3f7c1ed commit b94fce4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@

package dgca.verifier.app.decoder.model

import com.fasterxml.jackson.annotation.JsonIgnoreProperties
import com.fasterxml.jackson.annotation.JsonProperty
import java.io.Serializable
import java.util.*

/**
* CBOR structure of the certificate
*/
@JsonIgnoreProperties(ignoreUnknown = true)
data class GreenCertificate(

@JsonProperty("ver")
Expand Down
15 changes: 14 additions & 1 deletion decoder/src/test/java/dgca/verifier/app/decoder/QrCodeTests.kt
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,19 @@ class QrCodeTests {
assertTrue(verify(hCert, pubkey))
}

@Test
fun testAdditionalData() {
val hCert =
"HC1:6BFOXN%TSMAHN-HWWK2J2YWO4VKY.R/R8K4T4FCCJ9P9MXKCIL9L514:O1T2B0E/GPWBI*EDUDBQEAJJKKKMEC8.-BP7U3-SY\$N- RE09+K3C.1X31SZJ:A45OI9YI:8D+FD%PD5DL3ADHABVCNAHLW 70SO:GOLIROGO3T59YLLYP-HQLTQ9R0+L67PPDFPVX1R270:6NEQ0R6AOM*PP:+P*.1D9R+Q6646C%6RF6VY9UKP-G9++9SH9WC5ME62H1KD3*I01JAF.7Y%HZJJ0W2D4OYGFO-O%Z8JH1PCDJ*3TFH2V4LC1GLOOIFMEH3NV%JLYE93JJTD8V.D ECO/A*5UP:H26Q.2QQ0MWZJZSJUOIZS4X355Y1NXO.%SG-T1SMHSUMF2OH61OA0:VXE5N74/VJND3LVGM334HGD+3/*JLDFYIH6.OOXTB+VMREQJAXQQOPGB+HXY9.RIDSH5H9SH9/E1R:LT1V490EHJZJL/0KD1L6XJ:OS SQI3TGGEPGBO4E05QCI6*3K-LCL*7%9VHSS:*3KUJN:C2GE2GS79KALPNVDSHRE\$QK2PPBV+HHUKS/IU6MH3HEW2T0PLR8M.JPPXA30TQAJ"
val base45Decoder = Base45Decoder()
val decoder = DefaultCertificateDecoder(base45Decoder)
val result = decoder.decodeCertificate(hCert)
assertTrue(result is CertificateDecodingResult.Success)
val pubkey =
"MIICfzCCAiSgAwIBAgIJAInLHHNtUCCaMAoGCCqGSM49BAMCMGsxCzAJBgNVBAYTAlNHMRIwEAYDVQQIDAlTaW5nYXBvcmUxJTAjBgNVBAoMHEdvdmVybm1lbnQgVGVjaG5vbG9neSBBZ2VuY3kxITAfBgNVBAMMGGNzY2Euc3RhZ2luZy5ub3RhcmlzZS5pbzAeFw0yMTA4MjQxMDM0MDFaFw0yMzA4MjQxMDM0MDFaMF8xCzAJBgNVBAYTAlNHMRIwEAYDVQQIDAlTaW5nYXBvcmUxGzAZBgNVBAoMEk1pbmlzdHJ5IE9mIEhlYWx0aDEfMB0GA1UEAwwWZHNjLnN0YWdpbmcubW9oLmdvdi5zZzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABHppW+8K1L9XNmHnuehezl3JnvMKo3OFuclEaefGVbuTBrp2oYDE7vB91nm3ZqpR6tL/1I5IdZvr+TXYg1+wll6jgbwwgbkwDgYDVR0PAQH/BAQDAgeAMB0GA1UdDgQWBBRsCO6wnLBmqzoP0Py+G99vwOyHKzAfBgNVHSMEGDAWgBRw8Z6F7tNUNI+w2qkyzRBQdF8mzDA1BgNVHR8ELjAsMCqgKKAmhiRodHRwczovL3N0YWdpbmcubm90YXJpc2UuaW8vY3NjYS5jcmwwMAYDVR0lBCkwJwYLKwYBBAGON49lAQEGCysGAQQBjjePZQECBgsrBgEEAY43j2UBAzAKBggqhkjOPQQDAgNJADBGAiEA7d5fnIuMeTl8c+sRpRKY9+3dKfLQ3nWj+paMsIhwKXMCIQDJ4xK9gyxaEnBIOj7FX1g20MloicdfPc2pximZbOrbEg=="
assertTrue(verify(hCert, pubkey))
}

@Test
fun testTaggedJsonCreation() {
val hCert =
Expand All @@ -151,4 +164,4 @@ class QrCodeTests {
Assert.fail()
}
}
}
}

0 comments on commit b94fce4

Please sign in to comment.