io.github.binaryfoo.crypto.CaPublicKeyTable.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of emv-bertlv Show documentation
Show all versions of emv-bertlv Show documentation
Some decoders for the data used in EMV credit card transactions.
package io.github.binaryfoo.crypto
import io.github.binaryfoo.res.ClasspathIO
import org.apache.commons.io.IOUtils
import java.io.IOException
import java.io.InputStream
import java.util.ArrayList
import kotlin.platform.platformStatic
public class CaPublicKeyTable {
class object {
public val keys: List = ClasspathIO.readLines("ca-public-keys.txt").map { line ->
try {
val fields = line.split("\\t")
val exponent = fields[1]
val index = fields[2]
val rid = fields[3]
val modulus = fields[4]
CaPublicKey(rid, index, exponent, modulus)
} catch(e: Exception) {
throw RuntimeException("Failed reading CA public key: ${line}", e)
}
}
platformStatic public fun getEntry(aid: String, index: String): CaPublicKey? = keys.firstOrNull { it.rid == aid && it.index == index }
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy