AppendEncryptedSecurityData (Stringlist subroutine)

From m204wiki
Revision as of 22:27, 2 September 2015 by ELowell (talk | contribs)
Jump to navigation Jump to search

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