NAME
Crypt::Bear::PEM - A decoder for PEM
VERSION
version 0.002
SYNOPSIS
my
@raw_certs
;
my
@input
= pem_decode(
$input
);
while
(
my
(
$banner
,
$payload
) =
splice
@input
, 0, 2) {
push
@raw_certs
,
$payload
if
$banner
=~ /CERTIFICATE/;
}
for
my
$raw_cert
(
@raw_certs
) {
$out
pem_encode(
'CERTIFICATE'
,
$raw_cert
);
}
DESCRIPTION
This class contains two functions pem_decode
to decode PEM, and pem_encode
to encode PEM. Both are optionally exported.
FUNCTIONS
pem_decode($data)
This will decode the data, and return it as $banner, $payload
pairs.
If you need to decode asynchronously, see Crypt::Bear::PEM::Decoder.
pem_encode($banner, $data, @flags)
This PEM encodes some piece of $data
with the given $banner
. If flags are given they will affect the output. Valid values are:
'line64'
If set, line-breaking will occur after every 64 characters of output, instead of the default of 76
'crlf'
If set, end-of-line sequence will use CR+LF instead of a single LF.
AUTHOR
Leon Timmermans <fawaka@gmail.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2024 by Leon Timmermans.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.