fix: Do not crash if a certificate key ID is not known
Some checks failed
/ build-debug (push) Successful in 3m25s
/ release (push) Failing after 2m2s

Fixes #17.
This commit is contained in:
Peter Cai 2024-03-04 20:07:26 -05:00
parent 09e19412e3
commit ca0085e147

View file

@ -8,7 +8,7 @@ import java.security.cert.CertificateFactory
const val DEFAULT_PKID_GSMA_RSP2_ROOT_CI1 = "81370f5125d0b1d408d4c3b232e6d25e795bebfb"
private fun getCertificate(keyId: String): Certificate? =
KNOWN_CI_CERTS[keyId]?.toByteArray().let { cert ->
KNOWN_CI_CERTS[keyId]?.toByteArray()?.let { cert ->
ByteArrayInputStream(cert).use { stream ->
val cf = CertificateFactory.getInstance("X.509")
cf.generateCertificate(stream)