Click or drag to resize

Asn1TextDumpToString Method

Dump details of ASN.1 formatted data to a string.

Namespace: CryptoSysPKI
Assembly: diCrSysPKINet (in diCrSysPKINet.dll) Version: 23.0.0.25611 (23.0.0.0)
Syntax
public static string TextDumpToString(
	string fileOrPEMString,
	Asn1Options options = Asn1Options.Default
)

Parameters

fileOrPEMString  String
Filename of ASN.1 formatted data file to be analyzed (or a string containing its base64 or PEM representation)
options  Asn1Options  (Optional)
Option flags: set as zero for defaults.

Return Value

String
String containing the output.
Remarks
This function creates a temporary file in the system TEMP directory. This file is locked and is automatically deleted after use.
Example
C#
// Very simple ASN.1 data encoded in base64
string s = Asn1.TextDumpToString("MAQwAgUA");
Debug.Assert(s.Length > 0, "Asn1.TextDumpToString failed");
Console.WriteLine(s);
/*
30 04  --SEQUENCE/4 bytes
   30 02  --SEQUENCE/2 bytes
      05 00  --NULL/0 bytes
--(6 bytes) */

// An X.509 certificate file
s = Asn1.TextDumpToString("smallca.cer");
Console.WriteLine(s);
/*
30 81 e0  --SEQUENCE/224 bytes
   30 81 9a  --SEQUENCE/154 bytes
      02 01  --INTEGER/1 bytes
         01
      30 0d  --SEQUENCE/13 bytes
         06 09  --OBJECTIDENTIFIER/9 bytes
            2a 86 48 86 f7 0d 01 01 05
            --sha1WithRSAEncryption (1.2.840.113549.1.1.5)
         05 00  --NULL/0 bytes
      30 0c  --SEQUENCE/12 bytes
         31 0a  --SET/10 bytes
            30 08  --SEQUENCE/8 bytes
               06 03  --OBJECTIDENTIFIER/3 bytes
                  55 04 03
                  --commonName (2.5.4.3)
               13 01  --PRINTABLESTRING/1 bytes
                  41
                  --'A'
[===cut===]
   30 0d  --SEQUENCE/13 bytes
      06 09  --OBJECTIDENTIFIER/9 bytes
         2a 86 48 86 f7 0d 01 01 05
         --sha1WithRSAEncryption (1.2.840.113549.1.1.5)
      05 00  --NULL/0 bytes
   03 32  --BITSTRING/50 bytes
      00 --0 unused bits
      01 9a 9b b2 ec b9 cd fd 66 c6 94 5b 2e d6 96 dc
      32 87 68 da 5e 6f 2e 5d 5a 7f e6 09 2e 60 8f 8c
      45 a5 18 7e 06 1c e9 81 aa ea d6 f2 e3 14 7d 25
      91
--(227 bytes) */
See Also