Skip to content

common‐lib

Boriss Melikjan edited this page Sep 9, 2025 · 1 revision

Shared classes for other libraries.

Parse certificate policies to get the EID type

val certificateData: ByteArray = ...

val certificate = X509CertificateHolder(certificateData)
val extensions = certificate.getExtensions()
val certificatePolicies = CertificatePolicies.fromExtensions(extensions)

val type: EIDType? = EIDType.parse(certificatePolicies)

Everything the Android application needs from a certificate is contained in Certificate and ExtendedCertificate class

val certificateData: ByteArray  = ...
val certificate: ExtendedCertificate = ExtendedCertificate.create(certificateData, certificateService)

// EID type
val type: EIDType? = certificate.type

// CN field from the certificate
val friendlyName: String? = certificate.friendlyName

// whether it is an elliptic curve certificate
val ellipticCurve: Boolean = certificate.ellipticCurve

// get key usage and extended key usage from the certificate
// for example crypto-lib uses these to filter recipient results
val keyUsage: KeyUsage? = certificate.keyUsage
val extendedKeyUsage: ExtendedKeyUsage? = certificate.extendedKeyUsage

// get the certificate bytes
val data: ByteArray? = certificate.data
Clone this wiki locally