encodeToString
Encodes this document into a String in PEM format
The output uses the form:
-----BEGIN {label}-----
Base64-encoded {content} with line breaks every 64 characters
-----END {label}-----Content copied to clipboard
Return
the PEM-encoded string
Samples
val document = PemDocument(
label = PemLabel("CUSTOM"),
content = "hello world".encodeToByteString(),
)
val encoded = document.encodeToString()
assertEquals(
expected = """
-----BEGIN CUSTOM-----
aGVsbG8gd29ybGQ=
-----END CUSTOM-----
""".trimIndent(),
actual = encoded
)Content copied to clipboard