Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Iterated prompt handling

by vaibhav07 (Acolyte)
on May 19, 2012 at 08:54 UTC ( #971408=perlquestion: print w/ replies, xml ) Need Help??
vaibhav07 has asked for the wisdom of the Perl Monks concerning the following question:

Please enter Certificate: Press <Enter> when done -----BEGIN CERTIFICATE----- MIIFtjCCBJ6gAwIBAgIQIFUz8E8mut6Vrn5LtX6fujANBgkqhkiG9w0BAQUFADBi IPFnu2NdIr8HG9qX9exCghK4VUD7Dk6CdCY= -----END CERTIFICATE----- Please enter Private Key: Press <Enter> 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 issu +ing 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 <Enter> 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 <Enter> when done -----BEGIN CERTIFICATE----- ZFRydXN0IEV4dGVybmFsIFRUUCBOZXR3b3JrMSIwIAYDVQQDExlBZGRUcnVzdCBF -----END CERTIFICATE----- Do you want to continue entering root and/or intermediate certificates {y|n}: n
Code used : my $certificate = $opts{certificate}; my $private_key = $opts{'private-key'}; my $intermediate_key = $opts{'intermediate-key'}; $prompt_answers = [ 'Please enter Certificate:.*' => $certificate, 'Please enter Private Key:.*' => $private_key, 'Please enter certificates of Certification Authorities.*' + => ( defined $intermediate_key ) ? $intermediate_key : 'n +', ]; This code was effective till the response passed was 'n' for prompt 'D +o you want to continue entering root and/or intermediate certificates +', but not effective if the intermediate certificate chain is provide +d.
The no. of 'intermediate certificates' prompt may vary depending upon the no of 'intermediate certificates' passed. I want to handle this intermediate certificate chain scenario.

Comment on Iterated prompt handling
Select or Download Code
Re: Iterated prompt handling
by moritz (Cardinal) on May 19, 2012 at 09:11 UTC
Re: Iterated prompt handling
by davido (Archbishop) on May 19, 2012 at 16:54 UTC

    A: 42


    Dave

Re: Iterated prompt handling
by Anonymous Monk on May 19, 2012 at 17:12 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://971408]
Approved by ww
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (15)
As of 2014-09-23 15:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (228 votes), past polls