7 ## get certificate metadata for the filename
8 my $msg = $context->{client}->send_receive_command_msg(
11 IDENTIFIER => $identifier,
14 my $subject = $msg->{PARAMS}->{BODY}->{SUBJECT};
15 my $dn = OpenXPKI::DN->new($subject);
16 my %dn_hash = $dn->get_hashed_content();
18 if (exists $dn_hash{'CN'} && ref $dn_hash{'CN'} eq 'ARRAY') {
19 # by default, use the CN of the certificate for the filename
20 $filename = $dn_hash{'CN'}->[0];
23 # no CN found, just use the identifier
24 $filename = $identifier;
28 $filename = URI::Escape::uri_escape_utf8($filename);
31 $filename .= '_chain';
34 $filename .= '.' . $extension;