AppendEncryptedSecurityData (Stringlist subroutine): Difference between revisions

From m204wiki
Jump to navigation Jump to search
mNo edit summary
m (→‎See also: add method to list)
 
(18 intermediate revisions by 6 users not shown)
Line 1: Line 1:
{{Template:Stringlist:AppendEncryptedSecurityData subtitle}}
{{Template:Stringlist:AppendEncryptedSecurityData subtitle}}
 
This subroutine RC4-encrypts a <var>Stringlist</var> that contains a base64 encoded, SSL-certificate related item (certificate request, certificate, private key, etc.).
This page is [[under construction]].


==Syntax==
==Syntax==
Line 23: Line 22:


==Usage notes==
==Usage notes==
<ul>
<li>The length of the encrypted data matches the length of the unencrypted data.
</ul>


==Examples==
==Examples==
In the following example, the <code>%creq</code> <var>Stringlist</var> is loaded with a base64 encoded SSL certificate request, which is then RC4-encrypted and added to <var>Stringlist</var> <code>%sl</code> by the <var>AppendEncryptedSecurityData</var> method. The encrypted contents are then printed: <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
%sl:APPENDENCRYPTEDSECURITYDATA(%creq, Password='12345', Identifier='NEW CERTIFICATE REQUEST')
%sl:print
...
</p>
The result is shown below:
<p class="code">&#45;----BEGIN NEW CERTIFICATE REQUEST-----                       
mzU3hcc5C0PhBbRWKhFeysu/SEn1oNSuv8tldCRTgQGSSx/9WQIarg9Q60gYqoVP
lNivlNniqBLnw69pf4bdsg+Nhb+t2SBImuQ6Ar9eCMqNQa1Lfa0IAf/akuIqDdMa
8N5aIIwTIlDuy0P4agbLZg1tG5oUKTbfcCgEibAfNm+qKazxV0G39s4SGFW+Turf
68byY3fPD1kumMAPJBUCgvLf5iI+ayOSH5K6hQJtCAInXmG+DnqHfnUgS9F80Jcb
/BzgIFktn/GV1POVX5VXZxQWDFzYXIVZJkyflsLdl1qWuAeXmwEHZRXy9yIxDc0R
zTxxOmI18406SojaHK7HUN9UcCrlT1BWsbBsuD81eWw7FpAImI/z3sAfqg37cEgp
Df75M4koUrT8wD6SHSx9ezII0GPaiAr1EUTzATRSoq6hoWS/TrpvE2STOyI=   
&#45;----END NEW CERTIFICATE REQUEST-----
</p>


==See also==
==See also==
<p>
<var>Stringlist</var> methods: </p>
{{Template:Stringlist crypto methods}}
<p>
<var>String</var> methods:</p>
<ul>
<ul>
<li><var>[[AppendCertificateInfo (Stringlist function)|AppendCertificateInfo]]</var>
<li><var>[[CertificateRequest (String function)|CertificateRequest]]</var> </li>
<li><var>[[AppendCertificateRequest (Stringlist function)|AppendCertificateRequest]]</var>
 
<li><var>[[AppendCertificateRequestInfo (Stringlist function)|AppendCertificateRequestInfo]]</var>
<li><var>[[SignedCertificate (String function)|SignedCertificate]]</var> </li>
<li><var>[[AppendClientCertificateRequest (Stringlist function)|AppendClientCertificateRequest]]</var>
 
<li><var>[[AppendGeneratedPrivateKey (Stringlist subroutine)|AppendGeneratedPrivateKey]]</var>
<li><var>[[SignedClientCertificate (String function)|SignedClientCertificate]]</var> </li>
<li><var>[[AppendPrivateKeyInfo (Stringlist function)|AppendPrivateKeyInfo]]</var>
 
<li><var>[[AppendSignedCertificate (Stringlist function)|AppendSignedCertificate]]</var>
<li><var>[[DerToXmlDoc (String function)|DerToXmlDoc]]</var> </li>
<li><var>[[AppendSignedClientCertificate (Stringlist function)|AppendSignedClientCertificate]]</var>
 
<li><var>[[CheckCertificate (Stringlist function)|CheckCertificate]]</var>
<li><var>[[RSAPrivateKeyToXmlDoc (String function)|RSAPrivateKeyToXmlDoc]]</var></li>
<li><var>[[CheckCertificateRequest (Stringlist function)|CheckCertificateRequest]]</var>
 
<li>[[SSL security changes in V8.0#XmlDoc version of SSL entities|DER-to-XmlDoc String methods]]
<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>
</ul>
<p>
<var>Socket</var> methods: </p>
<ul>
<li><var>[[Certificate (Socket function)|Certificate]]</var> </li>
</ul>
{{Template:Stringlist:AppendEncryptedSecurityData footer}}
{{Template:Stringlist:AppendEncryptedSecurityData footer}}

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: