Blog Infos
Author
Published
Topics
,
Published
installCertificateTransparencyProvider()
The Problem with WebViews
TrustManager factories
val trustManagerFactory = TrustManagerFactory.getInstance(
    TrustManagerFactory.getDefaultAlgorithm()
)
trustManagerFactory.init(null as KeyStore?)
val x509TrustManager = trustManagerFactory
    .trustManagers
    .filterIsInstance<X509TrustManager>()
    .first()
val sslContext = SSLContext.getInstance("SSL")
sslContext.init(null, arrayOf(x509TrustManager), null)
val sslSocketFactory = sslContext.socketFactory
Introduction to Java security
Creating a TrustManagerFactory
public abstract class TrustManagerFactorySpi {
    protected abstract void engineInit(KeyStore ks);
    protected abstract void engineInit(ManagerFactoryParameters spec);

    protected abstract TrustManager[] engineGetTrustManagers();
}

Job Offers

Job Offers


    Senior Android Developer

    SumUp
    Berlin
    • Full Time
    apply now

    Senior Android Engineer

    Carly Solutions GmbH
    Munich
    • Full Time
    apply now

OUR VIDEO RECOMMENDATION

No results found.

Jobs

Installing a provider
class CTProvider : Provider("CT Provider", 1.0, "") {
    init {
        put("TrustManagerFactory.PKIX", CTTrustManagerFactory::class.java.name)
        put("Alg.Alias.TrustManagerFactory.X509", "PKIX")
    }
}

Then to activate our provider, all we need to do is create an instance and insert it in our preferred position. The position is 1-based; 1 is most preferred, followed by 2, etc.

Security.insertProviderAt(provider, 1)
Conclusions
installCertificateTransparencyProvider()

This article was originally published on proandroiddev.com on March 06, 2022

YOU MAY BE INTERESTED IN

YOU MAY BE INTERESTED IN

blog
👋 Hi and welcome to the third post in this series where we deep-dive…
READ MORE
blog
Protect your user’s privacy and adhere to possible technical requirements
READ MORE
blog
Security and privacy are the two most talked about topics these days. Like any…
READ MORE
blog
In this digital world, we want to stay connected with our friends and family.…
READ MORE

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.

Menu