CheckCertificate (Stringlist function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (→‎See also: add method to list)
 
(19 intermediate revisions by 6 users not shown)
Line 1: Line 1:
{{Template:Stringlist:CheckCertificate subtitle}}
{{Template:Stringlist:CheckCertificate subtitle}}
 
This method checks an SSL certificate against a private key.
This method checks an SSL certificate request against a private key.


==Syntax==
==Syntax==
Line 17: Line 16:
<td>This optional, name allowed, parameter is a string that contains a password to decrypt the private key, if necessary.</td></tr>
<td>This optional, name allowed, parameter is a string that contains a password to decrypt the private key, if necessary.</td></tr>
</table>
</table>
==Usage notes==


==Examples==
==Examples==
In the following example, the <var>[[CheckCertificate (Stringlist function)|CheckCertificate]]</var> method checks a <var class="product">Janus Security</var>-generated certificate (loaded to <var>Stringlist</var> <code>%cert</code>) against its <var class="product">Janus Security</var>-generated private key (loaded to <var>Stringlist</var> <code>%pk</code>). <p class="code"> ...
In the following example, the <var>[[CheckCertificate (Stringlist function)|CheckCertificate]]</var> method checks a <var class="product">Janus Security</var>-generated certificate (loaded to <var>Stringlist</var> <code>%cert</code>) against its <var class="product">Janus Security</var>-generated private key (loaded to <var>Stringlist</var> <code>%pk</code>). <p class="code">...
text to %cert = new raw
text to %cert = new raw
&#45;----BEGIN X509 CERTIFICATE-----                                 
&#45;----BEGIN X509 CERTIFICATE-----                                 
Line 61: Line 58:
%rc = %cert:checkCertificaterequest(%pk)
%rc = %cert:checkCertificaterequest(%pk)
printText {~} is {%rc}  
printText {~} is {%rc}  
... </p>
...
</p>


The result is shown below:
The result is shown below:
Line 67: Line 65:


==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>
<ul>
<li><var>[[AppendCertificateInfo (Stringlist function)|AppendCertificateInfo]]</var>
<li><var>[[ClientCertificate (System function)|ClientCertificate]]</var> </li><li><var>[[GeneratedPrivateKey (System function)|GeneratedPrivateKey]]</var> </li>
<li><var>[[AppendCertificateRequestInfo (Stringlist function)|AppendCertificateRequestInfo]]</var>
<li><var>[[AppendClientCertificateRequest (Stringlist function)|AppendClientCertificateRequest]]</var>
<li><var>[[AppendPrivateKeyInfo (Stringlist function)|AppendPrivateKeyInfo]]</var>
<li><var>[[AppendGeneratedPrivateKey (Stringlist subroutine)|AppendgeneratedPrivateKey]]</var>
<li><var>[[AppendSignedCertificate (Stringlist function)|AppendSignedCertificate]]</var>
<li><var>[[AppendSignedClientCertificate (Stringlist function)|AppendSignedClientCertificate]]</var>
<li><var>[[CheckCertificateRequest (Stringlist function)|CheckCertificateRequest]]</var>
</ul>
</ul>
<p>
<var>Socket</var> methods: </p>
<ul>
<li><var>[[Certificate (Socket function)|Certificate]]</var> </li>
</ul>
{{Template:Stringlist:CheckCertificate footer}}
{{Template:Stringlist:CheckCertificate footer}}

Latest revision as of 15:15, 6 September 2018

Check format of base64 encoded certificate (Stringlist class)

[Requires Janus Network Security]

This method checks an SSL certificate against a private key.

Syntax

%rc = sl:CheckCertificate( [PrivateKey=] stringlist, [[Password=] string])

Syntax terms

%rc An, optional, numeric variable that is set to zero if the function is a success. The possible return codes are described elsewhere in "Return codes".
sl A Stringlist object that contains the certificate to be checked.
PrivateKey This name allowed parameter is a Stringlist object that contains an RSA-generated private key.
Password This optional, name allowed, parameter is a string that contains a password to decrypt the private key, if necessary.

Examples

In the following example, the CheckCertificate method checks a Janus Security-generated certificate (loaded to Stringlist %cert) against its Janus Security-generated private key (loaded to Stringlist %pk).

... text to %cert = new raw -----BEGIN X509 CERTIFICATE----- MIICkTCCAfoCBQHClCdRMA0GCSqGSIb3DQEBBAUAMIGPMQwwCgYDVQQGEwNVU0Ex CzAJBgNVBAgTAk1BMRIwEAYDVQQHEwlDYW1icmlkZ2UxHTAbBgNVBAoTFFNpcml1 cyBTb2Z0d2FyZSBJbmMuMR0wGwYDVQQLExRTb2Z0d2FyZSBEZXZlbG9wbWVudDEg MB4GA1UEAxMXd3d3LnNpcml1cy1zb2Z0d2FyZS5jb20wHhcNMTIwNTA4MjM1MjM0 WhcNMzAwODA5MjM1MjM0WjCBjzEMMAoGA1UEBhMDVVNBMQswCQYDVQQIEwJNQTES MBAGA1UEBxMJQ2FtYnJpZGdlMR0wGwYDVQQKExRTaXJpdXMgU29mdHdhcmUgSW5j LjEdMBsGA1UECxMUU29mdHdhcmUgRGV2ZWxvcG1lbnQxIDAeBgNVBAMTF3d3dy5z aXJpdXMtc29mdHdhcmUuY29tMIGdMA0GCSqGSIb3DQEBAQUAA4GLADCBhwKBgQC1 HvRz+5Jcv+jalOL1hmdm/wFEtk/3kSsdhZHWO5BklzecIQR240wBkUgBusYubiTZ BFmfb6Woqiagmn8UBiG8fdrQ5+ac1+nhyy4Reuqv3dWLxDVTLGWosw0VEZaO0bZm lTat3bemp8GZId12WKOwr/jMlIaiGIYE2I/8RR4ILwIBAzANBgkqhkiG9w0BAQQF AAOBgQAtduP6yyMrQTSkJ4v52JlkC1Qhp5yPSLiRi7tXc/sA7i90AY9sUZqBNWWk XQHP9wjddPlRFtK9bP8slqCwfi2u4Ri8kKGSnTcZY/HQIkEAdEZXHCaykq4j4zde bSNI0nOLJK7s5vO934+rIrCxjsLSFXmM8BVVE+QlwEQG3dObsg== -----END X509 CERTIFICATE----- end text text to %pk = new raw -----BEGIN RSA PRIVATE KEY----- MIICWgIBAAKBgQC1HvRz+5Jcv+jalOL1hmdm/wFEtk/3kSsdhZHWO5BklzecIQR2 40wBkUgBusYubiTZBFmfb6Woqiagmn8UBiG8fdrQ5+ac1+nhyy4Reuqv3dWLxDVT LGWosw0VEZaO0bZmlTat3bemp8GZId12WKOwr/jMlIaiGIYE2I/8RR4ILwIBAwKB gB4v02ip7bof/CRuJdOWZpEqgDYeYqlC3ITrmE5fQrtuiUSwK2kl4gBC4VWfIQe9 BiQrZEU9RkbHBnAZv9irsEnMX1ZgYdntsW5xHe7K1wowBRUrQgAD5SPYRc5b0JEX PTPL+aJzNaSQNQ/KW3O+QZVN5p3Co2TqjwDzcutQsSkfAkEA+pYxMH2wTCcmabe3 p76qjE2SERSf7nk2yTqw29w1hSYqsj7By51vLWFH/35rMBiqAC5yTgmQjlJIIXw6 kz4ASwJBALkImXUd0PmaJLrCwRIhyDFpeq+UsyaNmtgvjg7W8sEhBRseHV7YXBkh 8mQ6VLMBhtxip7aotArZtwJiPc25ES0CQQCnDst1qSAyxMRGenpv1HGy3mFguGqe +3nbfHXn6COuGXHMKdaHvkoeQNqqVEd1ZcaqyaGJW7W0NtrA/XxiKVWHAkB7WxD4 votREW3R1ytha9rLm6cfuHdvCRHldQlfOfcra1i8vr4/OugQwUxC0Y3Mq689lxp5 xc1ckSSsQX6JJgtzAkAPAzNsxdsNaAES3L5yqkbux8W2Y2YdjjxZMl1sdPqn9rXN A8fe68sT76U9rhuJemue1h9jxgq6fscFqZkbNRll -----END RSA PRIVATE KEY----- end text %rc = %cert:checkCertificaterequest(%pk) printText {~} is {%rc} ...

The result is shown below:

%rc is 0

See also

Stringlist methods:

String methods:

System methods:

Socket methods: