CheckCertificateRequest (Stringlist function): Difference between revisions
m (→See also) |
m (→See also: add method to list) |
||
(11 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
{{Template:Stringlist:CheckCertificateRequest subtitle}} | {{Template:Stringlist:CheckCertificateRequest subtitle}} | ||
This method checks an SSL certificate request against a private key. | This method checks an SSL certificate request against a private key. | ||
Line 19: | Line 18: | ||
===Return codes=== | ===Return codes=== | ||
<table> | <table class="thJustBold"> | ||
<tr><th>1</th><td>Keys don't match.</td></tr> | <tr><th>1</th><td>Keys don't match.</td></tr> | ||
<tr><th>0</th><td>Keys 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>-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>-2</th><td>Private key password invalid.</td></tr> | ||
<tr><th>-4</th><td>Certificate 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>-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>-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>-7</th><td>Insufficient storage (request cancellation).</td></tr> | ||
<tr><th>-9</th><td>Private key invalid.</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>-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> | <tr><th>-11</th><td>Key <var>Stringlist</var> identifier invalid (request cancellation).</td></tr> | ||
</table> | </table> | ||
==Usage notes== | ==Usage notes== | ||
For some background information concerning certificates, see [https://en.wikipedia.org/wiki/Public-key_cryptography Public-key cryptography] and [https://en.wikipedia.org/wiki/Certificate_signing_request Certificate signing request]. | |||
==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 its <var class="product">Janus Security</var>-generated private key. <p class="code"> ... | In the following example, the <var>[[CheckCertificateRequest (Stringlist function)|CheckCertificateRequest]]</var> method checks a <var class="product">Janus Security</var>-generated certificate request against its <var class="product">Janus Security</var>-generated private key. <p class="code">... | ||
text to %creq = new raw | text to %creq = new raw | ||
-----BEGIN NEW CERTIFICATE REQUEST----- | -----BEGIN NEW CERTIFICATE REQUEST----- | ||
Line 72: | Line 82: | ||
%rc = %creq:checkCertificaterequest(%pk) | %rc = %creq:checkCertificaterequest(%pk) | ||
printText {~} is {%rc} | printText {~} is {%rc} | ||
... | |||
</p> | |||
The result is shown below: | The result is shown below: | ||
Line 78: | Line 89: | ||
==See also== | ==See also== | ||
<p> | |||
<var>Stringlist</var> methods: </p> | |||
{{Template:Stringlist crypto methods}} | |||
<p> | |||
<var>String</var> methods:</p> | |||
<ul> | <ul> | ||
<li><var>[[ | <li><var>[[CertificateRequest (String function)|CertificateRequest]]</var> </li> | ||
<li><var>[[ | <li><var>[[SignedCertificate (String function)|SignedCertificate]]</var> </li> | ||
<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> | |||
<li><var>[[Certificate (Socket function)|Certificate]]</var> </li> | |||
</ul> | </ul> | ||
{{Template:Stringlist:CheckCertificateRequest footer}} | {{Template:Stringlist:CheckCertificateRequest footer}} |
Latest revision as of 15:15, 6 September 2018
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
%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 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
1 | Keys don't match. |
---|---|
0 | Keys match. |
-1 | Private key encrypted but no password provided. |
-2 | Private key password invalid. |
-4 | Certificate invalid. |
-5 | Certificate Stringlist identifier missing (request cancellation). |
-6 | Certificate Stringlist identifier invalid (request cancellation). |
-7 | Insufficient storage (request cancellation). |
-9 | Private key invalid. |
-10 | Key Stringlist identifier missing (request cancellation). |
-11 | Key Stringlist identifier invalid (request cancellation). |
Usage notes
For some background information concerning certificates, see Public-key cryptography and Certificate signing request.
Examples
In the following example, the CheckCertificateRequest method checks a Janus Security-generated certificate request against its Janus Security-generated private key.
... text to %creq = new raw -----BEGIN NEW CERTIFICATE REQUEST----- MIIBzjCCATcCAQAwgY8xDDAKBgNVBAYTA1VTQTELMAkGA1UECBMCTUExEjAQBgNV BAcTCUNhbWJyaWRnZTEdMBsGA1UEChMUU2lyaXVzIFNvZnR3YXJlIEluYy4xHTAb BgNVBAsTFFNvZnR3YXJlIERldmVsb3BtZW50MSAwHgYDVQQDExd3d3cuc2lyaXVz LXNvZnR3YXJlLmNvbTCBnTANBgkqhkiG9w0BAQEFAAOBiwAwgYcCgYEAtR70c/uS XL/o2pTi9YZnZv8BRLZP95ErHYWR1juQZJc3nCEEduNMAZFIAbrGLm4k2QRZn2+l qKomoJp/FAYhvH3a0OfmnNfp4csuEXrqr93Vi8Q1UyxlqLMNFRGWjtG2ZpU2rd23 pqfBmSHddlijsK/4zJSGohiGBNiP/EUeCC8CAQOgADANBgkqhkiG9w0BAQQFAAOB gQCmbEAleV+6G7jAn9xoW5Aprp2TCM/lRiVy7Rc9XRdCy0fauxSdRJcACU1IPVxJ koU03s4tJiXkg5PkYQKvQwFkJsmTgqHlf5G87NmWZwBeM2VflmqD8UuYHil89o+w QnWOpiuPMHuIF+A0/zF8S+4nUPoqGn466L4aC2tXweWhjw== -----END NEW CERTIFICATE REQUEST----- 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 = %creq:checkCertificaterequest(%pk) printText {~} is {%rc} ...
The result is shown below:
%rc is 0
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: