---
product: Chilkat
product_version: 11.7.0
language: wc
language_label: Unicode C
class: Asn
license: bundle
deprecated: false
reference_html: https://www.chilkatsoft.com/refdoc/wc_CkAsnWRef.html
---
# Chilkat Asn — Unicode C — v11.7.0

> Chilkat 11.7.0 · language=wc · 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/wc/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**

```c
HCkAsnW instance = CkAsnW_Create();
// ...
CkAsnW_Dispose(instance);
```

`HCkAsnW CkAsnW_Create(void);`

Creates an instance of the HCkAsnW object and returns a handle ("void \*" pointer). The handle is passed in the 1st argument for the functions listed on this page.

`void CkAsnW_Dispose(HCkAsnW handle);`

Objects created by calling CkAsnW_Create must be freed by calling this method. A memory leak occurs if a handle is not disposed by calling this function. Also, any handle returned by a Chilkat "C" function must also be freed by the application by calling the appropriate Dispose method, such as CkAsnW_Dispose.

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 Unicode C.

## 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` | `void CkAsnW_getDebugLogFilePath(HCkAsnW cHandle, HCkString retval); void CkAsnW_putDebugLogFilePath(HCkAsnW cHandle, const wchar_t *newVal); const wchar_t *CkAsnW_debugLogFilePath(HCkAsnW cHandle);` | 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` | `void CkAsnW_getLastErrorHtml(HCkAsnW cHandle, HCkString retval); const wchar_t *CkAsnW_lastErrorHtml(HCkAsnW cHandle);` | read-only | Provides HTML-formatted information about the last called method or property. |
| `LastErrorText` | `void CkAsnW_getLastErrorText(HCkAsnW cHandle, HCkString retval); const wchar_t *CkAsnW_lastErrorText(HCkAsnW cHandle);` | read-only | Provides plain text information about the last called method or property. |
| `LastErrorXml` | `void CkAsnW_getLastErrorXml(HCkAsnW cHandle, HCkString retval); const wchar_t *CkAsnW_lastErrorXml(HCkAsnW cHandle);` | read-only | Provides XML-formatted information about the last called method or property. |
| `LastMethodSuccess` | `BOOL CkAsnW_getLastMethodSuccess(HCkAsnW cHandle); void CkAsnW_putLastMethodSuccess(HCkAsnW cHandle, BOOL newVal);` | read/write | Indicates the success or failure of the most recent method call: `TRUE` means success, `FALSE` means failure. |
| `VerboseLogging` | `BOOL CkAsnW_getVerboseLogging(HCkAsnW cHandle); void CkAsnW_putVerboseLogging(HCkAsnW cHandle, BOOL newVal);` | read/write | If set to `TRUE`, then the contents of LastErrorText (or LastErrorXml, or LastErrorHtml) may contain more verbose information. |
| `Version` | `void CkAsnW_getVersion(HCkAsnW cHandle, HCkString retval); const wchar_t *CkAsnW_version(HCkAsnW cHandle);` | read-only | Version of the component/library, such as "10.1.0" |

## Member index

| Member | Kind | Signature |
|---|---|---|
| `BoolValue` | property, read/write | `BOOL CkAsnW_getBoolValue(HCkAsnW cHandle); void CkAsnW_putBoolValue(HCkAsnW cHandle, BOOL newVal);` |
| `Constructed` | property, read-only | `BOOL CkAsnW_getConstructed(HCkAsnW cHandle);` |
| `ContentStr` | property, read/write | `void CkAsnW_getContentStr(HCkAsnW cHandle, HCkString retval); void CkAsnW_putContentStr(HCkAsnW cHandle, const wchar_t *newVal); const wchar_t *CkAsnW_contentStr(HCkAsnW cHandle);` |
| `IntValue` | property, read/write | `int CkAsnW_getIntValue(HCkAsnW cHandle); void CkAsnW_putIntValue(HCkAsnW cHandle, int newVal);` |
| `NumSubItems` | property, read-only | `int CkAsnW_getNumSubItems(HCkAsnW cHandle);` |
| `Tag` | property, read-only | `void CkAsnW_getTag(HCkAsnW cHandle, HCkString retval); const wchar_t *CkAsnW_tag(HCkAsnW cHandle);` |
| `TagValue` | property, read-only | `int CkAsnW_getTagValue(HCkAsnW cHandle);` |
| `AppendBigInt` | method | `BOOL CkAsnW_AppendBigInt(HCkAsnW cHandle, const wchar_t *encodedBytes, const wchar_t *encoding);` |
| `AppendBits` | method | `BOOL CkAsnW_AppendBits(HCkAsnW cHandle, const wchar_t *encodedBytes, const wchar_t *encoding);` |
| `AppendBool` | method | `BOOL CkAsnW_AppendBool(HCkAsnW cHandle, BOOL value);` |
| `AppendContextConstructed` | method | `BOOL CkAsnW_AppendContextConstructed(HCkAsnW cHandle, int tag);` |
| `AppendContextPrimitive` | method | `BOOL CkAsnW_AppendContextPrimitive(HCkAsnW cHandle, int tag, const wchar_t *encodedBytes, const wchar_t *encoding);` |
| `AppendInt` | method | `BOOL CkAsnW_AppendInt(HCkAsnW cHandle, int value);` |
| `AppendNull` | method | `BOOL CkAsnW_AppendNull(HCkAsnW cHandle);` |
| `AppendOctets` | method | `BOOL CkAsnW_AppendOctets(HCkAsnW cHandle, const wchar_t *encodedBytes, const wchar_t *encoding);` |
| `AppendOid` | method | `BOOL CkAsnW_AppendOid(HCkAsnW cHandle, const wchar_t *oid);` |
| `AppendSequence` | method | `BOOL CkAsnW_AppendSequence(HCkAsnW cHandle);` |
| `AppendSequence2` | method | `BOOL CkAsnW_AppendSequence2(HCkAsnW cHandle);` |
| `AppendSequenceR` | method | `HCkAsnW CkAsnW_AppendSequenceR(HCkAsnW cHandle);` |
| `AppendSet` | method | `BOOL CkAsnW_AppendSet(HCkAsnW cHandle);` |
| `AppendSet2` | method | `BOOL CkAsnW_AppendSet2(HCkAsnW cHandle);` |
| `AppendSetR` | method | `HCkAsnW CkAsnW_AppendSetR(HCkAsnW cHandle);` |
| `AppendString` | method | `BOOL CkAsnW_AppendString(HCkAsnW cHandle, const wchar_t *strType, const wchar_t *value);` |
| `AppendTime` | method | `BOOL CkAsnW_AppendTime(HCkAsnW cHandle, const wchar_t *timeFormat, const wchar_t *dateTimeStr);` |
| `AsnToXml` | method | `BOOL CkAsnW_AsnToXml(HCkAsnW cHandle, const wchar_t *outStr); const wchar_t *CkAsnW_asnToXml(HCkAsnW cHandle);` |
| `DeleteSubItem` | method | `BOOL CkAsnW_DeleteSubItem(HCkAsnW cHandle, int index);` |
| `GetEncodedContent` | method | `BOOL CkAsnW_GetEncodedContent(HCkAsnW cHandle, const wchar_t *encoding, const wchar_t *outStr); const wchar_t *CkAsnW_getEncodedContent(HCkAsnW cHandle, const wchar_t *encoding);` |
| `GetEncodedDer` | method | `BOOL CkAsnW_GetEncodedDer(HCkAsnW cHandle, const wchar_t *encoding, const wchar_t *outStr); const wchar_t *CkAsnW_getEncodedDer(HCkAsnW cHandle, const wchar_t *encoding);` |
| `GetLastSubItem` | method | `HCkAsnW CkAsnW_GetLastSubItem(HCkAsnW cHandle);` |
| `GetSubItem` | method | `HCkAsnW CkAsnW_GetSubItem(HCkAsnW cHandle, int index);` |
| `LoadAsnXml` | method | `BOOL CkAsnW_LoadAsnXml(HCkAsnW cHandle, const wchar_t *xmlStr);` |
| `LoadBd` | method | `BOOL CkAsnW_LoadBd(HCkAsnW cHandle, HCkBinDataW bd);` |
| `LoadBinaryFile` | method | `BOOL CkAsnW_LoadBinaryFile(HCkAsnW cHandle, const wchar_t *path);` |
| `LoadEncoded` | method | `BOOL CkAsnW_LoadEncoded(HCkAsnW cHandle, const wchar_t *asnContent, const wchar_t *encoding);` |
| `SetEncodedContent` | method | `BOOL CkAsnW_SetEncodedContent(HCkAsnW cHandle, const wchar_t *encodedBytes, const wchar_t *encoding);` |
| `WriteBd` | method | `BOOL CkAsnW_WriteBd(HCkAsnW cHandle, HCkBinDataW bd);` |
| `WriteBinaryDer` | method | `BOOL CkAsnW_WriteBinaryDer(HCkAsnW cHandle, const wchar_t *path);` |

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 · wc · Asn · BoolValue · property · read/write · since 9.5.0.49`

```c
BOOL CkAsnW_getBoolValue(HCkAsnW cHandle);
void CkAsnW_putBoolValue(HCkAsnW cHandle, BOOL newVal);
```

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

### Asn.Constructed

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

```c
BOOL CkAsnW_getConstructed(HCkAsnW cHandle);
```

`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 · wc · Asn · ContentStr · property · read/write · since 9.5.0.49`

```c
void CkAsnW_getContentStr(HCkAsnW cHandle, HCkString retval);
void CkAsnW_putContentStr(HCkAsnW cHandle, const wchar_t *newVal);
const wchar_t *CkAsnW_contentStr(HCkAsnW cHandle);
```

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 · wc · Asn · IntValue · property · read/write · since 9.5.0.49`

```c
int CkAsnW_getIntValue(HCkAsnW cHandle);
void CkAsnW_putIntValue(HCkAsnW cHandle, int newVal);
```

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

### Asn.NumSubItems

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

```c
int CkAsnW_getNumSubItems(HCkAsnW cHandle);
```

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 · wc · Asn · Tag · property · read-only · since 9.5.0.49`

```c
void CkAsnW_getTag(HCkAsnW cHandle, HCkString retval);
const wchar_t *CkAsnW_tag(HCkAsnW cHandle);
```

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 · wc · Asn · TagValue · property · read-only · since 9.5.0.49`

```c
int CkAsnW_getTagValue(HCkAsnW cHandle);
```

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 · wc · Asn · AppendBigInt · method · since 9.5.0.49`

```c
BOOL CkAsnW_AppendBigInt(HCkAsnW cHandle, const wchar_t *encodedBytes, const wchar_t *encoding);
```

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 · wc · Asn · AppendBits · method · since 9.5.0.49`

```c
BOOL CkAsnW_AppendBits(HCkAsnW cHandle, const wchar_t *encodedBytes, const wchar_t *encoding);
```

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 · wc · Asn · AppendBool · method · since 9.5.0.49`

```c
BOOL CkAsnW_AppendBool(HCkAsnW cHandle, BOOL value);
```

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 · wc · Asn · AppendContextConstructed · method · since 9.5.0.50`

```c
BOOL CkAsnW_AppendContextConstructed(HCkAsnW cHandle, int tag);
```

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 · wc · Asn · AppendContextPrimitive · method · since 9.5.0.50`

```c
BOOL CkAsnW_AppendContextPrimitive(HCkAsnW cHandle, int tag, const wchar_t *encodedBytes, const wchar_t *encoding);
```

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 · wc · Asn · AppendInt · method · since 9.5.0.49`

```c
BOOL CkAsnW_AppendInt(HCkAsnW cHandle, int value);
```

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 · wc · Asn · AppendNull · method · since 9.5.0.49`

```c
BOOL CkAsnW_AppendNull(HCkAsnW cHandle);
```

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 · wc · Asn · AppendOctets · method · since 9.5.0.49`

```c
BOOL CkAsnW_AppendOctets(HCkAsnW cHandle, const wchar_t *encodedBytes, const wchar_t *encoding);
```

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 · wc · Asn · AppendOid · method · since 9.5.0.49`

```c
BOOL CkAsnW_AppendOid(HCkAsnW cHandle, const wchar_t *oid);
```

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 · wc · Asn · AppendSequence · method · since 9.5.0.49`

```c
BOOL CkAsnW_AppendSequence(HCkAsnW cHandle);
```

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 · wc · Asn · AppendSequence2 · method · since 9.5.0.50`

```c
BOOL CkAsnW_AppendSequence2(HCkAsnW cHandle);
```

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 · wc · Asn · AppendSequenceR · method · since 9.5.0.50`

```c
HCkAsnW CkAsnW_AppendSequenceR(HCkAsnW cHandle);
```

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

Returns `NULL` on failure

### Asn.AppendSet

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

```c
BOOL CkAsnW_AppendSet(HCkAsnW cHandle);
```

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 · wc · Asn · AppendSet2 · method · since 9.5.0.50`

```c
BOOL CkAsnW_AppendSet2(HCkAsnW cHandle);
```

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 · wc · Asn · AppendSetR · method · since 9.5.0.50`

```c
HCkAsnW CkAsnW_AppendSetR(HCkAsnW cHandle);
```

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

Returns `NULL` on failure

### Asn.AppendString

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

```c
BOOL CkAsnW_AppendString(HCkAsnW cHandle, const wchar_t *strType, const wchar_t *value);
```

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 · wc · Asn · AppendTime · method · since 9.5.0.49`

```c
BOOL CkAsnW_AppendTime(HCkAsnW cHandle, const wchar_t *timeFormat, const wchar_t *dateTimeStr);
```

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 · wc · Asn · AsnToXml · method · since 9.5.0.49`

```c
BOOL CkAsnW_AsnToXml(HCkAsnW cHandle, const wchar_t *outStr);
const wchar_t *CkAsnW_asnToXml(HCkAsnW cHandle);
```

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

Returns TRUE for success, FALSE for failure.

### Asn.DeleteSubItem

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

```c
BOOL CkAsnW_DeleteSubItem(HCkAsnW cHandle, int index);
```

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 · wc · Asn · GetEncodedContent · method · since 9.5.0.49`

```c
BOOL CkAsnW_GetEncodedContent(HCkAsnW cHandle, const wchar_t *encoding, const wchar_t *outStr);
const wchar_t *CkAsnW_getEncodedContent(HCkAsnW cHandle, const wchar_t *encoding);
```

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.

### Asn.GetEncodedDer

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

```c
BOOL CkAsnW_GetEncodedDer(HCkAsnW cHandle, const wchar_t *encoding, const wchar_t *outStr);
const wchar_t *CkAsnW_getEncodedDer(HCkAsnW cHandle, const wchar_t *encoding);
```

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.

### Asn.GetLastSubItem

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

```c
HCkAsnW CkAsnW_GetLastSubItem(HCkAsnW cHandle);
```

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

Returns `NULL` on failure

### Asn.GetSubItem

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

```c
HCkAsnW CkAsnW_GetSubItem(HCkAsnW cHandle, int index);
```

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

Returns `NULL` on failure

### Asn.LoadAsnXml

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

```c
BOOL CkAsnW_LoadAsnXml(HCkAsnW cHandle, const wchar_t *xmlStr);
```

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 · wc · Asn · LoadBd · method · since 9.5.0.77`

```c
BOOL CkAsnW_LoadBd(HCkAsnW cHandle, HCkBinDataW bd);
```

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

Returns TRUE for success, FALSE for failure.

### Asn.LoadBinaryFile

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

```c
BOOL CkAsnW_LoadBinaryFile(HCkAsnW cHandle, const wchar_t *path);
```

Loads ASN.1 from a binary DER file.

Returns TRUE for success, FALSE for failure.

### Asn.LoadEncoded

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

```c
BOOL CkAsnW_LoadEncoded(HCkAsnW cHandle, const wchar_t *asnContent, const wchar_t *encoding);
```

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 · wc · Asn · SetEncodedContent · method · since 9.5.0.49`

```c
BOOL CkAsnW_SetEncodedContent(HCkAsnW cHandle, const wchar_t *encodedBytes, const wchar_t *encoding);
```

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 · wc · Asn · WriteBd · method · since 9.5.0.77`

```c
BOOL CkAsnW_WriteBd(HCkAsnW cHandle, HCkBinDataW bd);
```

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

Returns TRUE for success, FALSE for failure.

### Asn.WriteBinaryDer

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

```c
BOOL CkAsnW_WriteBinaryDer(HCkAsnW cHandle, const wchar_t *path);
```

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/wc/classes/BinData.md)

