<?xml version="1.0" encoding="windows-1252"?>
<node id="971408" title="Iterated prompt handling" created="2012-05-19 04:54:31" updated="2012-05-19 04:54:31">
<type id="115">
perlquestion</type>
<author id="914549">
vaibhav07</author>
<data>
<field name="doctext">
&lt;c&gt;Please enter Certificate: Press &lt;Enter&gt; when done
-----BEGIN CERTIFICATE-----
MIIFtjCCBJ6gAwIBAgIQIFUz8E8mut6Vrn5LtX6fujANBgkqhkiG9w0BAQUFADBi
IPFnu2NdIr8HG9qX9exCghK4VUD7Dk6CdCY=
-----END CERTIFICATE-----

Please enter Private Key: Press &lt;Enter&gt; when done
-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEAyyRe6tHM1zq+rZk8DSX9ej1u17sCVydi6ijkzdYTTUth6fmN
-----END CERTIFICATE-----

Please enter certificates of Certification Authorities (CA) which form the
certificate chain of the server certificate. This starts with the issuing CA
certificate of the server certificate and can range up to the root CA
certificate.

Do you want to continue entering root and/or intermediate certificates
{y|n}: y

Please enter Intermediate Certificate: Press &lt;Enter&gt; when done
-----BEGIN CERTIFICATE-----
MIIENjCCAx6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBvMQswCQYDVQQGEwJTRTEU
-----END CERTIFICATE-----

Do you want to continue entering root and/or intermediate certificates
{y|n}: y

Please enter Intermediate Certificate: Press &lt;Enter&gt; when done
-----BEGIN CERTIFICATE-----
ZFRydXN0IEV4dGVybmFsIFRUUCBOZXR3b3JrMSIwIAYDVQQDExlBZGRUcnVzdCBF
-----END CERTIFICATE-----

Do you want to continue entering root and/or intermediate certificates
{y|n}: n&lt;/c&gt;

&lt;c&gt;Code used : 
my $certificate      = $opts{certificate};
my $private_key      = $opts{'private-key'};
my $intermediate_key = $opts{'intermediate-key'};
$prompt_answers = [
            'Please enter Certificate:.*' =&gt; $certificate,
            'Please enter Private Key:.*' =&gt; $private_key,
            'Please enter certificates of Certification Authorities.*' =&gt;
                ( defined $intermediate_key ) ? $intermediate_key : 'n',
        ];
This code was effective till the response passed was 'n' for prompt 'Do you want to continue entering root and/or intermediate certificates', but not effective if the intermediate certificate chain is provided.&lt;/c&gt;

&lt;c&gt;The no. of 'intermediate certificates' prompt may vary depending upon the no of 'intermediate certificates' passed.&lt;/c&gt;

&lt;c&gt;I want to handle this intermediate certificate chain scenario.&lt;/c&gt;</field>
</data>
</node>
