# Certificate Helper
Certificate helper allows to easily create X509 certificate from user's wallet.
# Provided operations
Creates an X509 certificate using the given
keyPair
andwalletAddress
.fun x509certificateFromWallet( walletAddress: String, keyPair: KeyPair, digestAlgorithm: String = "SHA256withRSA" ): X509Certificate
1
2
3Return the PEM representation of the given
certificate
fun getPem(certificate: X509Certificate): String
1
# Usage examples
val info = NetworkInfo(
bech32Hrp = "did:com:",
lcdUrl = "http://localhost:1317"
)
val userMnemonic = listOf("will", "hard", ..., "man")
val userWallet = Wallet.derive(
mnemonic = userMnemonic,
networkInfo = info
)
val rsaKeyPair = KeysHelper.generateRsaKeyPair()
// Creating X509 self-signed certificate
val certificate = CertificateHelper.x509certificateFromWallet(
userWallet.bech32Address, rsaKeyPair.toKeyPair()
)
// Getting the PEM encoded certificate
val pemCertificate = CertificateHelper.getPem(certificate)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20