PEM formatted string
Optional sHead: stringPEM header string without BEGIN/END
base64 string in the first PEM
This static method gets a Base64 string of contents from PEM format data. As for the "pem", some garbled text before and after the PEM header also be acceptable. When two or more PEMs are included, the first one will be returned.
pemtob64("-----BEGIN CERTIFICATE...", "CERTIFICATE") -> "MIIBvTCC..."
pemtob64("-----BEGIN CERTIFICATE...", "CERTIFICATE") -> "MIIBvTCC..."
pemtob64("-----BEGIN CERTIFICATE...") -> "MIIBvTCC..."
pem2 = `
junk-text
-----BEGIN FOO----
YWFh
-----BEGIN FOO----
junk-text
-----BEGIN BOO BOO----
enp6
-----BEGIN BOO BOO----
junk-text
`
pemtob64(pem2) -> "YWFh"
get Base64 string from PEM format data