Package io.ktor.network.tls.certificates

Types

Link copied to clipboard
class CertificateBuilder

Builder for certificate

Link copied to clipboard
class KeyStoreBuilder

Builder for key store

Link copied to clipboard
enum KeyType : Enum<KeyType>

Functions

Link copied to clipboard
fun buildKeyStore(block: KeyStoreBuilder.() -> Unit): KeyStore

Create a keystore and configure it in block function

Link copied to clipboard
fun generateCertificate(file: File? = null, algorithm: String = "SHA1withRSA", keyAlias: String = "mykey", keyPassword: String = "changeit", jksPassword: String = keyPassword, keySizeInBits: Int = 1024, keyType: KeyType = KeyType.Server): KeyStore

Generates simple self-signed certificate with keyAlias name, private key is encrypted with keyPassword. If file is set, the key is stored in a JKS keystore in file with jksPassword.

fun KeyStore.generateCertificate(file: File? = null, algorithm: String = "SHA1withRSA", keyAlias: String = "mykey", keyPassword: String = "changeit", jksPassword: String = keyPassword, keySizeInBits: Int = 1024, caKeyAlias: String = "mykey", caPassword: String = "changeit", keyType: KeyType = KeyType.Server): KeyStore

Uses the given keystore as certificate CA caKeyAlias to generate a signed certificate with keyAlias name.

Link copied to clipboard
fun KeyStore.saveToFile(output: File, password: String)

Save KeyStore to output file with the specified password

Link copied to clipboard
fun KeyStore.trustStore(file: File? = null, password: CharArray = "changeit".toCharArray()): KeyStore

Extracts all certificates from the given KeyStore to use these certificates as a valid TrustStore.

Properties

Link copied to clipboard
val KeyStore.trustManagers: List<TrustManager>