This library provides PEM format file parser.
Currently only supports RFC 1421 format.
This library defines these conditions.
Super condition of all PEM file process related conditions.
This condition indicates, given PEM file contains invalid format.
Returns #t, if the given obj is &invalid-pem-format
,
otherwise #f.
This condition indicates, given PEM file contains Pre-Encapsulation
Boundary as the end of Encapsulated Message without specifying
:multiple
.
Returns #t, if the given obj is &pre-eb-as-boundary
,
otherwise #f.
in must be textual input port.
Parses given input port in and returns 2 values, parameter alist and decoded bytevector.
Keyword arguments
multiple
When this keyword argument is #t, then the procedure returns a list which contains alist of parameter and content. This parameter is useful for the PEM files which contains multiple contents.
builder
This keyword argument must take a procedure which accept one argument or #f. If builder is specified then the given procedure will be called to build then contents of the PEM. This argument is not correspond with asn1 keyword argument and has higher priority. So if both arguments are specified, then builder will be used.
asn1
When this keyword argument is #t, then the procedure converts BASE64
bytevector to ASN.1 object defined in (asn.1)
library.
decorder
When this keyword argument is specified, it must be a procedure which
accepts one argument, then the parse-pem
uses the specified
procedure to convert body of the PEM content.
If it's not specified, the procedure uses BASE64 decoding.
The procedure may raise following conditions:
&invalid-pem-format
When given in contains invalid PEM format.
&pre-eb-as-boundary
When given in contains Pre-Encapsulation Boundary as the end of
Encapsulated Message and :multiple
is #f.
For example:
-----BEGIN FOO-----
... foo value ...
-----BEGIN BAR-----
... bar value...
-----END BAR-----
parsing PEM like above must specify :multiple
with true value.
Otherwise, &pre-eb-as-boundary
is signaled.
Convenient procedures.
Parse given file and PEM string, respectively.
option will be passed to the parse-pem
.