AppendCertificateInfo (Stringlist function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
Line 31: Line 31:


==Examples==
==Examples==
In the following example of the <var>AppendCertificateInfo</var> method, a certificate is hard-coded into one Stringlist, then the information contained in the certificate is translated via <var>AppendCertificateInfo</var> into another:
In the following example, a certificate is hard-coded into one <var>Stringlist</var>, then the information contained in the certificate is translated via <var>AppendCertificateInfo</var> into another <var>Stringlist</var>:
<p class="code"> b
<p class="code">b


    %sl  is object stringlist
%sl  is object stringlist
    %cert is object stringlist
%cert is object stringlist


    %sl = new
%sl = new
    %cert = new
%cert = new


    text to %cert raw
text to %cert raw
        -----BEGIN CERTIFICATE-----
  -----BEGIN CERTIFICATE-----
        MIIB2TCCAUKgAwIBAgIESP4m7jANBgkqhkiG9w0BAQQFADAxMQswCQYDVQQGDAJVUzEMMAoGA1UE
  MIIB2TCCAUKgAwIBAgIESP4m7jANBgkqhkiG9w0BAQQFADAxMQswCQYDVQQGDAJVUzEMMAoGA1UE
        CgwDRE9FMRQwEgYDVQQDDAsqLm55Y2VkLm9yZzAeFw0wODEwMjAxOTAxMDJaFw0xODEwMTkxOTAx
  CgwDRE9FMRQwEgYDVQQDDAsqLm55Y2VkLm9yZzAeFw0wODEwMjAxOTAxMDJaFw0xODEwMTkxOTAx
        MDJaMDExCzAJBgNVBAYMAlVTMQwwCgYDVQQKDANET0UxFDASBgNVBAMMCyoubnljZWQub3JnMIGf
  MDJaMDExCzAJBgNVBAYMAlVTMQwwCgYDVQQKDANET0UxFDASBgNVBAMMCyoubnljZWQub3JnMIGf
        MA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCtdTxPrvwguxIJ9E3+UyzCCRluiyH05cONOUtd1zwv
  MA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCtdTxPrvwguxIJ9E3+UyzCCRluiyH05cONOUtd1zwv
        NgdAQ3EdITqGvWmz1tFWlGmXiADCtCipaJPXjLzUQ5hk0m7yBdM7ScnCh3V+0ls7+fjL/J8pUqvY
  NgdAQ3EdITqGvWmz1tFWlGmXiADCtCipaJPXjLzUQ5hk0m7yBdM7ScnCh3V+0ls7+fjL/J8pUqvY
        BLk5llLePd1qHOak3TPt4NAGMxf2u2Iz47bu0lpfZafCuM8hPHFgYQIDAQABMA0GCSqGSIb3DQEB
  BLk5llLePd1qHOak3TPt4NAGMxf2u2Iz47bu0lpfZafCuM8hPHFgYQIDAQABMA0GCSqGSIb3DQEB
        BAUAA4GBAF4Ee3T9DSZKVE97Kqzt3lJh/Wwg3i1UI2pc/HC9/rhzLxhTx9xfksAwe1+R5kLkHWyD
  BAUAA4GBAF4Ee3T9DSZKVE97Kqzt3lJh/Wwg3i1UI2pc/HC9/rhzLxhTx9xfksAwe1+R5kLkHWyD
        ddPfPqErKCdyhZ4QMSkM7bCeSy1aW6iF4R2v00eJ7wECAzO99QUatZ33m6Nwb5PToPDiirgsVWaj
  ddPfPqErKCdyhZ4QMSkM7bCeSy1aW6iF4R2v00eJ7wECAzO99QUatZ33m6Nwb5PToPDiirgsVWaj
        siWpXe998f7KgW0PwTunGmBLQaLg
  siWpXe998f7KgW0PwTunGmBLQaLg
        -----END CERTIFICATE-----
  -----END CERTIFICATE-----
    end text
end text


    %sl:appendCertificateInfo(%cert)
%sl:appendCertificateInfo(%cert)
    %sl:print
%sl:print


  end
  end
</p>
The result is something like:
<p class="output">
I.C=US                                                                         
I.O=ACME                                                                         
I.CN=*.acme.org                                                               
EFF=081020190102                                                               
EXP=181019190102                                                               
S.C=US                                                                         
S.O=ACME                                                                         
S.CN=*.acme.org                                                               
ALG=RSA                                                                         
N=AD753C4FAEFC20BB1209F44DFE532CC209196E8B21F4E5C38D394B5DD73C2F36074043711D213-
A86BD69B3D6D1569469978800C2B428A96893D78CBCD4439864D26EF205D33B49C9C287757ED25B-
...
F65A7C2B8CF213C716061                                                           
E=010001                                                                       
</p>
</p>


==See also==
==See also==
{{Template:Stringlist:AppendOpenProcedure footer}}
{{Template:Stringlist:AppendOpenProcedure footer}}

Revision as of 21:33, 4 May 2012

Add certificate information to a Stringlist (Stringlist class)

[Requires Janus Network Security]


This callable method adds lines to the end of a Stringlist, from the information section of an SSL certificate.

Syntax

[%rc =] sl:AppendCertificateInfo[( [certificate])]

Syntax terms

%rc An, optional, numeric variable that is set to zero if the function is a success.
sl A Stringlist object.
certificate A Stringlist object that contains the raw text of a valid SSL certificate.

Return codes

0All is well.
-1Encrypted but no password specified.
-2Encrypted and wrong password specified.
-3Out of CCATEMP.
-5List identifier missing.
-6Invalid list identifier.
-7Insufficient storage.
-10Input list identifier missing.
-11Invalid input list identifier.
-12Invalid input list data (not correctly base-64 encoded).
-13Invalid request/certificate (internal structure of certificate is not valid).

Examples

In the following example, a certificate is hard-coded into one Stringlist, then the information contained in the certificate is translated via AppendCertificateInfo into another Stringlist:

b %sl is object stringlist %cert is object stringlist %sl = new %cert = new text to %cert raw -----BEGIN CERTIFICATE----- MIIB2TCCAUKgAwIBAgIESP4m7jANBgkqhkiG9w0BAQQFADAxMQswCQYDVQQGDAJVUzEMMAoGA1UE CgwDRE9FMRQwEgYDVQQDDAsqLm55Y2VkLm9yZzAeFw0wODEwMjAxOTAxMDJaFw0xODEwMTkxOTAx MDJaMDExCzAJBgNVBAYMAlVTMQwwCgYDVQQKDANET0UxFDASBgNVBAMMCyoubnljZWQub3JnMIGf MA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCtdTxPrvwguxIJ9E3+UyzCCRluiyH05cONOUtd1zwv NgdAQ3EdITqGvWmz1tFWlGmXiADCtCipaJPXjLzUQ5hk0m7yBdM7ScnCh3V+0ls7+fjL/J8pUqvY BLk5llLePd1qHOak3TPt4NAGMxf2u2Iz47bu0lpfZafCuM8hPHFgYQIDAQABMA0GCSqGSIb3DQEB BAUAA4GBAF4Ee3T9DSZKVE97Kqzt3lJh/Wwg3i1UI2pc/HC9/rhzLxhTx9xfksAwe1+R5kLkHWyD ddPfPqErKCdyhZ4QMSkM7bCeSy1aW6iF4R2v00eJ7wECAzO99QUatZ33m6Nwb5PToPDiirgsVWaj siWpXe998f7KgW0PwTunGmBLQaLg -----END CERTIFICATE----- end text %sl:appendCertificateInfo(%cert) %sl:print end

The result is something like:

I.C=US I.O=ACME I.CN=*.acme.org EFF=081020190102 EXP=181019190102 S.C=US S.O=ACME S.CN=*.acme.org ALG=RSA N=AD753C4FAEFC20BB1209F44DFE532CC209196E8B21F4E5C38D394B5DD73C2F36074043711D213- A86BD69B3D6D1569469978800C2B428A96893D78CBCD4439864D26EF205D33B49C9C287757ED25B- ... F65A7C2B8CF213C716061 E=010001

See also