Rainer Weikusat
unread,Apr 14, 2022, 2:52:40 PM4/14/22You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
Assuming that $chain holds the text of a usual certificate chain file,
ie, multiple certificates concatenated, the expression
$chain =~ /(.+?-----END CERTIFICATE-----\n)/gs
will return a list of individual certificates. That's equivalent to a
loop like
my (@certs, $cert);
for (split(/\n/, $chain)) {
$cert .= "$_\n";
if ($_ eq '-----END CERTIFICATE-----') {
push(@certs, $cert);
$cert = '';
}
}
without having to spell out any of the mechanics. Pretty close to "Do
what I mean!" :-)