CheckCertificate (Stringlist function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 21: Line 21:


==Examples==
==Examples==
In the following example, the <var>[[CheckCertificate (Stringlist function)|CheckCertificate]]</var> method checks a <var class="product">Janus Security</var>-generated certificate against its <var class="product">Janus Security</var>-generated private key. <p class="code"> ...
text to %cert = new raw
&#45;----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==   
&#45;----END NEW CERTIFICATE REQUEST-----
end text
text to %pk = new raw
&#45;----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==           
&#45;----END X509 CERTIFICATE-----                                 
end text
%rc = %cert:checkCertificaterequest(%pk)
printText {~} is {%rc}
...  </p>
The result is shown below:
<p class="code">%rc is 0 </p>


==See also==
==See also==

Revision as of 16:47, 10 May 2012

Check format of base64 encoded certificate (Stringlist class)

[Requires Janus Network Security]


This method checks an SSL certificate request 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 below 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.

Usage notes

Examples

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

... text to %cert = 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 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 %rc = %cert:checkCertificaterequest(%pk) printText {~} is {%rc} ...

The result is shown below:

%rc is 0

See also