AppendEncryptedSecurityData (Stringlist subroutine): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (→‎See also: add mention of String cipher methods)
m (→‎See also: add method to list)
 
(2 intermediate revisions by 2 users not shown)
Line 60: Line 60:
<p>
<p>
<var>Stringlist</var> methods: </p>
<var>Stringlist</var> methods: </p>
<ul>
{{Template:Stringlist crypto methods}}
<li><var>[[AppendCertificateInfo (Stringlist function)|AppendCertificateInfo]]</var></li>
 
<li><var>[[AppendCertificateRequest (Stringlist function)|AppendCertificateRequest]]</var></li>
 
<li><var>[[AppendCertificateRequestInfo (Stringlist function)|AppendCertificateRequestInfo]]</var></li>
 
<li><var>[[AppendClientCertificateRequest (Stringlist function)|AppendClientCertificateRequest]]</var></li>
 
<li><var>[[AppendGeneratedPrivateKey (Stringlist subroutine)|AppendGeneratedPrivateKey]]</var></li>
 
<li><var>[[AppendPrivateKeyInfo (Stringlist function)|AppendPrivateKeyInfo]]</var></li>
 
<li><var>[[AppendSignedCertificate (Stringlist function)|AppendSignedCertificate]]</var></li>
 
<li><var>[[AppendSignedClientCertificate (Stringlist function)|AppendSignedClientCertificate]]</var></li>
 
<li><var>[[CheckCertificate (Stringlist function)|CheckCertificate]]</var></li>
 
<li><var>[[CheckCertificateRequest (Stringlist function)|CheckCertificateRequest]]</var></li>
 
<li><var>[[PemToString_(Stringlist_function)|PemToString]]</var>, <var>[[AppendPemData (Stringlist subroutine)|AppendPemData]]</var>, and several more </li>
</ul>
<p>
<p>
<var>String</var> methods:</p>
<var>String</var> methods:</p>
Line 89: Line 67:


<li><var>[[SignedCertificate (String function)|SignedCertificate]]</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>[[DerToXmlDoc (String function)|DerToXmlDoc]]</var> </li>
Line 103: Line 83:
<var>System</var> methods: </p>
<var>System</var> methods: </p>
<ul>
<ul>
<li><var>[[ClientCertificate (System function)|ClientCertificate]]</var>, <li><var>[[GeneratedPrivateKey (System function)|GeneratedPrivateKey]]</var> </li>
<li><var>[[ClientCertificate (System function)|ClientCertificate]]</var> </li><li><var>[[GeneratedPrivateKey (System function)|GeneratedPrivateKey]]</var> </li>
</ul>
</ul>
<p>
<p>

Latest revision as of 15:12, 6 September 2018

Add RC4 encrypted base64 data to a Stringlist (Stringlist class)

[Requires Janus Network Security]

This subroutine RC4-encrypts a Stringlist that contains a base64 encoded, SSL-certificate related item (certificate request, certificate, private key, etc.).

Syntax

sl:AppendEncryptedSecurityData( sl, [Password=] string, - [[Identifier=] string])

Syntax terms

sl A Stringlist object to contain the encrypted, base64 data.
sl A Stringlist object that contains unencrypted, base64 data.
Password This name allowed parameter is a string that contains a password (encryption key) to seed the RC4 algorithm. This value must be at least five characters long.
Identifier This optional, name allowed, parameter is a string that is part of a data-identifying text at the beginning and end of the base64 data to be encrypted. The text is in the form -----BEGIN string----- and -----END string-----, where the default for string is RSA PRIVATE KEY. Some other string replacements, for example, include X509 CERTIFICATE, and X509 CRL.

This is a case-sensitive, value; if it does not match the first and last items of data within sl, no data is returned to the method object, sl.

Usage notes

  • The length of the encrypted data matches the length of the unencrypted data.

Examples

In the following example, the %creq Stringlist is loaded with a base64 encoded SSL certificate request, which is then RC4-encrypted and added to Stringlist %sl by the AppendEncryptedSecurityData method. The encrypted contents are then printed:

... 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 %sl:APPENDENCRYPTEDSECURITYDATA(%creq, Password='12345', Identifier='NEW CERTIFICATE REQUEST') %sl:print ...

The result is shown below:

-----BEGIN NEW CERTIFICATE REQUEST----- mzU3hcc5C0PhBbRWKhFeysu/SEn1oNSuv8tldCRTgQGSSx/9WQIarg9Q60gYqoVP lNivlNniqBLnw69pf4bdsg+Nhb+t2SBImuQ6Ar9eCMqNQa1Lfa0IAf/akuIqDdMa 8N5aIIwTIlDuy0P4agbLZg1tG5oUKTbfcCgEibAfNm+qKazxV0G39s4SGFW+Turf 68byY3fPD1kumMAPJBUCgvLf5iI+ayOSH5K6hQJtCAInXmG+DnqHfnUgS9F80Jcb /BzgIFktn/GV1POVX5VXZxQWDFzYXIVZJkyflsLdl1qWuAeXmwEHZRXy9yIxDc0R zTxxOmI18406SojaHK7HUN9UcCrlT1BWsbBsuD81eWw7FpAImI/z3sAfqg37cEgp Df75M4koUrT8wD6SHSx9ezII0GPaiAr1EUTzATRSoq6hoWS/TrpvE2STOyI= -----END NEW CERTIFICATE REQUEST-----

See also

Stringlist methods:

String methods:

System methods:

Socket methods: