PemToString (Stringlist function): Difference between revisions
m (→See also: add links) |
|||
Line 60: | Line 60: | ||
Related methods: | Related methods: | ||
<ul> | <ul> | ||
<li><var>String</var> class: <var>[[ | <li><var>Stringlist</var> class: <var>[[AppendPemData (Stringlist function)|AppendPemData]]</var>, <var>[[AppendCertificateRequest (Stringlist function)|AppendCertificateRequest]]</var>, and several more </li> | ||
<li><var>System</var> class: <var>[[ClientCertificate (System function)|ClientCertificate]]</var> | |||
<li><var>Socket</var> class: <var>[[Certificate (Socket function)|Certificate]]</var> | <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>HttpRequest</var> class: <var>[[Get (HttpRequest function)|Get]]</var>, <var>[[Post (HttpRequest function)|Post]]</var>, and <var>[[Send (HttpRequest function)|Send]]</var> | |||
<li><var>System</var> class: <var>[[ClientCertificate (System function)|ClientCertificate]]</var>, <var>[[GeneratedPrivateKey (System function)|GeneratedPrivateKey]]</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> | |||
</ul> | </ul> | ||
Revision as of 20:59, 14 March 2016
Extract base64 encoded PEM data to string (Stringlist class)
[Introduced in Sirius Mods 8.0]
The PEM (Privacy Enhanced Mail) protocol uses base64 encoding for binary data that needs to be transferred and stored as text.
Syntax
%string = sl:PemToString( label, [Occurrence= number]) Throws InvalidPemData
Syntax terms
%string | A Longstring or String to contain the decoded binary data in the method object, sl. |
---|---|
sl | A Stringlist object that contains base64 encoded data. |
label | The string that identifies the base64 encoded data you want to convert. Examples include X509 CERTIFICATE , X509 CRL , RSA PRIVATE KEY . X509 certificate, private key, and CRL data will be contained within the text markers -----BEGIN label----- and -----END label----- .
Note that this is a required, case-sensitive, value; if it does not match the first and last items of data within sl, no data is returned to %string. |
Occurrence | The occurrence number within sl of the requested labeled data. |
Exceptions
PemToString can throw the following exception:
- InvalidPemData
- If the method encounters non-PEM-conforming data, properties of the exception object may indicate the line and position of the error.
Usage notes
- PemToString converts the labeled and structured X509 base64 data you identify. To convert individual base64 strings, you can use the StringToBase64 method.
Examples
The following request loads Longstring %ls
with the contents of the base64 encoded CRL (Certificate Revocation List) contained in Stringlist %sl
:
b %ls is longstring %sl is object stringlist text to %sl = new raw -----BEGIN X509 CRL----- MIIBODCB4zANBgkqhkiG9w0BAQQFADBgMQswCQYDVQQGEwJBVTEMMAoGA1UECBMD UUxEMRkwFwYDVQQKExBNaW5jb20gUHR5LiBMdGQuMQswCQYDVQQLEwJDUzEbMBkG A1UEAxMSU1NMZWF5IGRlbW8gc2VydmVyFw0wMTAxMTUxNjI2NTdaFw0wMTAyMTQx NjI2NTdaMFIwEgIBARcNOTUxMDA5MjMzMjA1WjASAgEDFw05NTEyMDEwMTAwMDBa MBMCAhI0Fw0wMTAxMTUxNjE5NDdaMBMCAhI1Fw0wMTAxMTUxNjIzNDZaMA0GCSqG SIb3DQEBBAUAA0EAHPjQ3M93QOj8Ufi+jZM7Y78TfAzG4jJn/E6MYBPFVQFYo/Gp UZexfjSVo5CIyySOtYscz8oO7avwBxTiMpDEQg== -----END X509 CRL----- end text %ls = %sl:pemToString('X509 CRL') end
See also
Related methods:
- Stringlist class: AppendPemData, AppendCertificateRequest, and several more
- String class: DerToXmlDoc, X509CrlToXmlDoc, X509CertificateToXmlDoc, RSAPrivateKeyToXmlDoc, CertificateRequest, SignedCertificate
- System class: ClientCertificate, GeneratedPrivateKey
- Socket class: Certificate
- HttpRequest class: Get, Post, and Send
Background information: