NAME
Crypt::Bear::PEM::Decoder - A decoder for PEM
VERSION
version 0.002
SYNOPSIS
my $decoder = Crypt::Bear::PEM::Decoder->new(sub {
my ($banner, $payload) = @_;
push @certs, $payload if $banner =~ /CERTIFICATE/;
});
while(<>) {
$decoder->push($_);
}
die "PEM file was truncated" if $decoder->entry_in_progress;
DESCRIPTION
This implements a streaming PEM decoder. In most cases you'll want the non-streaming pem_decode
function in Crypt::Bear::PEM.
METHODS
new($callback)
This creates a new decoder, and sets a callback that will be called whenever an entry has completed.
push($data)
This pushes data to the decoder, potentially causing the callback to be called.
entry_in_progress()
This returns true if the decoder is half-way decoding an entry. This should be false at the end of a PEM stream.
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.