AppendPemData (Stringlist subroutine): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (→‎See also: add links)
m (→‎See also: add method to list)
 
(9 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Template:Stringlist:AppendPemData subtitle}}
{{Template:Stringlist:AppendPemData subtitle}}
The PEM (Privacy Enhanced Mail) protocol uses base64 encoding for binary data that needs to be transferred and stored as text. <var>AppendPemData</var> lets you store PEM data as a series of base64 encoded <var>[[Stringlist class|Stringlist]]</var> items within beginning and ending text marker items.


This page is [[under construction]].
==Syntax==
==Syntax==
{{Template:Stringlist:AppendPemData syntax}}
{{Template:Stringlist:AppendPemData syntax}}
===Syntax terms===
===Syntax terms===
<table class="syntaxTable">
<table>
<tr><th>sl</th>
<tr><th>sl</th>
<td>Stringlist object</td></tr>
<td>A <var>Stringlist</var> object that contains labeled, base64 encoded data.</td></tr>
 
<tr><th><var>Data</var></th>
<tr><th><var>Data</var></th>
<td>string</td></tr>
<td>The <var>Longstring</var> or <var>String</var> you are appending to the data stored in <var class="term">sl</var>. </td></tr>
 
<tr><th><var>label</var></th>
<tr><th><var>label</var></th>
<td>string</td></tr>
<td>The string that identifies the base64 encoded data you are appending. The data is stored as a series of <var class="term">sl</var> items contained within items that are the text markers <code>-----BEGIN <i>label</i>-----</code> and <code>-----END <i>label</i>-----</code>.
<p>
This is a required, case-sensitive, value. </p></td></tr>
</table>
</table>
==Usage notes==
==Usage notes==
<ul>
<li>The appended data is retrievable with the <var>[[PemToString (Stringlist function)|PemToString]]</var> method.
</ul>
==Examples==
==Examples==
<p class="code">b
%ls    is longstring
%sl    is object stringlist
%ls = 'My PEM content'
%sl:Appendpemdata(%ls, 'SSL SESSION PARAMETERS')
printtext {~} = {%sl:print}
end
</p>
<p>
The result is: </p>
<p class="output"><nowiki>%sl:print = -----BEGIN SSL SESSION PARAMETERS-----
1KhA18XUQIOWlaOFlaM=
-----END SSL SESSION PARAMETERS-----
</nowiki></p>
If you were to apply the <var>Base64toString</var> method to the string within the begin and end markers in the preceding result, that is:
<p class="code">printtext {~} = {'1KhA18XUQIOWlaOFlaM=':base64tostring}
</p>
The result is:
<p class="output">'1KhA18XUQIOWlaOFlaM=':base64tostring = My PEM content </p>
==See also==
==See also==
Related methods:
<p>
<var>Stringlist</var> methods: </p>
{{Template:Stringlist crypto methods}}
<p>
<var>String</var> methods:</p>
<ul>
<ul>
<li><var>Stringlist</var> class: <var>[[AppendCertificateRequest (Stringlist function)|AppendCertificateRequest]]</var>, <var>[[PemToString (Stringlist subroutine)|PemToString]]</var>, and several more </li>
<li><var>[[CertificateRequest (String function)|CertificateRequest]]</var> </li>


<li><var>String</var> class: <var>[[DerToXmlDoc (String function)|DerToXmlDoc]]</var>, <var>[[X509CrlToXmlDoc (String function)|X509CrlToXmlDoc]]</var>, <var>[[X509CertificateToXmlDoc (String function)|X509CertificateToXmlDoc]]</var>, <var>[[RSAPrivateKeyToXmlDoc (String function)|RSAPrivateKeyToXmlDoc]]</var>, <var>[[CertificateRequest (String function)|CertificateRequest]]</var>, <var>[[SignedCertificate (String function)|SignedCertificate]]</var> </li>
<li><var>[[SignedCertificate (String function)|SignedCertificate]]</var> </li>


<li><var>System</var> class: <var>[[ClientCertificate (System function)|ClientCertificate]]</var>, <var>[[GeneratedPrivateKey (System function)|GeneratedPrivateKey]]</var> </li>
<li><var>[[SignedClientCertificate (String function)|SignedClientCertificate]]</var> </li>
<li><var>Socket</var> class: <var>[[Certificate (Socket function)|Certificate]]</var> </li>


<li><var>HttpRequest</var> class: <var>[[Get (HttpRequest function)|Get]]</var>, <var>[[Post (HttpRequest function)|Post]]</var>, and <var>[[Send (HttpRequest function)|Send]]</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>



Latest revision as of 15:13, 6 September 2018

Append PEM encoded string to a Stringlist (Stringlist class)

[Introduced in Model 204 7.5]

The PEM (Privacy Enhanced Mail) protocol uses base64 encoding for binary data that needs to be transferred and stored as text. AppendPemData lets you store PEM data as a series of base64 encoded Stringlist items within beginning and ending text marker items.

Syntax

sl:AppendPemData( [Data=] string, [label=] string)

Syntax terms

sl A Stringlist object that contains labeled, base64 encoded data.
Data The Longstring or String you are appending to the data stored in sl.
label The string that identifies the base64 encoded data you are appending. The data is stored as a series of sl items contained within items that are the text markers -----BEGIN label----- and -----END label-----.

This is a required, case-sensitive, value.

Usage notes

  • The appended data is retrievable with the PemToString method.

Examples

b %ls is longstring %sl is object stringlist %ls = 'My PEM content' %sl:Appendpemdata(%ls, 'SSL SESSION PARAMETERS') printtext {~} = {%sl:print} end

The result is:

%sl:print = -----BEGIN SSL SESSION PARAMETERS----- 1KhA18XUQIOWlaOFlaM= -----END SSL SESSION PARAMETERS-----

If you were to apply the Base64toString method to the string within the begin and end markers in the preceding result, that is:

printtext {~} = {'1KhA18XUQIOWlaOFlaM=':base64tostring}

The result is:

'1KhA18XUQIOWlaOFlaM=':base64tostring = My PEM content

See also

Stringlist methods:

String methods:

System methods:

Socket methods:

Background information: