AppendCertificateInfo (Stringlist function): Difference between revisions
m (→See also) |
m (→See also: add method to list) |
||
(23 intermediate revisions by 6 users not shown) | |||
Line 1: | Line 1: | ||
{{Template:Stringlist:AppendCertificateInfo subtitle}} | {{Template:Stringlist:AppendCertificateInfo subtitle}} | ||
This [[Notation conventions for methods#Callable functions|callable]] method adds lines from the information section of an SSL certificate to the end of a <var>Stringlist</var>. | This [[Notation conventions for methods#Callable functions|callable]] method adds lines from the information section of an SSL certificate to the end of a <var>Stringlist</var>. | ||
Line 7: | Line 6: | ||
===Syntax terms=== | ===Syntax terms=== | ||
<table | <table> | ||
<tr><th>%rc</th> | <tr><th>%rc</th> | ||
<td>An, optional, numeric variable that is set to zero if the function is a success. The possible return codes are described below in [[#Return codes|"Return codes"]]. </td></tr> | <td>An, optional, numeric variable that is set to zero if the function is a success. The possible return codes are described below in [[#Return codes|"Return codes"]]. </td></tr> | ||
<tr><th>sl</th> | <tr><th>sl</th> | ||
<td>A <var>Stringlist</var> object.</td></tr> | <td>A <var>Stringlist</var> object.</td></tr> | ||
<tr><th>certificate</th> | <tr><th>certificate</th> | ||
<td>A <var>Stringlist</var> object that contains the raw text of a valid SSL certificate.</td></tr> | <td>A <var>Stringlist</var> object that contains the raw text of a valid SSL certificate.</td></tr> | ||
Line 17: | Line 18: | ||
===Return codes=== | ===Return codes=== | ||
<table> | <table class="thJustBold"> | ||
<tr><th>0</th><td>All is well.</td></tr> | <tr><th>0</th><td>All is well.</td></tr> | ||
<tr><th> | |||
<tr><th> | <tr><th>1</th><td>Encrypted but no password specified.</td></tr> | ||
<tr><th> | |||
<tr><th> | <tr><th>2</th><td>Encrypted and wrong password specified.</td></tr> | ||
<tr><th> | |||
<tr><th> | <tr><th>3</th><td>Out of CCATEMP.</td></tr> | ||
<tr><th> | |||
<tr><th> | <tr><th>5</th><td><var>Stringlist</var> identifier missing.</td></tr> | ||
<tr><th> | |||
<tr><th> | <tr><th>6</th><td>Invalid <var>Stringlist</var> identifier.</td></tr> | ||
<tr><th>7</th><td>Insufficient storage.</td></tr> | |||
<tr><th>10</th><td>Input <var>Stringlist</var> identifier missing.</td></tr> | |||
<tr><th>11</th><td>Invalid input <var>Stringlist</var> identifier.</td></tr> | |||
<tr><th>12</th><td>Invalid input <var>Stringlist</var> data (not correctly base-64 encoded).</td></tr> | |||
<tr><th>13</th><td>Invalid request/certificate (internal structure of certificate is not valid).</td></tr> | |||
</table> | </table> | ||
Line 36: | Line 47: | ||
information in an arbitrary order. Each list item | information in an arbitrary order. Each list item | ||
is in ID=value format. These are the possible IDs: | is in ID=value format. These are the possible IDs: | ||
<table> | <table class="thJustBold"> | ||
<tr><th>S.C</th><td>Subject country</td></tr> | <tr><th>S.C</th> | ||
<tr><th>S.S<td>Subject state or province </td></tr> | <td>Subject country</td></tr> | ||
<tr><th>S.L<td>Subject locality - city, town, village, etc. </td></tr> | |||
<tr><th>S.O<td>Subject organization </td></tr> | <tr><th>S.S</th> | ||
<tr><th>S.OU<td>Subject organization unit </td></tr> | <td>Subject state or province </td></tr> | ||
<tr><th>S.CN<td>Subject common name </td></tr> | |||
<tr><th>I.C<td>Issuer country </td></tr> | <tr><th>S.L</th> | ||
<tr><th>I.S<td>Issuer state or province </td></tr> | <td>Subject locality - city, town, village, etc. </td></tr> | ||
<tr><th>I.L<td>Issuer locality - city, town, village, etc. </td></tr> | |||
<tr><th>I.O<td>Issuer organization </td></tr> | <tr><th>S.O</th> | ||
<tr><th>I.OU<td>Issuer organization unit </td></tr> | <td>Subject organization </td></tr> | ||
<tr><th>I.CN<td>Issuer common name </td></tr> | |||
<tr><th>EFF<td>Effective date in YYMMDDHHMISS format (GMT) </td></tr> | <tr><th>S.OU</th> | ||
<tr><th>EXP<td>Expiration date in YYMMDDHHMISS format (GMT) </td></tr> | <td>Subject organization unit </td></tr> | ||
<tr><th>ALG<td>Key algorithm - currently always RSA </td></tr> | |||
<tr><th>N<td>Public modulus in hexadecimal </td></tr> | <tr><th>S.CN</th> | ||
<tr><th>E<td>Public exponent in hexadecimal </td></tr> | <td>Subject common name </td></tr> | ||
<tr><th>I.C</th> | |||
<td>Issuer country </td></tr> | |||
<tr><th>I.S</th> | |||
<td>Issuer state or province </td></tr> | |||
<tr><th>I.L</th> | |||
<td>Issuer locality - city, town, village, etc. </td></tr> | |||
<tr><th>I.O</th> | |||
<td>Issuer organization </td></tr> | |||
<tr><th>I.OU</th> | |||
<td>Issuer organization unit </td></tr> | |||
<tr><th>I.CN</th> | |||
<td>Issuer common name </td></tr> | |||
<tr><th>EFF</th> | |||
<td>Effective date in YYMMDDHHMISS format (GMT) </td></tr> | |||
<tr><th>EXP</th> | |||
<td>Expiration date in YYMMDDHHMISS format (GMT) </td></tr> | |||
<tr><th>ALG</th> | |||
<td>Key algorithm - currently always RSA </td></tr> | |||
<tr><th>N</th> | |||
<td>Public modulus in hexadecimal </td></tr> | |||
<tr><th>E</th> | |||
<td>Public exponent in hexadecimal </td></tr> | |||
</table> | </table> | ||
</li> | |||
</ul> | |||
==Examples== | ==Examples== | ||
Line 87: | Line 133: | ||
The result is something like: | The result is something like: | ||
<p class="output"> | <p class="output"> | ||
I.C=US | I.C=US | ||
I.O=ACME | I.O=ACME | ||
I.CN=*.acme.org | I.CN=*.acme.org | ||
EFF=081020190102 | EFF=081020190102 | ||
EXP=181019190102 | EXP=181019190102 | ||
S.C=US | S.C=US | ||
S.O=ACME | S.O=ACME | ||
S.CN=*.acme.org | S.CN=*.acme.org | ||
ALG=RSA | ALG=RSA | ||
N=AD753C4FAEFC20BB1209F44DFE532CC209196E8B21F4E5C38D394B5DD73C2F36074043711D213- | N=AD753C4FAEFC20BB1209F44DFE532CC209196E8B21F4E5C38D394B5DD73C2F36074043711D213- | ||
A86BD69B3D6D1569469978800C2B428A96893D78CBCD4439864D26EF205D33B49C9C287757ED25B- | A86BD69B3D6D1569469978800C2B428A96893D78CBCD4439864D26EF205D33B49C9C287757ED25B- | ||
... | |||
F65A7C2B8CF213C716061 | F65A7C2B8CF213C716061 | ||
E=010001 | E=010001 | ||
</p> | </p> | ||
==See also== | ==See also== | ||
<p> | |||
<var>Stringlist</var> methods: </p> | |||
{{Template:Stringlist crypto methods}} | |||
<p> | |||
<var>String</var> methods:</p> | |||
<ul> | |||
<li><var>[[CertificateRequest (String function)|CertificateRequest]]</var> </li> | |||
<li><var>[[SignedCertificate (String function)|SignedCertificate]]</var> </li> | |||
<li><var>[[SignedClientCertificate (String function)|SignedClientCertificate]]</var> </li> | |||
<li><var>[[DerToXmlDoc (String function)|DerToXmlDoc]]</var> </li> | |||
<li><var>[[RSAPrivateKeyToXmlDoc (String function)|RSAPrivateKeyToXmlDoc]]</var></li> | |||
<li><var>[[X509CertificateToXmlDoc (String function)|X509CertificateToXmlDoc]]</var> </li> | |||
<li><var>[[X509CrlToXmlDoc (String function)|X509CrlToXmlDoc]]</var> </li> | |||
<li>Multiple cryptographic cipher methods </li> | |||
</ul> | |||
<p> | |||
<var>System</var> methods: </p> | |||
<ul> | |||
<li><var>[[ClientCertificate (System function)|ClientCertificate]]</var> </li><li><var>[[GeneratedPrivateKey (System function)|GeneratedPrivateKey]]</var> </li> | |||
</ul> | |||
<p> | |||
<var>Socket</var> methods: </p> | |||
<ul> | <ul> | ||
<li><var>[[ | <li><var>[[Certificate (Socket function)|Certificate]]</var> </li> | ||
<li | </ul> | ||
</ul>{{Template:Stringlist:AppendOpenProcedure footer}} | |||
{{Template:Stringlist:AppendOpenProcedure footer}} |
Latest revision as of 15:10, 6 September 2018
Add certificate information to a Stringlist (Stringlist class)
[Requires Janus Network Security]
This callable method adds lines from the information section of an SSL certificate to the end of a Stringlist.
Syntax
[%rc =] sl:AppendCertificateInfo[( [certificate])]
Syntax terms
%rc | An, optional, numeric variable that is set to zero if the function is a success. The possible return codes are described below in "Return codes". |
---|---|
sl | A Stringlist object. |
certificate | A Stringlist object that contains the raw text of a valid SSL certificate. |
Return codes
0 | All is well. |
---|---|
1 | Encrypted but no password specified. |
2 | Encrypted and wrong password specified. |
3 | Out of CCATEMP. |
5 | Stringlist identifier missing. |
6 | Invalid Stringlist identifier. |
7 | Insufficient storage. |
10 | Input Stringlist identifier missing. |
11 | Invalid input Stringlist identifier. |
12 | Invalid input Stringlist data (not correctly base-64 encoded). |
13 | Invalid request/certificate (internal structure of certificate is not valid). |
Usage notes
- The updated Stringlist contains an arbitrary amount of
information in an arbitrary order. Each list item
is in ID=value format. These are the possible IDs:
S.C Subject country S.S Subject state or province S.L Subject locality - city, town, village, etc. S.O Subject organization S.OU Subject organization unit S.CN Subject common name I.C Issuer country I.S Issuer state or province I.L Issuer locality - city, town, village, etc. I.O Issuer organization I.OU Issuer organization unit I.CN Issuer common name EFF Effective date in YYMMDDHHMISS format (GMT) EXP Expiration date in YYMMDDHHMISS format (GMT) ALG Key algorithm - currently always RSA N Public modulus in hexadecimal E Public exponent in hexadecimal
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
Stringlist methods:
- AppendCertificateInfo
- AppendCertificateRequest
- AppendCertificateRequestInfo
- AppendClientCertificateRequest
- AppendEncryptedSecurityData
- AppendGeneratedPrivateKey
- AppendPemData
- AppendPrivateKeyInfo
- AppendSignedCertificate
- AppendSignedClientCertificate
- CheckCertificate
- CheckCertificateRequest
- PemToString
String methods:
- CertificateRequest
- SignedCertificate
- SignedClientCertificate
- DerToXmlDoc
- RSAPrivateKeyToXmlDoc
- X509CertificateToXmlDoc
- X509CrlToXmlDoc
- Multiple cryptographic cipher methods
System methods:
Socket methods: