DerToXmlDoc (String function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
Line 21: Line 21:


==Examples==
==Examples==
[[PemToString (Stringlist function)#Examples|The PemToString example]] loads a <var>Longstring</var> with the contents of the base64 encoded CRL (Certificate Revocation List). If that <var>Longstring</var> is <code>%ls</code> below, the following statement converts that string to the XmlDoc whose contents are printed thereafter:
<ol>
<li>[[PemToString (Stringlist function)#Examples|The PemToString example]] loads a <var>Longstring</var> with the contents of the base64 encoded CRL (Certificate Revocation List). If that <var>Longstring</var> is <code>%ls</code> below, the following statement converts that string to the XmlDoc whose contents are printed thereafter:
<p class="code">%ls:derToXmlDoc:print </p>
<p class="code">%ls:derToXmlDoc:print </p>


Line 54: Line 55:
                                                                    
                                                                    
The ellipses indicate snipped content and are not part of the XmlDoc.
The ellipses indicate snipped content and are not part of the XmlDoc.
<li>In [[RSAPrivateKeyToXmlDoc (String function)#Examples|the RSAPrivateKeyToXmlDoc example]], the <var>PemToString</var> method loads a <var>Longstring</var> with the contents of an RSA private key. If that <var>Longstring</var> is <code>%ls</code> below, the following statement converts that string to the <var>XmlDoc</var> whose contents are printed thereafter. Compare the XML tags in these results with the tags produced by <var>RSAPrivateKeyToXmlDoc</var>:
<p class="code">%ls:derToXmlDoc:print </p>
The result is shown in part below:
<p class="code"><Sequence>
  <Integer>0</Integer>
  <Integer>196482721346 ...
    ...685825059547</Integer>
  <Integer>3</Integer>
  <Integer>327471202244 ...
    ...832238758867</Integer>
  <Integer>163032211406 ...
    ...063864355897</Integer>
  <Integer>120517730607 ...
    ...628528150451</Integer>
  <Integer>108688140937 ...
    ...709242903931</Integer>
  <Integer>803451537383 ...
    ...419018766967</Integer>
  <Integer>104154110092 ...
    ...977615354780</Integer>                                                             
</Sequence> </p>
==See also==
==See also==
Related methods:
Related methods:

Revision as of 18:56, 21 April 2012

Convert DER encoded data to XML (String class)

[Introduced in Sirius Mods 8.0]


DER (Distinguished Encoding Rules) provide a way to uniquely encode an ASN.1 type value as a string of eight-bit octets. DerToXmlDoc converts such a string to an XmlDoc.

Syntax

%doc = string:DerToXmlDoc Throws InvalidBerData

Syntax terms

%doc An XmlDoc object variable to contain the decoded value of the method object, string.
string A DER encoded string.

Usage notes

  • Currently, no method is available to produce a DER stream from an XmlDoc.

Examples

  1. The PemToString example loads a Longstring with the contents of the base64 encoded CRL (Certificate Revocation List). If that Longstring is %ls below, the following statement converts that string to the XmlDoc whose contents are printed thereafter:

    %ls:derToXmlDoc:print

    The result is shown in part below:

    <Sequence> <Sequence> <Sequence> <ObjectIdentifier>1.2.840.113549.1.1.4</ObjectIdentifier> <Null/> </Sequence> <Sequence> ... <Set> <Sequence> <ObjectIdentifier>2.5.4.8</ObjectIdentifier> <PrintableString>QLD</PrintableString> </Sequence> </Set> ... <UTCTime>20010115162657.000Z</UTCTime> <UTCTime>20010214162657.000Z</UTCTime> <Sequence> <Sequence> <Integer>1</Integer> <UTCTime>19951009233205.000Z</UTCTime> </Sequence> <Sequence> <Integer>3</Integer> <UTCTime>19951201010000.000Z</UTCTime> </Sequence> ...

    The ellipses indicate snipped content and are not part of the XmlDoc.

  2. In the RSAPrivateKeyToXmlDoc example, the PemToString method loads a Longstring with the contents of an RSA private key. If that Longstring is %ls below, the following statement converts that string to the XmlDoc whose contents are printed thereafter. Compare the XML tags in these results with the tags produced by RSAPrivateKeyToXmlDoc:

    %ls:derToXmlDoc:print

    The result is shown in part below:

    <Sequence> <Integer>0</Integer> <Integer>196482721346 ... ...685825059547</Integer> <Integer>3</Integer> <Integer>327471202244 ... ...832238758867</Integer> <Integer>163032211406 ... ...063864355897</Integer> <Integer>120517730607 ... ...628528150451</Integer> <Integer>108688140937 ... ...709242903931</Integer> <Integer>803451537383 ... ...419018766967</Integer> <Integer>104154110092 ... ...977615354780</Integer> </Sequence>

    See also

    Related methods: