Skip to content

Instantly share code, notes, and snippets.

View imuromtsev's full-sized avatar

Ilya Muromtsev imuromtsev

View GitHub Profile
@imuromtsev
imuromtsev / self-signed-certificate-with-custom-ca.md
Last active May 21, 2024 20:46 — forked from fntlnz/self-signed-certificate-with-custom-ca.md
Self Signed Certificate with Custom Root CA

Create Root CA (Done once)

Prerequisites

Instruction was made for openssl 3.2.1

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

package ru.spbsu.kotlin
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.channels.ReceiveChannel
import kotlinx.coroutines.channels.produce
import kotlinx.coroutines.newSingleThreadContext
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.withContext
import java.io.File
import java.io.InputStream