This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package ru.starksoft.core.utils.ext | |
| private const val TAG = "BundleExt" | |
| /** | |
| * Type-safe replacement for the deprecated [androidx.core.os.bundleOf]. | |
| * | |
| * Unlike the AndroidX version which accepts `Pair<String, Any?>` and may crash at runtime | |
| * on unsupported types (e.g. `SparseArray`), these overloads constrain the value type at | |
| * compile time. Use one overload per call — all pairs in a single invocation must share |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| KeyStore keyStore = KeyStore.getInstance("PKCS12"); | |
| FileInputStream clientCertificateContent = new FileInputStream("/path/to/publicAndPrivateKey.p12"); | |
| keyStore.load(clientCertificateContent, "private key password".toCharArray()); | |
| KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); | |
| keyManagerFactory.init(keyStore, "private key password".toCharArray()); | |
| FileInputStream myTrustedCAFileContent = new FileInputStream("/path/to/embedded/CA-Chain.pem"); | |
| CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); | |
| X509Certificate myCAPublicKey = (X509Certificate) certificateFactory.generateCertificate(myTrustedCAFileContent); |