io.sureshg.extn / kotlin.String / decodePEM

decodePEM

fun String.decodePEM(): ByteArray

Decodes a PEM-encoded block to DER. PEM (Privacy-enhanced Electronic Mail) is Base64 encoded DER certificate, enclosed between "-----BEGIN CERTIFICATE-----" and "-----END CERTIFICATE-----". The string, according to RFC 1421, can only contain characters in the base-64 alphabet and whitespaces. ToDo - Replace with PemReader.

Return
the decoded bytes