---
product: Chilkat
product_version: 11.7.0
language: delphidll
language_label: Delphi DLL
class: Asn
license: bundle
deprecated: false
reference_html: https://www.chilkatsoft.com/refdoc/dd_CkAsnRef.html
---
# Chilkat Asn — Delphi DLL — v11.7.0

> Chilkat 11.7.0 · language=delphidll · class=Asn
> Other versions: replace `11.7.0` in this URL. Other languages: `https://www.chilkatsoft.com/ai-docs/v/11.7.0/<lang>/classes/Asn.md`.
> Language-wide rules (install, unlock, error model, strings/bytes): `https://www.chilkatsoft.com/ai-docs/v/11.7.0/delphidll/guide.md`.

## Purpose

**Load, inspect, build, edit, and encode ASN.1 structures in DER or XML form.**

`Chilkat.Asn` represents an ASN.1 item and its optional child items. It can load ASN.1 from binary DER, encoded DER strings, files, or `BinData`; expose tags, tag values, primitive content, boolean and integer values, and child counts; build constructed structures such as `SEQUENCE` and `SET`; append common primitive types such as booleans, integers, big integers, bit strings, octets, OIDs, strings, times, null values, and context-specific items; convert ASN.1 to XML; reload from that XML form; and write the final structure back to DER.

**Load DER data**

Load ASN.1 from binary DER bytes, encoded text such as Base64 or hex, files, or existing `BinData` objects.

**Inspect ASN.1 items**

Read the item tag, tag value, constructed/primitive state, sub-item count, string content, boolean value, or integer value.

**Build sequences and sets**

Append constructed `SEQUENCE` and `SET` items, then add child ASN.1 values beneath them.

**Append primitive values**

Add booleans, integers, big integers, bit strings, octet strings, OIDs, strings, times, null values, and encoded byte content.

**Context-specific tags**

Add context-specific primitive or constructed items when working with ASN.1 formats that use tagged application-specific structures.

**DER and XML conversion**

Convert ASN.1 to XML for inspection or editing, load ASN.1 back from XML, and output the result as binary or encoded DER.

**Common pattern:** Load existing DER with `LoadBinary`, `LoadEncoded`, `LoadBd`, or `LoadBinaryFile`, inspect the tree with `Tag`, `Constructed`, `NumSubItems`, and `GetSubItem`, then extract primitive content or convert to XML with `AsnToXml`. To create ASN.1, start with a constructed item, append child values, and write the final DER with `GetBinaryDer`, `GetEncodedDer`, `WriteBd`, or `WriteBinaryDer`.

## Object creation, unlocking and error handling

**Create/Dispose**

```pascal
var
myObject: HCkAsn;

begin
myObject := CkAsn_Create();

// ...

CkAsn_Dispose(myObject);
end;
```

`function CkAsn_Create: HCkAsn; stdcall;`

Creates an instance of the HCkAsn object and returns a handle (i.e. a Pointer). The handle is passed in the 1st argument for the functions listed on this page.

`procedure CkAsn_Dispose(handle: HCkAsn); stdcall;`

Objects created by calling CkAsn_Create must be freed by calling this method. A memory leak occurs if a handle is not disposed by calling this function.

Call `Global.UnlockBundle` once at the start of the program, before using this or any other Chilkat class. Any string unlocks a fully functional 30-day trial; a purchased unlock code is used in production. See `guide.md` for the exact code in Delphi DLL.

## Members common to every Chilkat class

Documented once per language in `common-members.md`; listed here so this page is self-contained.

| Property | Signature | Access | Meaning |
|---|---|---|---|
| `DebugLogFilePath` | `procedure CkAsn_getDebugLogFilePath(objHandle: HCkAsn; outPropVal: HCkString); stdcall; procedure CkAsn_putDebugLogFilePath(objHandle: HCkAsn; newPropVal: PWideChar); stdcall; function CkAsn__debugLogFilePath(objHandle: HCkAsn): PWideChar; stdcall;` | read/write | If set to a file path, this property logs the LastErrorText of each Chilkat method or property call to the specified file. |
| `LastErrorHtml` | `procedure CkAsn_getLastErrorHtml(objHandle: HCkAsn; outPropVal: HCkString); stdcall; function CkAsn__lastErrorHtml(objHandle: HCkAsn): PWideChar; stdcall;` | read-only | Provides HTML-formatted information about the last called method or property. |
| `LastErrorText` | `procedure CkAsn_getLastErrorText(objHandle: HCkAsn; outPropVal: HCkString); stdcall; function CkAsn__lastErrorText(objHandle: HCkAsn): PWideChar; stdcall;` | read-only | Provides plain text information about the last called method or property. |
| `LastErrorXml` | `procedure CkAsn_getLastErrorXml(objHandle: HCkAsn; outPropVal: HCkString); stdcall; function CkAsn__lastErrorXml(objHandle: HCkAsn): PWideChar; stdcall;` | read-only | Provides XML-formatted information about the last called method or property. |
| `LastMethodSuccess` | `function CkAsn_getLastMethodSuccess(objHandle: HCkAsn): wordbool; stdcall; procedure CkAsn_putLastMethodSuccess(objHandle: HCkAsn; newPropVal: wordbool); stdcall;` | read/write | Indicates the success or failure of the most recent method call: `True` means success, `False` means failure. |
| `VerboseLogging` | `function CkAsn_getVerboseLogging(objHandle: HCkAsn): wordbool; stdcall; procedure CkAsn_putVerboseLogging(objHandle: HCkAsn; newPropVal: wordbool); stdcall;` | read/write | If set to `True`, then the contents of LastErrorText (or LastErrorXml, or LastErrorHtml) may contain more verbose information. |
| `Version` | `procedure CkAsn_getVersion(objHandle: HCkAsn; outPropVal: HCkString); stdcall; function CkAsn__version(objHandle: HCkAsn): PWideChar; stdcall;` | read-only | Version of the component/library, such as "10.1.0" |

## Member index

| Member | Kind | Signature |
|---|---|---|
| `BoolValue` | property, read/write | `function CkAsn_getBoolValue(objHandle: HCkAsn): wordbool; stdcall; procedure CkAsn_putBoolValue(objHandle: HCkAsn; newPropVal: wordbool); stdcall;` |
| `Constructed` | property, read-only | `function CkAsn_getConstructed(objHandle: HCkAsn): wordbool; stdcall;` |
| `ContentStr` | property, read/write | `procedure CkAsn_getContentStr(objHandle: HCkAsn; outPropVal: HCkString); stdcall; procedure CkAsn_putContentStr(objHandle: HCkAsn; newPropVal: PWideChar); stdcall; function CkAsn__contentStr(objHandle: HCkAsn): PWideChar; stdcall;` |
| `IntValue` | property, read/write | `function CkAsn_getIntValue(objHandle: HCkAsn): Integer; stdcall; procedure CkAsn_putIntValue(objHandle: HCkAsn; newPropVal: Integer); stdcall;` |
| `NumSubItems` | property, read-only | `function CkAsn_getNumSubItems(objHandle: HCkAsn): Integer; stdcall;` |
| `Tag` | property, read-only | `procedure CkAsn_getTag(objHandle: HCkAsn; outPropVal: HCkString); stdcall; function CkAsn__tag(objHandle: HCkAsn): PWideChar; stdcall;` |
| `TagValue` | property, read-only | `function CkAsn_getTagValue(objHandle: HCkAsn): Integer; stdcall;` |
| `AppendBigInt` | method | `function CkAsn_AppendBigInt(objHandle: HCkAsn;     encodedBytes: PWideChar;     encoding: PWideChar): wordbool; stdcall;` |
| `AppendBits` | method | `function CkAsn_AppendBits(objHandle: HCkAsn;     encodedBytes: PWideChar;     encoding: PWideChar): wordbool; stdcall;` |
| `AppendBool` | method | `function CkAsn_AppendBool(objHandle: HCkAsn;     value: wordbool): wordbool; stdcall;` |
| `AppendContextConstructed` | method | `function CkAsn_AppendContextConstructed(objHandle: HCkAsn;     tag: Integer): wordbool; stdcall;` |
| `AppendContextPrimitive` | method | `function CkAsn_AppendContextPrimitive(objHandle: HCkAsn;     tag: Integer;     encodedBytes: PWideChar;     encoding: PWideChar): wordbool; stdcall;` |
| `AppendInt` | method | `function CkAsn_AppendInt(objHandle: HCkAsn;     value: Integer): wordbool; stdcall;` |
| `AppendNull` | method | `function CkAsn_AppendNull(objHandle: HCkAsn): wordbool; stdcall;` |
| `AppendOctets` | method | `function CkAsn_AppendOctets(objHandle: HCkAsn;     encodedBytes: PWideChar;     encoding: PWideChar): wordbool; stdcall;` |
| `AppendOid` | method | `function CkAsn_AppendOid(objHandle: HCkAsn;     oid: PWideChar): wordbool; stdcall;` |
| `AppendSequence` | method | `function CkAsn_AppendSequence(objHandle: HCkAsn): wordbool; stdcall;` |
| `AppendSequence2` | method | `function CkAsn_AppendSequence2(objHandle: HCkAsn): wordbool; stdcall;` |
| `AppendSequenceR` | method | `function CkAsn_AppendSequenceR(objHandle: HCkAsn): HCkAsn; stdcall;` |
| `AppendSet` | method | `function CkAsn_AppendSet(objHandle: HCkAsn): wordbool; stdcall;` |
| `AppendSet2` | method | `function CkAsn_AppendSet2(objHandle: HCkAsn): wordbool; stdcall;` |
| `AppendSetR` | method | `function CkAsn_AppendSetR(objHandle: HCkAsn): HCkAsn; stdcall;` |
| `AppendString` | method | `function CkAsn_AppendString(objHandle: HCkAsn;     strType: PWideChar;     value: PWideChar): wordbool; stdcall;` |
| `AppendTime` | method | `function CkAsn_AppendTime(objHandle: HCkAsn;     timeFormat: PWideChar;     dateTimeStr: PWideChar): wordbool; stdcall;` |
| `AsnToXml` | method | `function CkAsn_AsnToXml(objHandle: HCkAsn;     outStr: HCkString): wordbool; stdcall; function CkAsn__asnToXml(objHandle: HCkAsn): PWideChar; stdcall;` |
| `DeleteSubItem` | method | `function CkAsn_DeleteSubItem(objHandle: HCkAsn;     index: Integer): wordbool; stdcall;` |
| `GetEncodedContent` | method | `function CkAsn_GetEncodedContent(objHandle: HCkAsn;     encoding: PWideChar;     outStr: HCkString): wordbool; stdcall; function CkAsn__getEncodedContent(objHandle: HCkAsn;     encoding: PWideChar): PWideChar; stdcall;` |
| `GetEncodedDer` | method | `function CkAsn_GetEncodedDer(objHandle: HCkAsn;     encoding: PWideChar;     outStr: HCkString): wordbool; stdcall; function CkAsn__getEncodedDer(objHandle: HCkAsn;     encoding: PWideChar): PWideChar; stdcall;` |
| `GetLastSubItem` | method | `function CkAsn_GetLastSubItem(objHandle: HCkAsn): HCkAsn; stdcall;` |
| `GetSubItem` | method | `function CkAsn_GetSubItem(objHandle: HCkAsn;     index: Integer): HCkAsn; stdcall;` |
| `LoadAsnXml` | method | `function CkAsn_LoadAsnXml(objHandle: HCkAsn;     xmlStr: PWideChar): wordbool; stdcall;` |
| `LoadBd` | method | `function CkAsn_LoadBd(objHandle: HCkAsn;     bd: HCkBinData): wordbool; stdcall;` |
| `LoadBinaryFile` | method | `function CkAsn_LoadBinaryFile(objHandle: HCkAsn;     path: PWideChar): wordbool; stdcall;` |
| `LoadEncoded` | method | `function CkAsn_LoadEncoded(objHandle: HCkAsn;     asnContent: PWideChar;     encoding: PWideChar): wordbool; stdcall;` |
| `SetEncodedContent` | method | `function CkAsn_SetEncodedContent(objHandle: HCkAsn;     encodedBytes: PWideChar;     encoding: PWideChar): wordbool; stdcall;` |
| `WriteBd` | method | `function CkAsn_WriteBd(objHandle: HCkAsn;     bd: HCkBinData): wordbool; stdcall;` |
| `WriteBinaryDer` | method | `function CkAsn_WriteBinaryDer(objHandle: HCkAsn;     path: PWideChar): wordbool; stdcall;` |

Deprecated members are listed at the end of this file with their replacements; do not use them in new code.

## Properties

### Asn.BoolValue

`Chilkat 11.7.0 · delphidll · Asn · BoolValue · property · read/write · since 9.5.0.49`

```pascal
function CkAsn_getBoolValue(objHandle: HCkAsn): wordbool; stdcall;
procedure CkAsn_putBoolValue(objHandle: HCkAsn; newPropVal: wordbool); stdcall;
```

The ASN.1 item's boolean value if it is a boolean item.

### Asn.Constructed

`Chilkat 11.7.0 · delphidll · Asn · Constructed · property · read-only · since 9.5.0.49`

```pascal
function CkAsn_getConstructed(objHandle: HCkAsn): wordbool; stdcall;
```

`True` if this ASN.1 item is a constructed item. Sequence and Set items are constructed and can contain sub-items. All other tags (boolean, integer, octets, utf8String, etc.) are primitive (non-constructed).

### Asn.ContentStr

`Chilkat 11.7.0 · delphidll · Asn · ContentStr · property · read/write · since 9.5.0.49`

```pascal
procedure CkAsn_getContentStr(objHandle: HCkAsn; outPropVal: HCkString); stdcall;
procedure CkAsn_putContentStr(objHandle: HCkAsn; newPropVal: PWideChar); stdcall;
function CkAsn__contentStr(objHandle: HCkAsn): PWideChar; stdcall;
```

The ASN.1 item's content if it is an ASN.1 string type (such as Utf8String, BmpString, PrintableString, VisibleString, T61String, IA5String, NumericString, or UniversalString).

### Asn.IntValue

`Chilkat 11.7.0 · delphidll · Asn · IntValue · property · read/write · since 9.5.0.49`

```pascal
function CkAsn_getIntValue(objHandle: HCkAsn): Integer; stdcall;
procedure CkAsn_putIntValue(objHandle: HCkAsn; newPropVal: Integer); stdcall;
```

The ASN.1 item's integer value if it is a small integer item.

### Asn.NumSubItems

`Chilkat 11.7.0 · delphidll · Asn · NumSubItems · property · read-only · since 9.5.0.49`

```pascal
function CkAsn_getNumSubItems(objHandle: HCkAsn): Integer; stdcall;
```

The number of sub-items contained within this ASN.1 item. Only constructed items, such as Sequence and Set will contain sub-iitems. Primitive items such as OIDs, octet strings, integers, etc. will never contain sub-items.

### Asn.Tag

`Chilkat 11.7.0 · delphidll · Asn · Tag · property · read-only · since 9.5.0.49`

```pascal
procedure CkAsn_getTag(objHandle: HCkAsn; outPropVal: HCkString); stdcall;
function CkAsn__tag(objHandle: HCkAsn): PWideChar; stdcall;
```

The ASN.1 item's tag as a descriptive string. Possible values are:

```
boolean
integer
bitString
octets
null
oid
utf8String
relativeOid
sequence
set
numericString
printableString
t61String
ia5String
utcTime
bmpString
```

### Asn.TagValue

`Chilkat 11.7.0 · delphidll · Asn · TagValue · property · read-only · since 9.5.0.49`

```pascal
function CkAsn_getTagValue(objHandle: HCkAsn): Integer; stdcall;
```

The ASN.1 item's tag as a integer value. The integer values for possible tags are as follows:

```
boolean (1)
integer (2)
bitString (3)
octets (4)
null (5)
oid (6)
utf8String (12)
relativeOid (13)
sequence (16)
set (17)
numericString (18)
printableString (19)
t61String (20)
ia5String (22)
utcTime (23)
bmpString (30)
```

## Methods

### Asn.AppendBigInt

`Chilkat 11.7.0 · delphidll · Asn · AppendBigInt · method · since 9.5.0.49`

```pascal
function CkAsn_AppendBigInt(objHandle: HCkAsn;
    encodedBytes: PWideChar;
    encoding: PWideChar): wordbool; stdcall;
```

Appends an ASN.1 integer, but one that is a big (huge) integer that is too large to be represented by an integer variable. The bytes composing the integer are passed in encoded string format (such as base64, hex, etc.). The byte order must be big-endian. The `encoding` may be any of the following encodings: `Base64`, `Hex`, `Base58`, `modBase64`, `Base32`, `UU`, `QP` (for quoted-printable), `URL` (for url-encoding), `Q`, `B`, `url_oath`, `url_rfc1738`, `url_rfc2396`, and `url_rfc3986`. The `encoding` name is case insensitive (for example, both `Base64` and `base64` are treated the same).

Returns True for success, False for failure.

### Asn.AppendBits

`Chilkat 11.7.0 · delphidll · Asn · AppendBits · method · since 9.5.0.49`

```pascal
function CkAsn_AppendBits(objHandle: HCkAsn;
    encodedBytes: PWideChar;
    encoding: PWideChar): wordbool; stdcall;
```

Appends an ASN.1 bit string to the caller's sub-items. The bytes containing the bits are passed in encoded string format (such as base64, hex, etc.). The byte order must be big-endian (MSB first). The `encoding` may be any of the following encodings: `Base64`, `Hex`, `Base58`, `modBase64`, `Base32`, `UU`, `QP` (for quoted-printable), `URL` (for url-encoding), `Q`, `B`, `url_oath`, `url_rfc1738`, `url_rfc2396`, and `url_rfc3986`. The `encoding` name is case insensitive (for example, both `Base64` and `base64` are treated the same).

Returns True for success, False for failure.

### Asn.AppendBool

`Chilkat 11.7.0 · delphidll · Asn · AppendBool · method · since 9.5.0.49`

```pascal
function CkAsn_AppendBool(objHandle: HCkAsn;
    value: wordbool): wordbool; stdcall;
```

Appends an ASN.1 boolean item to the caller's sub-items. Items may only be appended to constructed data types such as Sequence and Set.

Returns True for success, False for failure.

### Asn.AppendContextConstructed

`Chilkat 11.7.0 · delphidll · Asn · AppendContextConstructed · method · since 9.5.0.50`

```pascal
function CkAsn_AppendContextConstructed(objHandle: HCkAsn;
    tag: Integer): wordbool; stdcall;
```

Appends an ASN.1 context-specific constructed item to the caller's sub-items.

Returns True for success, False for failure.

### Asn.AppendContextPrimitive

`Chilkat 11.7.0 · delphidll · Asn · AppendContextPrimitive · method · since 9.5.0.50`

```pascal
function CkAsn_AppendContextPrimitive(objHandle: HCkAsn;
    tag: Integer;
    encodedBytes: PWideChar;
    encoding: PWideChar): wordbool; stdcall;
```

Appends an ASN.1 context-specific primitive item to the caller's sub-items. The bytes are passed in encoded string format (such as base64, hex, etc.). The `encoding` may be any of the following encodings: `Base64`, `Hex`, `Base58`, `modBase64`, `Base32`, `UU`, `QP` (for quoted-printable), `URL` (for url-encoding), `Q`, `B`, `url_oath`, `url_rfc1738`, `url_rfc2396`, and `url_rfc3986`. The `encoding` name is case insensitive (for example, both `Base64` and `base64` are treated the same).

Returns True for success, False for failure.

### Asn.AppendInt

`Chilkat 11.7.0 · delphidll · Asn · AppendInt · method · since 9.5.0.49`

```pascal
function CkAsn_AppendInt(objHandle: HCkAsn;
    value: Integer): wordbool; stdcall;
```

Appends an ASN.1 integer item to the caller's sub-items. Items may only be appended to constructed data types such as Sequence and Set.

Returns True for success, False for failure.

### Asn.AppendNull

`Chilkat 11.7.0 · delphidll · Asn · AppendNull · method · since 9.5.0.49`

```pascal
function CkAsn_AppendNull(objHandle: HCkAsn): wordbool; stdcall;
```

Appends an ASN.1 null item to the caller's sub-items. Items may only be appended to constructed data types such as Sequence and Set.

Returns True for success, False for failure.

### Asn.AppendOctets

`Chilkat 11.7.0 · delphidll · Asn · AppendOctets · method · since 9.5.0.49`

```pascal
function CkAsn_AppendOctets(objHandle: HCkAsn;
    encodedBytes: PWideChar;
    encoding: PWideChar): wordbool; stdcall;
```

Appends an ASN.1 octet string to the caller's sub-items. The bytes are passed in encoded string format (such as base64, hex, etc.). The `encoding` may be any of the following encodings: `Base64`, `Hex`, `Base58`, `modBase64`, `Base32`, `UU`, `QP` (for quoted-printable), `URL` (for url-encoding), `Q`, `B`, `url_oath`, `url_rfc1738`, `url_rfc2396`, and `url_rfc3986`. The `encoding` name is case insensitive (for example, both `Base64` and `base64` are treated the same).

Returns True for success, False for failure.

### Asn.AppendOid

`Chilkat 11.7.0 · delphidll · Asn · AppendOid · method · since 9.5.0.49`

```pascal
function CkAsn_AppendOid(objHandle: HCkAsn;
    oid: PWideChar): wordbool; stdcall;
```

Appends an ASN.1 OID (object identifier) to the caller's sub-items. The OID is passed in string form, such as `1.2.840.113549.1.9.1`.

Returns True for success, False for failure.

### Asn.AppendSequence

`Chilkat 11.7.0 · delphidll · Asn · AppendSequence · method · since 9.5.0.49`

```pascal
function CkAsn_AppendSequence(objHandle: HCkAsn): wordbool; stdcall;
```

Appends an ASN.1 sequence item to the caller's sub-items.

Returns True for success, False for failure.

### Asn.AppendSequence2

`Chilkat 11.7.0 · delphidll · Asn · AppendSequence2 · method · since 9.5.0.50`

```pascal
function CkAsn_AppendSequence2(objHandle: HCkAsn): wordbool; stdcall;
```

Appends an ASN.1 sequence item to the caller's sub-items, and updates the internal reference to point to the newly appended sequence item.

Returns True for success, False for failure.

### Asn.AppendSequenceR

`Chilkat 11.7.0 · delphidll · Asn · AppendSequenceR · method · since 9.5.0.50`

```pascal
function CkAsn_AppendSequenceR(objHandle: HCkAsn): HCkAsn; stdcall;
```

Appends an ASN.1 sequence item to the caller's sub-items, and returns the newly appended sequence item.

Returns `nil` on failure

### Asn.AppendSet

`Chilkat 11.7.0 · delphidll · Asn · AppendSet · method · since 9.5.0.49`

```pascal
function CkAsn_AppendSet(objHandle: HCkAsn): wordbool; stdcall;
```

Appends an ASN.1 set item to the caller's sub-items.

Returns True for success, False for failure.

### Asn.AppendSet2

`Chilkat 11.7.0 · delphidll · Asn · AppendSet2 · method · since 9.5.0.50`

```pascal
function CkAsn_AppendSet2(objHandle: HCkAsn): wordbool; stdcall;
```

Appends an ASN.1 set item to the caller's sub-items, and updates the internal reference to point to the newly appended set item.

Returns True for success, False for failure.

### Asn.AppendSetR

`Chilkat 11.7.0 · delphidll · Asn · AppendSetR · method · since 9.5.0.50`

```pascal
function CkAsn_AppendSetR(objHandle: HCkAsn): HCkAsn; stdcall;
```

Appends an ASN.1 set item to the caller's sub-items, and returns the newly appended set item.

Returns `nil` on failure

### Asn.AppendString

`Chilkat 11.7.0 · delphidll · Asn · AppendString · method · since 9.5.0.49`

```pascal
function CkAsn_AppendString(objHandle: HCkAsn;
    strType: PWideChar;
    value: PWideChar): wordbool; stdcall;
```

Appends a string item to the caller's sub-items. The `strType` specifies the type of string to be added. It may be `utf8`, `ia5`, `t61`, `printable`, `visible`, `numeric`, `universal`, or `bmp`. The `value` must conform to the ASN.1 restrictions imposed for a given string type. The `utf8`, `bmp`, and `universal` types have no restrictions on what characters are allowed. In general, unless a specific type of string is required, choose the `utf8` type.

Returns True for success, False for failure.

### Asn.AppendTime

`Chilkat 11.7.0 · delphidll · Asn · AppendTime · method · since 9.5.0.49`

```pascal
function CkAsn_AppendTime(objHandle: HCkAsn;
    timeFormat: PWideChar;
    dateTimeStr: PWideChar): wordbool; stdcall;
```

Appends a UTCTime item to the caller's sub-items. The `timeFormat` specifies the format of the `dateTimeStr`. It should be set to `utc`. (In the future, this method will be expanded to append GeneralizedTime items by using `generalized` for `timeFormat`.) To append the current date/time, set `dateTimeStr` equal to the empty string or the keyword `now`. Otherwise, the `dateTimeStr` should be in the UTC time format `YYMMDDhhmm[ss]Z` or `YYMMDDhhmm[ss](+|-)hhmm`.

Returns True for success, False for failure.

### Asn.AsnToXml

`Chilkat 11.7.0 · delphidll · Asn · AsnToXml · method · since 9.5.0.49`

```pascal
function CkAsn_AsnToXml(objHandle: HCkAsn;
    outStr: HCkString): wordbool; stdcall;
function CkAsn__asnToXml(objHandle: HCkAsn): PWideChar; stdcall;
```

Converts ASN.1 to XML and returns the XML string.

Returns True for success, False for failure.

See the notes about [PWideChar memory ownership and validity](https://www.chilkatsoft.com/delphi_pwidechar.asp).

### Asn.DeleteSubItem

`Chilkat 11.7.0 · delphidll · Asn · DeleteSubItem · method · since 9.5.0.49`

```pascal
function CkAsn_DeleteSubItem(objHandle: HCkAsn;
    index: Integer): wordbool; stdcall;
```

Discards the Nth sub-item. (The 1st sub-item is at index 0.)

Returns True for success, False for failure.

### Asn.GetEncodedContent

`Chilkat 11.7.0 · delphidll · Asn · GetEncodedContent · method · since 9.5.0.49`

```pascal
function CkAsn_GetEncodedContent(objHandle: HCkAsn;
    encoding: PWideChar;
    outStr: HCkString): wordbool; stdcall;
function CkAsn__getEncodedContent(objHandle: HCkAsn;
    encoding: PWideChar): PWideChar; stdcall;
```

Returns the content of the ASN.1 item in encoded string form. The `encoding` may be any of the following encodings: `Base64`, `Hex`, `Base58`, `modBase64`, `Base32`, `UU`, `QP` (for quoted-printable), `URL` (for url-encoding), `Q`, `B`, `url_oath`, `url_rfc1738`, `url_rfc2396`, and `url_rfc3986`. The `encoding` name is case insensitive (for example, both `Base64` and `base64` are treated the same).

Returns True for success, False for failure.

See the notes about [PWideChar memory ownership and validity](https://www.chilkatsoft.com/delphi_pwidechar.asp).

### Asn.GetEncodedDer

`Chilkat 11.7.0 · delphidll · Asn · GetEncodedDer · method · since 9.5.0.49`

```pascal
function CkAsn_GetEncodedDer(objHandle: HCkAsn;
    encoding: PWideChar;
    outStr: HCkString): wordbool; stdcall;
function CkAsn__getEncodedDer(objHandle: HCkAsn;
    encoding: PWideChar): PWideChar; stdcall;
```

Returns the binary DER in encoded string form. The `encoding` indicates the encoding and can be `base64`, `hex`, `uu`, `quoted-printable`, `base32`, or `modbase64`.

Returns True for success, False for failure.

See the notes about [PWideChar memory ownership and validity](https://www.chilkatsoft.com/delphi_pwidechar.asp).

### Asn.GetLastSubItem

`Chilkat 11.7.0 · delphidll · Asn · GetLastSubItem · method · since 9.5.0.49`

```pascal
function CkAsn_GetLastSubItem(objHandle: HCkAsn): HCkAsn; stdcall;
```

Returns the last ASN.1 sub-item. This method can be called immediately after any Append\* method to access the appended item.

Returns `nil` on failure

### Asn.GetSubItem

`Chilkat 11.7.0 · delphidll · Asn · GetSubItem · method · since 9.5.0.49`

```pascal
function CkAsn_GetSubItem(objHandle: HCkAsn;
    index: Integer): HCkAsn; stdcall;
```

Returns the Nth ASN.1 sub-item. The 1st sub-item is at index 0.

Returns `nil` on failure

### Asn.LoadAsnXml

`Chilkat 11.7.0 · delphidll · Asn · LoadAsnXml · method · since 9.5.0.49`

```pascal
function CkAsn_LoadAsnXml(objHandle: HCkAsn;
    xmlStr: PWideChar): wordbool; stdcall;
```

Loads ASN.1 from the XML representation (such as that created by the AsnToXml method).

Returns True for success, False for failure.

### Asn.LoadBd

`Chilkat 11.7.0 · delphidll · Asn · LoadBd · method · since 9.5.0.77`

```pascal
function CkAsn_LoadBd(objHandle: HCkAsn;
    bd: HCkBinData): wordbool; stdcall;
```

Loads ASN.1 from the binary DER contained in `bd`.

Returns True for success, False for failure.

### Asn.LoadBinaryFile

`Chilkat 11.7.0 · delphidll · Asn · LoadBinaryFile · method · since 9.5.0.49`

```pascal
function CkAsn_LoadBinaryFile(objHandle: HCkAsn;
    path: PWideChar): wordbool; stdcall;
```

Loads ASN.1 from a binary DER file.

Returns True for success, False for failure.

### Asn.LoadEncoded

`Chilkat 11.7.0 · delphidll · Asn · LoadEncoded · method · since 9.5.0.49`

```pascal
function CkAsn_LoadEncoded(objHandle: HCkAsn;
    asnContent: PWideChar;
    encoding: PWideChar): wordbool; stdcall;
```

Loads ASN.1 from an encoded string. The `encoding` can be `base64`, `hex`, `uu`, `quoted-printable`, `base32`, or `modbase64`.

Returns True for success, False for failure.

### Asn.SetEncodedContent

`Chilkat 11.7.0 · delphidll · Asn · SetEncodedContent · method · since 9.5.0.49`

```pascal
function CkAsn_SetEncodedContent(objHandle: HCkAsn;
    encodedBytes: PWideChar;
    encoding: PWideChar): wordbool; stdcall;
```

Sets the content of this primitive ASN.1 item. The `encoding` may be any of the following encodings: `Base64`, `Hex`, `Base58`, `modBase64`, `Base32`, `UU`, `QP` (for quoted-printable), `URL` (for url-encoding), `Q`, `B`, `url_oath`, `url_rfc1738`, `url_rfc2396`, and `url_rfc3986`. The `encoding` name is case insensitive (for example, both `Base64` and `base64` are treated the same).

Returns True for success, False for failure.

### Asn.WriteBd

`Chilkat 11.7.0 · delphidll · Asn · WriteBd · method · since 9.5.0.77`

```pascal
function CkAsn_WriteBd(objHandle: HCkAsn;
    bd: HCkBinData): wordbool; stdcall;
```

Appends the ASN.1 in binary DER format to `bd`.

Returns True for success, False for failure.

### Asn.WriteBinaryDer

`Chilkat 11.7.0 · delphidll · Asn · WriteBinaryDer · method · since 9.5.0.49`

```pascal
function CkAsn_WriteBinaryDer(objHandle: HCkAsn;
    path: PWideChar): wordbool; stdcall;
```

Writes the ASN.1 in binary DER form to a file.

Returns True for success, False for failure.

## Deprecated members — do not use in new code

| Member | Kind | Deprecated in | Use instead |
|---|---|---|---|
| `GetBinaryDer` | method | before 11.6.1 | — |
| `LoadBinary` | method | before 11.6.1 | — |

## Related classes

[`BinData`](https://www.chilkatsoft.com/ai-docs/v/11.7.0/delphidll/classes/BinData.md)

