CheckCertificateRequest (Stringlist function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
mNo edit summary
Line 1: Line 1:
{{Template:Stringlist:CheckCertificateRequest subtitle}}
{{Template:Stringlist:CheckCertificateRequest subtitle}}


This page is [[under construction]].
This method checks an SSL certificate request against a private key.
 
==Syntax==
==Syntax==
{{Template:Stringlist:CheckCertificateRequest syntax}}
{{Template:Stringlist:CheckCertificateRequest syntax}}
===Syntax terms===
===Syntax terms===
<table class="syntaxTable">
<table class="syntaxTable">
<tr><th>%rc</th><td>number</td></tr>
<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>
<tr><th>sl</th>
<tr><th>sl</th>
<td>Stringlist object</td></tr>
<td>A <var>Stringlist</var> object that contains the certificate request to be checked.</td></tr>
<tr><th><var>PrivateKey</var></th>
<tr><th><var>PrivateKey</var></th>
<td><var>Stringlist</var> object</td></tr>
<td>This [[Notation conventions for methods#Named parameters|name allowed]] parameter is a <var>Stringlist</var> object that contains an RSA-generated private key.</td></tr>
<tr><th><var>Password</var></th>
<tr><th><var>Password</var></th>
<td>This optional, [[Notation conventions for methods#Named parameters|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>
 
===Return codes===
<table>
<tr><th>1</th><td>Keys don't match.</td></tr>
<tr><th>0</th><td>Keys match.</td></tr>
<tr><th>-1</th><td>Private key encrypted but no password provided.</td></tr>
<tr><th>-2</th><td>Private key password invalid.</td></tr>
<tr><th>-4</th><td>Certificate invalid.</td></tr>
<tr><th>-5</th><td>Certificate <var>Stringlist</var> identifier missing (request cancellation).</td></tr>
<tr><th>-6</th><td>Certificate <var>Stringlist</var> identifier invalid (request cancellation).</td></tr>
<tr><th>-7</th><td>Insufficient storage (request cancellation).</td></tr>
<tr><th>-9</th><td>Private key invalid.</td></tr>
<tr><th>-10</th><td>Key <var>Stringlist</var> identifier missing (request cancellation).</td></tr>
<tr><th>-11</th><td>Key <var>Stringlist</var> identifier invalid (request cancellation).</td></tr>
</table>
</table>


==Usage notes==
==Usage notes==
==Examples==
==Examples==
In the following example, the <var>[[CheckCertificateRequest (Stringlist function)|CheckCertificateRequest]]</var> method checks a <var class="product">Janus Security</var>-generated certificate request against a <var class="product">Janus Security</var>-generated private key. <p class="code"> ...
text to %creq = new raw
&#45;----BEGIN NEW CERTIFICATE REQUEST-----
MIIBSDCB8wIBADCBjzEMMAoGA1UEBhMDVVNBMQswCQYDVQQIEwJNQTESMBAGA1UE
BxMJQ2FtYnJpZGdlMR0wGwYDVQQKExRTaXJpdXMgU29mdHdhcmUgSW5jLjEdMBsG
A1UECxMUU29mdHdhcmUgRGV2ZWxvcG1lbnQxIDAeBgNVBAMTF3d3dy5zaXJpdXMt
c29mdHdhcmUuY29tMFowDQYJKoZIhvcNAQEBBQADSQAwRgJBAMIofDUItsJLIREb
8UJ93Xm3sJRkYI9qus6lPj76iGOLoQEExSVMved24YxtBlC84IPQrl1+foNcFYSv
OAnfA0ECAQOgADANBgkqhkiG9w0BAQQFAANBAFY6cU6+8p2E9xejVNACmQx2quSV
rudOnjS3jGeKl4Ga/wqg3Yrvg5BwMAWxGn1reh7DhX9j/ScjuBWVIgBkU9M=   
&#45;----END NEW CERTIFICATE REQUEST-----
end text
text to %pk = new raw
&#45;----BEGIN RSA PRIVATE KEY-----
ldXczTt44bm4aDJgqtXKaQGAkqlzqC/sYGNFmUd22PIDEk5V7pZmyHP5y1NqjnGa
jiptH/4QaKthEcX5I1t1+Xn1sPzdbw8c8Bpj1bgZ8v6hS5Y+W9KAytB7gnkNkyWV
7FxH9BeklNlONvOp1v9RkpuuU13WGTE0SkG0nFsVFucqwyxt/LseaKu8xJhqc/Pq
MzFdHLd4c07sB54qYWg4roZm9bpzQUaJWAiFuqDjgQ9QJzr0+Psy6XTybdWAgdn+
bClVBD8OeIjCKNpGEvGRBLc8gA8kS99S75Yb9/XFXKHhylikDKYo3Rjhfbc1+zB7
23znhn6QRaM/tap+Y9JuAhuzexlsnJnYHuyNNlUYNz9FbqVRfz81QtvhMaVu/HZb
glwH7LCSI3J34fvIrqJtrQAUswaub7dUCQGX                           
&#45;----END RSA PRIVATE KEY-----
end text
%rc = %creq:checkCertificaterequest(%pk)
printText {~} is {%rc}
...  </p>
The result is shown below:
<p class="code">%rc is 1 </p>
==See also==
==See also==
<ul>
<li><var>[[AppendCertificateInfo (Stringlist function)|AppendCertificateInfo]]</var>
<li><var>[[AppendCertificateRequestInfo (Stringlist function)|AppendCertificateRequestInfo]]</var>
<li><var>[[AppendSignedCertificate (Stringlist function)|AppendSignedCertificate]]</var>
<li><var>[[AppendSignedClientCertificate (Stringlist function)|AppendSignedClientCertificate]]</var>
</ul>
{{Template:Stringlist:CheckCertificateRequest footer}}
{{Template:Stringlist:CheckCertificateRequest footer}}

Revision as of 23:12, 9 May 2012

Check format of base64 encoded certificate request (Stringlist class)

[Requires Janus Network Security]


This method checks an SSL certificate request against a private key.

Syntax

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

Syntax terms

%rcAn, 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 that contains the certificate request 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.

Return codes

1Keys don't match.
0Keys match.
-1Private key encrypted but no password provided.
-2Private key password invalid.
-4Certificate invalid.
-5Certificate Stringlist identifier missing (request cancellation).
-6Certificate Stringlist identifier invalid (request cancellation).
-7Insufficient storage (request cancellation).
-9Private key invalid.
-10Key Stringlist identifier missing (request cancellation).
-11Key Stringlist identifier invalid (request cancellation).

Usage notes

Examples

In the following example, the CheckCertificateRequest method checks a Janus Security-generated certificate request against a Janus Security-generated private key.

... text to %creq = new raw -----BEGIN NEW CERTIFICATE REQUEST----- MIIBSDCB8wIBADCBjzEMMAoGA1UEBhMDVVNBMQswCQYDVQQIEwJNQTESMBAGA1UE BxMJQ2FtYnJpZGdlMR0wGwYDVQQKExRTaXJpdXMgU29mdHdhcmUgSW5jLjEdMBsG A1UECxMUU29mdHdhcmUgRGV2ZWxvcG1lbnQxIDAeBgNVBAMTF3d3dy5zaXJpdXMt c29mdHdhcmUuY29tMFowDQYJKoZIhvcNAQEBBQADSQAwRgJBAMIofDUItsJLIREb 8UJ93Xm3sJRkYI9qus6lPj76iGOLoQEExSVMved24YxtBlC84IPQrl1+foNcFYSv OAnfA0ECAQOgADANBgkqhkiG9w0BAQQFAANBAFY6cU6+8p2E9xejVNACmQx2quSV rudOnjS3jGeKl4Ga/wqg3Yrvg5BwMAWxGn1reh7DhX9j/ScjuBWVIgBkU9M= -----END NEW CERTIFICATE REQUEST----- end text text to %pk = new raw -----BEGIN RSA PRIVATE KEY----- ldXczTt44bm4aDJgqtXKaQGAkqlzqC/sYGNFmUd22PIDEk5V7pZmyHP5y1NqjnGa jiptH/4QaKthEcX5I1t1+Xn1sPzdbw8c8Bpj1bgZ8v6hS5Y+W9KAytB7gnkNkyWV 7FxH9BeklNlONvOp1v9RkpuuU13WGTE0SkG0nFsVFucqwyxt/LseaKu8xJhqc/Pq MzFdHLd4c07sB54qYWg4roZm9bpzQUaJWAiFuqDjgQ9QJzr0+Psy6XTybdWAgdn+ bClVBD8OeIjCKNpGEvGRBLc8gA8kS99S75Yb9/XFXKHhylikDKYo3Rjhfbc1+zB7 23znhn6QRaM/tap+Y9JuAhuzexlsnJnYHuyNNlUYNz9FbqVRfz81QtvhMaVu/HZb glwH7LCSI3J34fvIrqJtrQAUswaub7dUCQGX -----END RSA PRIVATE KEY----- end text %rc = %creq:checkCertificaterequest(%pk) printText {~} is {%rc} ...

The result is shown below:

%rc is 1

See also