# NetCode Class

The NetCode class can be used to encode or decode files or strings using a variety of popular encoding formats, such as Base64, UUencode, and URL. UUEncode , MIME's Base64 Quoted-Printable , and URL encoding formats, as well as secure hash functions such as MD5 and SHA1, are currently supported.

## Syntax

**ipworks.netcode()**

## Remarks

The encoding format is specified by the [Format](#netcodeformat-property) property. The binary data, or the name of the file containing binary data, is specified by the [DecodedData](#netcodedecodeddata-property) property and the encoded data or filename is specified by the [EncodedData](#netcodeencodeddata-property) property. The [FileName](#netcodefilename-property) property may be used to override the default file names or to specify a directory during uuencoding. After uudecoding, the [FileName](#netcodefilename-property) property contains the fully specified file name of the decoded file.

**Understanding Encoding/Decoding**

Most mail systems use only 7 bits to transmit messages. A binary file, such as an archive or a non-plaintext-formatted file produced from a text processor should be first encoded in 7-bit code before email transfer.

Decoding is the inverse process (i.e., creation of the original file from the encoded data). Encoded data are often split over several files because of the size limit placed on the email message. Each message is preceded by information about this splitting, as well as the mail header. NetCode supports this case in both directions:

- During *encoding*, setting the [MaxFileSize](#MaxFileSize) configuration setting to the maximum size of a message body instructs NetCode to split the encoded data over several files. Multiple filenames can be specified by using question marks "?" (see the [EncodedData](#netcodeencodeddata-property) property for more information).

- During *decoding*, the body messages can be saved in separate files named namexxx.ext, where xxx is a numeral starting at 000 and ext is ".uue", ".b16", or ".q_p" according to [Format](#netcodeformat-property). These multiple filenames should be given to [EncodedData](#netcodeencodeddata-property).

## Property List

*The following is the full list of the properties of the class with short descriptions. Click on the links for further details.*

|  |  |
| --- | --- |
| [DecodedData](#netcodedecodeddata-property) | This property includes the decoded data. |
| [DecodedFile](#netcodedecodedfile-property) | This property includes the filename of the decoded data. |
| [EncodedData](#netcodeencodeddata-property) | This property includes the encoded data. |
| [EncodedFile](#netcodeencodedfile-property) | This property includes the filename of the encoded data. |
| [FileCnt](#netcodefilecnt-property) | This property shows the number of encoded files the class has read from or written into. |
| [FileName](#netcodefilename-property) | This property includes the destination filename for the encoded data. |
| [Format](#netcodeformat-property) | This property includes the type of encoding to be used. |
| [Mode](#netcodemode-property) | This property includes the UNIX-style filemode when uuencoding and uudecoding. |
| [Overwrite](#netcodeoverwrite-property) | This property controls whether created file(s) should overwrite already existing file(s). |
| [ProgressStep](#netcodeprogressstep-property) | This property controls the granularity at which the Progress event is fired. Values are 0-100. |

## Method List

*The following is the full list of the methods of the class with short descriptions. Click on the links for further details.*

|  |  |
| --- | --- |
| [Config](#netcodeconfig-method) | Sets or retrieves a configuration setting. |
| [Decode](#netcodedecode-method) | This method decodes a string. |
| [Encode](#netcodeencode-method) | This method encodes the data. |
| [Reset](#netcodereset-method) | This method will reset the class. |
| [ResetData](#netcoderesetdata-method) | This method resets the values of all data and stream properties. |
| [SetInputStream](#netcodesetinputstream-method) | This method sets the input stream of data. |
| [SetOutputStream](#netcodesetoutputstream-method) | This method sets the output stream of data. |

## Event List

*The following is the full list of the events fired by the class with short descriptions. Click on the links for further details.*

|  |  |
| --- | --- |
| [Error](#netcodeerror-event) | Fired when information is available about errors during data delivery. |
| [Progress](#netcodeprogress-event) | This event occurs when PercentDone of the input is read. |

## Config Settings

*The following is a list of config settings for the class with short descriptions. Click on the links for further details.*

|  |  |
| --- | --- |
| [Base64LineBreak](#Base64LineBreak) | Tells the class whether to include line breaks in Base64 encoded content or not. |
| [EncodeHash](#EncodeHash) | Whether the hash value is hex encoded. |
| [HMACAlgorithm](#HMACAlgorithm) | The hash algorithm to use when generating a Hash-based Message Authentication Code (HMAC). |
| [HMACKey](#HMACKey) | A key to use when generating a Hash-based Message Authentication Code (HMAC). |
| [MaxFileSize](#MaxFileSize) | When encoding, controls whether encoded data should be split into several files and gives the maximum allowed size for these files. |
| [UseExtendedHexBase32](#UseExtendedHexBase32) | Specifies whether or not the Extended Hex alphabet is used. |
| [UseModifiedUTF7](#UseModifiedUTF7) | Specifies whether or not a modified form of UTF-7 for IMAP mailbox naming is used. |
| [BuildInfo](#BuildInfo) | Information about the product's build. |
| [CodePage](#CodePage) | The system code page used for Unicode to Multibyte translations. |
| [LicenseInfo](#LicenseInfo) | Information about the current license. |
| [MaskSensitiveData](#MaskSensitiveData) | Whether sensitive data is masked in log messages. |
| [UseInternalSecurityAPI](#UseInternalSecurityAPI) | Whether or not to use the system security libraries or an internal implementation. |

# [NetCode](#netcode-class).DecodedData Property

This property includes the decoded data.

## Syntax

```text
getDecodedData(): Uint8Array;
setDecodedData(decodedData: Uint8Array): void;
```

## Default Value

""

## Remarks

This property contains the decoded data. When uuencoding, the value of [FileName](#netcodefilename-property) is the filename that will be written in [EncodedData](#netcodeencodeddata-property). If [FileName](#netcodefilename-property) is empty, an error will be returned.

This property is not available at design time.

# [NetCode](#netcode-class).DecodedFile Property

This property includes the filename of the decoded data.

## Syntax

```text
getDecodedFile(): string;
setDecodedFile(decodedFile: string): void;
```

## Default Value

""

## Remarks

This property contains the filename of the decoded data. When uuencoding, the value of [FileName](#netcodefilename-property) is the filename that will be written in [EncodedData](#netcodeencodeddata-property). If [FileName](#netcodefilename-property) is empty, the value of the DecodedFile property is taken, if a valid file has been specified. It is recommended that [EncodedData](#netcodeencodeddata-property) contains the full path and that [FileName](#netcodefilename-property) contains only the filename so that no problems occur while uudecoding in a foreign system.

When decoding, the class tries to generate the name for the created file in the following order: DecodedFile, [FileName](#netcodefilename-property), or when the format is UUEncode, the specified filename in the uuencoded data. If DecodedFile or [FileName](#netcodefilename-property) end with a backslash "\" they are interpreted as directories, and the class will try to create the given filename in this directory. If this is the case, [FileName](#netcodefilename-property) shows the name of the file that was created.

# [NetCode](#netcode-class).EncodedData Property

This property includes the encoded data.

## Syntax

```text
getEncodedData(): Uint8Array;
setEncodedData(encodedData: Uint8Array): void;
```

## Default Value

""

## Remarks

This property contains the data that either have been encoded or are set to be decoded.

This property is not available at design time.

# [NetCode](#netcode-class).EncodedFile Property

This property includes the filename of the encoded data.

## Syntax

```text
getEncodedFile(): string;
setEncodedFile(encodedFile: string): void;
```

## Default Value

""

## Remarks

This property contains the filename of the encoded data. If the encoded data are spread over several files, the filenames are passed to EncodedFile in the form *name?*. Question marks "?" are expanded to numerals starting with 0. The filenames should exist as *path\file000.ext* and are passed to EncodedFile in the form *name???*. Question marks "?" are expanded to numerals starting with 000 (the number of zeros "0" equals that of question marks "?").

The class appends the extension ".uue", ".b16", or ".q_p" depending on [Format](#netcodeformat-property) immediately after the generated numbers. [FileCnt](#netcodefilecnt-property) contains the number of encoded files.

See also the [Format](#netcodeformat-property) property, and the [MaxFileSize](#MaxFileSize) configuration setting when working with multiple files.

# [NetCode](#netcode-class).FileCnt Property

This property shows the number of encoded files the class has read from or written into.

## Syntax

```text
getFileCnt(): number;
```

## Default Value

0

## Remarks

This property shows the number of encoded files the class has read from or written into. If the user specifies one or more questions marks "?" in [EncodedFile](#netcodeencodedfile-property), they will be expanded from 000 to FileCnt - 1 (the number of question marks "?" specifies the number of figures).

Please refer to [EncodedFile](#netcodeencodedfile-property) for filename conventions.

This property is read-only.

# [NetCode](#netcode-class).FileName Property

This property includes the destination filename for the encoded data.

## Syntax

```text
getFileName(): string;
setFileName(fileName: string): void;
```

## Default Value

""

## Remarks

This property contains the destination filename for the encoded data. When uuencoding, this property contains the filename that is specified in the uuencoded data.

When decoding, if the value of the property is not empty, it shows the class where to write the decoded data. It can be either the filename or the directory where the file should be written. If is should be written to a directory, it should end with a backslash "\".

After a decode operation, this property contains the filename for the created file. If the file couldn't be created because of an illegal filename, examining this property might provide a hint about the reason of the failure.

This property must be set to "" (empty string) after each decode operation because it contains the full specification of the file.

An error occurs if a uuencoding operation is initiated with an empty FileName.

If you want to first check the uuencoded filename before creating it on disk, you may assign an illegal directory name to this property (always use a closing backslash "\" to denote it as a directory), then trap the error and check the filename appended to this property.

# [NetCode](#netcode-class).Format Property

This property includes the type of encoding to be used.

## Syntax

```text
getFormat(): NetCodeFormats;
setFormat(format: NetCodeFormats): void;
enum NetCodeFormats {
  fmtUUEncode,
  fmtBase64,
  fmtQP,
  fmtURL,
  fmtJIS,
  fmtYEncode,
  fmtMD5Hash,
  fmtSHA1Hash,
  fmtHex,
  fmtHTML,
  fmtHMAC,
  fmtUTF8,
  fmtUTF7,
  fmtBase32,
  fmtBase64URL,
  fmtSHA256Hash,
  fmtPunycode
}
```

## Default Value

0

## Remarks

This property contains the type of encoding to be used. The following are the possible values for this property, and the corresponding descriptions:

|  |  |
| --- | --- |
| fmtUUEncode (0) | 3 Bytes are encoded into 4 readable characters. If multiple filenames are specified, then the extension ".uue" is used/expected. |
| fmtBase64 (1) | Encoding format of MIME. This is much like UUEncode but another subset of printable characters is used. If multiple filenames are specified, then the extension ".b64" is used/expected. |
| fmtQP (2) | Quoted-Printable is another MIME format coding only special characters. It is mostly used if the text contains special accented characters. If multiple filenames are specified, then the extension ".q_p" is used/expected. |
| fmtURL (3) | Encoding of nonprintable, 8-bit or unsafe characters as defined in RFC 1738. (No multiple filenames can be specified with this encoding.) |
| fmtJIS (4) | Japanese Industrial Standards encoding of Japanese character sets. |
| fmtYEncode (5) | Similar to Base64, but uses 8-bit encoding to reduce the amount of data being sent and received. Designed for binaries on the Usenet or Email. |
| fmtMD5Hash (6) | The Message Digest 5 hashing algorithm produces a 128-bit hash output. |
| fmtSHA1Hash (7) | The Secure Hash Algorithm produces a 128-bit hash output. |
| fmtHex (8) | Creates a hexadecimal string representation of the decoded data. |
| fmtHTML (9) | Creates an HTML-encoded string. Supports decimal, hex, and named HTML character representations. |
| fmtHMAC (10) | Creates a Hash-based Message Authentication Code for the given data. To set the key, use [HMACKey](#HMACKey). To set the hash algorithm to use to create the MAC, use [HMACAlgorithm](#HMACAlgorithm). |
| fmtUTF8 (11) | Converts strings to/from UTF-8 to the current code page (Windows only). |
| fmtUTF7 (12) | Converts strings to/from UTF-7 to the current code page (Windows only). |
| fmtBase32 (13) | Similar to Base64, but uses 32 printable characters. If multiple filenames are specified, then the extension ".b32" is used/expected. |
| fmtBase64URL (14) | Base64 encoding for use within URLs. The "+" character is replaced with "-". The "/" character is replaced with "_". The padding character "=" is omitted. |
| fmtSHA256 (15) | The Secure Hash Algorithm 2 produces a 256-bit hash output. |
| fmtPunycode (16) | Converts string to/from Punycode. The [CodePage](#CodePage) configuration setting must be set to a value capable of interpreting the non-ASCII character data being encoded/decoded. For instance 65001. |

# [NetCode](#netcode-class).Mode Property

This property includes the UNIX-style filemode when uuencoding and uudecoding.

## Syntax

```text
getMode(): string;
setMode(mode: string): void;
```

## Default Value

"0755"

## Remarks

This property contains the UNIX-style filemode when uuencoding and uudecoding. The filemode is usually an octal number, such as 755 or 600, which gives the protections of that file. If the file to uudecode is correctly read, then this property contains the protection string given in the uuencoded data.

This is given for compatibility with other systems and is used only when [Format](#netcodeformat-property) is fmtUUE.

# [NetCode](#netcode-class).Overwrite Property

This property controls whether created file(s) should overwrite already existing file(s).

## Syntax

```text
isOverwrite(): boolean;
setOverwrite(overwrite: boolean): void;
```

## Default Value

FALSE

## Remarks

This property controls whether created file(s) should overwrite already existing file(s).

NOTE: More than one file may be created during uuencoding.

# [NetCode](#netcode-class).ProgressStep Property

This property controls the granularity at which the Progress event is fired. Values are 0-100.

## Syntax

```text
getProgressStep(): number;
setProgressStep(progressStep: number): void;
```

## Default Value

1

## Remarks

This property controls the granularity at which the [Progress](#netcodeprogress-event) event is fired. Values are 0-100. If this property is not 0, the [Progress](#netcodeprogress-event) event will be fired when 0%, n* ProgressStep and 100% of input data are read.

If this property is 0, the [Progress](#netcodeprogress-event) event is disabled.

# [NetCode](#netcode-class).config Method

Sets or retrieves a configuration setting.

## Syntax

```text
async netcode.config(configurationString : string): Promise< string>
```

## Remarks

Config is a generic method available in every class. It is used to set and retrieve [configuration settings](#config-settings-class-ipworksnetcode) for the class.

These settings are similar in functionality to properties, but they are rarely used. In order to avoid "polluting" the property namespace of the class, access to these *internal properties* is provided through the Config method.

To set a configuration setting named *PROPERTY*, you must call *Config("PROPERTY=VALUE")*, where *VALUE* is the value of the setting expressed as a string. For boolean values, use the strings "True", "False", "0", "1", "Yes", or "No" (case does not matter).

To read (query) the value of a [configuration setting](#config-settings-class-ipworksnetcode), you must call *Config("PROPERTY")*. The value will be returned as a string.

# [NetCode](#netcode-class).decode Method

This method decodes a string.

## Syntax

```text
async netcode.decode(): Promise< void>
```

## Remarks

This method decodes according to the [Format](#netcodeformat-property) type. The class will decode the data in the input stream if [SetInputStream](#netcodesetinputstream-method) has been set to a valid stream. If this stream is null, the class will then try to read the data from the file set by the [EncodedFile](#netcodeencodedfile-property) property. If no valid file has been specified, the class will use the [EncodedData](#netcodeencodeddata-property) property.

The resulting decoded data are written to the output stream if one has been set. If not, the component will attempt to write the decoded data to the [DecodedFile](#netcodedecodedfile-property). If no file was specified, the decoded data may be retrieved through the [DecodedData](#netcodedecodeddata-property) property.

When UUDecoding the created filename will by default be the one specified in the uuencoded data. The [FileName](#netcodefilename-property) property will contain this value. [DecodedFile](#netcodedecodedfile-property) or, if [DecodedFile](#netcodedecodedfile-property) is empty, [FileName](#netcodefilename-property) can be used to override this value.

When YDecoding, the source path and filename is specified in [EncodedFile](#netcodeencodedfile-property) and the destination path and filename in [DecodedFile](#netcodedecodedfile-property). If the encoded data indicate the name of the original file before decoding, this value will be stored in the [FileName](#netcodefilename-property) property. To decode a multipart message, all parts must be concatenated in order in the source file.

# [NetCode](#netcode-class).encode Method

This method encodes the data.

## Syntax

```text
async netcode.encode(): Promise< void>
```

## Remarks

This method encodes the data according to the [Format](#netcodeformat-property) type. The class will encode the data in the input stream if [SetInputStream](#netcodesetinputstream-method) has been set to a valid stream. If this stream is null, the class will then try to read the data from the file set by the [DecodedFile](#netcodedecodedfile-property) property. If no valid file has been specified, the class will use the [DecodedData](#netcodedecodeddata-property) property.

The resulting encoded data are written to the output stream if one has been set. If not, the component will attempt to write the encoded data to the [EncodedFile](#netcodeencodedfile-property). If no file was specified, the encoded data may be retrieved through the [EncodedData](#netcodeencodeddata-property) property.

The data are considered binary while uuencoding and Base64 [Format](#netcodeformat-property)s, and text during QuotedPrintable ones.

When uuencoding or yencoding, the filename encoded into the data is taken from the [FileName](#netcodefilename-property) property.

The current version of NetCode does not create message headers. If a MIME standard encoding is used, such as Base64 Encoding or Quoted Printable Encoding, the user should fill the header values appropriately.

If [EncodedFile](#netcodeencodedfile-property) and [MaxFileSize](#MaxFileSize) is set and the encoded data take more space than [MaxFileSize](#MaxFileSize), the data are split over several files. In this case, the user can specify more than one filename by passing them to [EncodedFile](#netcodeencodedfile-property) in the form *name?*. The filenames should exist as *path\file0.ext*, *path\file1.ext* ... Question marks "?" are expanded to numerals starting with 0. NetCode appends the extension ".uue", ".b16", or ".q_p" (depending on the value of [Format](#netcodeformat-property)) to the filename.

# [NetCode](#netcode-class).reset Method

This method will reset the class.

## Syntax

```text
async netcode.reset(): Promise< void>
```

## Remarks

This method will reset the class's properties to their default values.

# [NetCode](#netcode-class).resetData Method

This method resets the values of all data and stream properties.

## Syntax

```text
async netcode.resetData(): Promise< void>
```

## Remarks

This method resets the values of all data and stream properties. It is an easy way to reset the class's properties before another call to [Encode](#netcodeencode-method) or [Decode](#netcodedecode-method). The input and output streams and the data and file properties will all be reset.

# [NetCode](#netcode-class).setInputStream Method

This method sets the input stream of data.

## Syntax

```text
async netcode.setInputStream(inputStream : ReadableStream): Promise< void>
```

## Remarks

Use this method to set the input stream of data for the component to read from. If [Encode](#netcodeencode-method) or [Decode](#netcodedecode-method) is called, and this is not null, the data will be read from this stream when the specified action occurs. You may reset this by calling [ResetData](#netcoderesetdata-method).

# [NetCode](#netcode-class).setOutputStream Method

This method sets the output stream of data.

## Syntax

```text
async netcode.setOutputStream(outputStream : WriteableStream): Promise< void>
```

## Remarks

Use this method to set the output stream of data for the component to write. If [Encode](#netcodeencode-method) or [Decode](#netcodedecode-method) is called, and this is not null, the data will be written to this stream when the specified action occurs. You may reset this by calling [ResetData](#netcoderesetdata-method).

# [NetCode](#netcode-class).Error Event

Fired when information is available about errors during data delivery.

## Syntax

```text
netcode.on('Error', listener: (e: {readonly errorCode: number, readonly description: string}) => void )
```

## Remarks

The Error event is fired in case of exceptional conditions during message processing. Normally the class .

The *ErrorCode* parameter contains an error code, and the *Description* parameter contains a textual description of the error. For a list of valid error codes and their descriptions, please refer to the [Error Codes](#trappable-errors-class-ipworksnetcode) section.

# [NetCode](#netcode-class).Progress Event

This event occurs when PercentDone of the input is read.

## Syntax

```text
netcode.on('Progress', listener: (e: {readonly percentDone: number}) => void )
```

## Remarks

The [ProgressStep](#netcodeprogressstep-property) property determines how often the event is fired.

# ReadableStream Type

## Syntax

```text
interface ReadableStream {
  read(buffer: Uint8Array, offset: number, length: number): Promise<number>;
  readSync(buffer: Uint8Array, offset: number, length: number): number;
  available(): number;
  close(): void;
  mark():void;
  reset():void;
  markSupported():boolean;
}
```

## Remarks

 The NetCode class includes one or more API methods that accept a stream object as a parameter. To use such API members, create a custom object that implements the ReadableStream interface, and pass an instance of this object to the NetCode class.

 When implementing the ReadableStream interface's properties and methods, they must behave as described below. If the implementation does not behave as expected, undefined behavior may occur.

```text
read(buffer: Uint8Array, offset: number, length: number): Promise <number> { }
```

```text
readSync(buffer: Uint8Array, offset: number, length: number): number { }
```

```text
available(): number { }
```

```text
close(): void { }
```

```text
mark(): void { }
```

```text
reset(): void { }
```

```text
markSupported(): boolean { }
```

|  |  |
| --- | --- |
| Methods |  |
| The following parameters are supported | buffer: The buffer to store the read data. <br> offset: The starting position within the buffer to write data.<br> length: The maximum number of bytes to read.<br> |
| read | Reads data from the stream into the provided buffer. This method must be implemented.<br> Returns a promise resolving to the number of bytes read, -1 if no data is available. |
| readSync | Synchronously reads data from the stream into the buffer. Returns the number of bytes read, -1 if no data is available. |
| available | Returns the number of bytes available for reading. This method must be implemented.<br> |
| close | Closes the stream and releases associated resources. |
| mark | Marks the current position in this stream. |
| reset | Repositions this stream to the position at the time the mark method was last called. |
| markSupported | Tests if this stream supports the mark and reset methods. Returns true if this stream supports the mark and reset methods; false otherwise. |

# WriteableStream Type

## Syntax

```text
interface WriteableStream {
  write(data: Uint8Array, offset: number, length: number): Promise<void>;
  writeSync(data: Uint8Array, offset: number, length: number): void;
  close(): void;
}
```

## Remarks

 The NetCode class includes one or more API methods that accept a stream object as a parameter. To use such API members, create a custom object that implements the WriteableStream interface, and pass an instance of this object to the NetCode class.

 When implementing the WriteableStream interface's properties and methods, they must behave as described below. If the implementation does not behave as expected, undefined behavior may occur.

```text
write(data: Uint8Array, offset: number, length: number): Promise <void> { }
```

```text
writeSync(data: Uint8Array, offset: number, length: number): void { }
```

```text
close(): void { }
```

|  |  |
| --- | --- |
| Methods |  |
| The following parameters are supported | data: The buffer containing the data to write.<br> offset: The starting position in the buffer to read data from.<br> length: The maximum number of bytes to write.<br> |
| write | Asynchronously writes data from the provided buffer to the stream. This method must be implemented.<br> Returns a promise that resolves when the write operation completes. |
| writeSync | Synchronously writes data from the buffer to the stream. |
| close | Closes the stream and releases associated resources. |

# Config Settings (*class *ipworks.[netcode](#netcode-class))

 The class accepts one or more of the following *configuration settings*. Configuration settings are similar in functionality to properties, but they are rarely used. In order to avoid "polluting" the property namespace of the class, access to these *internal properties* is provided through the [Config](#netcodeconfig-method) method.

### NetCode Config Settings

**Base64LineBreak**: Tells the class whether to include line breaks in Base64 encoded content or not.By default, when encoding to Base64 format, the component will insert line breaks every 76 characters. Setting the [Base64LineBreak](#Base64LineBreak) configuration setting to False will cause these line breaks to be omitted from the Base64 encoded content. The default value is True.

**EncodeHash**: Whether the hash value is hex encoded.This setting determines whether the MD5, SHA1, or SHA256 hash value is hex encoded. When calling [Encode](#netcodeencode-method), if this setting is True (default), the hash value created will be hex encoded. When set to False, the output will not be hex encoded and will be binary. This is applicable only to the following formats:

- MD5
- SHA1
- SHA256

**HMACAlgorithm**: The hash algorithm to use when generating a Hash-based Message Authentication Code (HMAC).[HMACAlgorithm](#HMACAlgorithm) is used to tell the class which hashing algorithm to use to generate the Hash-based Message Authentication Code (HMAC). **HMACAlgorithm** can be "SHA1" (Secure Hash Algorithm 1), "MD5" (Message Digest 5), or one of the SHA-2 algorithms mentioned next. You may truncate the hash output by specifying the desired number of bits. For instance, "SHA1-96" and "MD5-96" are acceptable.

The component is capable of utilizing the set of HMAC SHA-2 algorithms ("SHA-224", "SHA-256", "SHA-384", and "SHA-512").

The component also supports "RIPEMD160" as an HMAC algorithm.

**HMACKey**: A key to use when generating a Hash-based Message Authentication Code (HMAC).When using the [Format](#netcodeformat-property) *fmtHMAC*, it may be necessary to supply the class with a key to use when generating the Hash-based Message Authentication Code (HMAC). This key is incorporated into the hashing process to add entropy to the resulting hash code, making the plaintext harder to guess and increasing the message security. You may also set this to a hex value. For instance,

```plaintext
0xAAAAAA
```

 is acceptable.

**MaxFileSize**: When encoding, controls whether encoded data should be split into several files and gives the maximum allowed size for these files.Some mailing systems require that the message size should not exceed a certain size. Assigning a nonzero value to [MaxFileSize](#MaxFileSize) makes the class split the encoded data into several files. [FileCnt](#netcodefilecnt-property) will contain the number of files created. Please refer to [EncodedFile](#netcodeencodedfile-property) for filename conventions.

The default value for this setting is 0 (no limit).

NOTE: If a non-zero value is assigned to [MaxFileSize](#MaxFileSize), then a multiple filename should also be assigned to [EncodedFile](#netcodeencodedfile-property) (end with question marks "?") so that the class can expand the filenames.

Please refer to the [Error Codes](#trappable-errors-class-ipworksnetcode) section for a complete list of possible errors.

**UseExtendedHexBase32**: Specifies whether or not the Extended Hex alphabet is used.When [Format](#netcodeformat-property) is set to *fmtBase32*, [UseExtendedHexBase32](#UseExtendedHexBase32) is used to tell the class whether or not to use the extended hex alphabet. The default value is False.

**UseModifiedUTF7**: Specifies whether or not a modified form of UTF-7 for IMAP mailbox naming is used.When [Format](#netcodeformat-property) is set to *fmtUTF7*, [UseModifiedUTF7](#UseModifiedUTF7) is used to tell the class whether or not to use a modified version of UTF-7 for IMAP mailbox naming. The default value is False.

### Base Config Settings

**BuildInfo**: Information about the product's build.When queried, this setting will return a string containing information about the product's build.

**CodePage**: The system code page used for Unicode to Multibyte translations.The default code page is Unicode UTF-8 (65001).

The following is a list of valid code page identifiers:

|  |  |
| --- | --- |
| Identifier | Name |
| 037 | IBM EBCDIC - U.S./Canada |
| 437 | OEM - United States |
| 500 | IBM EBCDIC - International |
| 708 | Arabic - ASMO 708 |
| 709 | Arabic - ASMO 449+, BCON V4 |
| 710 | Arabic - Transparent Arabic |
| 720 | Arabic - Transparent ASMO |
| 737 | OEM - Greek (formerly 437G) |
| 775 | OEM - Baltic |
| 850 | OEM - Multilingual Latin I |
| 852 | OEM - Latin II |
| 855 | OEM - Cyrillic (primarily Russian) |
| 857 | OEM - Turkish |
| 858 | OEM - Multilingual Latin I + Euro symbol |
| 860 | OEM - Portuguese |
| 861 | OEM - Icelandic |
| 862 | OEM - Hebrew |
| 863 | OEM - Canadian-French |
| 864 | OEM - Arabic |
| 865 | OEM - Nordic |
| 866 | OEM - Russian |
| 869 | OEM - Modern Greek |
| 870 | IBM EBCDIC - Multilingual/ROECE (Latin-2) |
| 874 | ANSI/OEM - Thai (same as 28605, ISO 8859-15) |
| 875 | IBM EBCDIC - Modern Greek |
| 932 | ANSI/OEM - Japanese, Shift-JIS |
| 936 | ANSI/OEM - Simplified Chinese (PRC, Singapore) |
| 949 | ANSI/OEM - Korean (Unified Hangul Code) |
| 950 | ANSI/OEM - Traditional Chinese (Taiwan; Hong Kong SAR, PRC) |
| 1026 | IBM EBCDIC - Turkish (Latin-5) |
| 1047 | IBM EBCDIC - Latin 1/Open System |
| 1140 | IBM EBCDIC - U.S./Canada (037 + Euro symbol) |
| 1141 | IBM EBCDIC - Germany (20273 + Euro symbol) |
| 1142 | IBM EBCDIC - Denmark/Norway (20277 + Euro symbol) |
| 1143 | IBM EBCDIC - Finland/Sweden (20278 + Euro symbol) |
| 1144 | IBM EBCDIC - Italy (20280 + Euro symbol) |
| 1145 | IBM EBCDIC - Latin America/Spain (20284 + Euro symbol) |
| 1146 | IBM EBCDIC - United Kingdom (20285 + Euro symbol) |
| 1147 | IBM EBCDIC - France (20297 + Euro symbol) |
| 1148 | IBM EBCDIC - International (500 + Euro symbol) |
| 1149 | IBM EBCDIC - Icelandic (20871 + Euro symbol) |
| 1200 | Unicode UCS-2 Little-Endian (BMP of ISO 10646) |
| 1201 | Unicode UCS-2 Big-Endian |
| 1250 | ANSI - Central European |
| 1251 | ANSI - Cyrillic |
| 1252 | ANSI - Latin I |
| 1253 | ANSI - Greek |
| 1254 | ANSI - Turkish |
| 1255 | ANSI - Hebrew |
| 1256 | ANSI - Arabic |
| 1257 | ANSI - Baltic |
| 1258 | ANSI/OEM - Vietnamese |
| 1361 | Korean (Johab) |
| 10000 | MAC - Roman |
| 10001 | MAC - Japanese |
| 10002 | MAC - Traditional Chinese (Big5) |
| 10003 | MAC - Korean |
| 10004 | MAC - Arabic |
| 10005 | MAC - Hebrew |
| 10006 | MAC - Greek I |
| 10007 | MAC - Cyrillic |
| 10008 | MAC - Simplified Chinese (GB 2312) |
| 10010 | MAC - Romania |
| 10017 | MAC - Ukraine |
| 10021 | MAC - Thai |
| 10029 | MAC - Latin II |
| 10079 | MAC - Icelandic |
| 10081 | MAC - Turkish |
| 10082 | MAC - Croatia |
| 12000 | Unicode UCS-4 Little-Endian |
| 12001 | Unicode UCS-4 Big-Endian |
| 20000 | CNS - Taiwan |
| 20001 | TCA - Taiwan |
| 20002 | Eten - Taiwan |
| 20003 | IBM5550 - Taiwan |
| 20004 | TeleText - Taiwan |
| 20005 | Wang - Taiwan |
| 20105 | IA5 IRV International Alphabet No. 5 (7-bit) |
| 20106 | IA5 German (7-bit) |
| 20107 | IA5 Swedish (7-bit) |
| 20108 | IA5 Norwegian (7-bit) |
| 20127 | US-ASCII (7-bit) |
| 20261 | T.61 |
| 20269 | ISO 6937 Non-Spacing Accent |
| 20273 | IBM EBCDIC - Germany |
| 20277 | IBM EBCDIC - Denmark/Norway |
| 20278 | IBM EBCDIC - Finland/Sweden |
| 20280 | IBM EBCDIC - Italy |
| 20284 | IBM EBCDIC - Latin America/Spain |
| 20285 | IBM EBCDIC - United Kingdom |
| 20290 | IBM EBCDIC - Japanese Katakana Extended |
| 20297 | IBM EBCDIC - France |
| 20420 | IBM EBCDIC - Arabic |
| 20423 | IBM EBCDIC - Greek |
| 20424 | IBM EBCDIC - Hebrew |
| 20833 | IBM EBCDIC - Korean Extended |
| 20838 | IBM EBCDIC - Thai |
| 20866 | Russian - KOI8-R |
| 20871 | IBM EBCDIC - Icelandic |
| 20880 | IBM EBCDIC - Cyrillic (Russian) |
| 20905 | IBM EBCDIC - Turkish |
| 20924 | IBM EBCDIC - Latin-1/Open System (1047 + Euro symbol) |
| 20932 | JIS X 0208-1990 & 0121-1990 |
| 20936 | Simplified Chinese (GB2312) |
| 21025 | IBM EBCDIC - Cyrillic (Serbian, Bulgarian) |
| 21027 | Extended Alpha Lowercase |
| 21866 | Ukrainian (KOI8-U) |
| 28591 | ISO 8859-1 Latin I |
| 28592 | ISO 8859-2 Central Europe |
| 28593 | ISO 8859-3 Latin 3 |
| 28594 | ISO 8859-4 Baltic |
| 28595 | ISO 8859-5 Cyrillic |
| 28596 | ISO 8859-6 Arabic |
| 28597 | ISO 8859-7 Greek |
| 28598 | ISO 8859-8 Hebrew |
| 28599 | ISO 8859-9 Latin 5 |
| 28605 | ISO 8859-15 Latin 9 |
| 29001 | Europa 3 |
| 38598 | ISO 8859-8 Hebrew |
| 50220 | ISO 2022 Japanese with no halfwidth Katakana |
| 50221 | ISO 2022 Japanese with halfwidth Katakana |
| 50222 | ISO 2022 Japanese JIS X 0201-1989 |
| 50225 | ISO 2022 Korean |
| 50227 | ISO 2022 Simplified Chinese |
| 50229 | ISO 2022 Traditional Chinese |
| 50930 | Japanese (Katakana) Extended |
| 50931 | US/Canada and Japanese |
| 50933 | Korean Extended and Korean |
| 50935 | Simplified Chinese Extended and Simplified Chinese |
| 50936 | Simplified Chinese |
| 50937 | US/Canada and Traditional Chinese |
| 50939 | Japanese (Latin) Extended and Japanese |
| 51932 | EUC - Japanese |
| 51936 | EUC - Simplified Chinese |
| 51949 | EUC - Korean |
| 51950 | EUC - Traditional Chinese |
| 52936 | HZ-GB2312 Simplified Chinese |
| 54936 | Windows XP: GB18030 Simplified Chinese (4 Byte) |
| 57002 | ISCII Devanagari |
| 57003 | ISCII Bengali |
| 57004 | ISCII Tamil |
| 57005 | ISCII Telugu |
| 57006 | ISCII Assamese |
| 57007 | ISCII Oriya |
| 57008 | ISCII Kannada |
| 57009 | ISCII Malayalam |
| 57010 | ISCII Gujarati |
| 57011 | ISCII Punjabi |
| 65000 | Unicode UTF-7 |
| 65001 | Unicode UTF-8 |

 The following is a list of valid code page identifiers for Mac OS only:

|  |  |
| --- | --- |
| Identifier | Name |
| 1 | ASCII |
| 2 | NEXTSTEP |
| 3 | JapaneseEUC |
| 4 | UTF8 |
| 5 | ISOLatin1 |
| 6 | Symbol |
| 7 | NonLossyASCII |
| 8 | ShiftJIS |
| 9 | ISOLatin2 |
| 10 | Unicode |
| 11 | WindowsCP1251 |
| 12 | WindowsCP1252 |
| 13 | WindowsCP1253 |
| 14 | WindowsCP1254 |
| 15 | WindowsCP1250 |
| 21 | ISO2022JP |
| 30 | MacOSRoman |
| 10 | UTF16String |
| 0x90000100 | UTF16BigEndian |
| 0x94000100 | UTF16LittleEndian |
| 0x8c000100 | UTF32String |
| 0x98000100 | UTF32BigEndian |
| 0x9c000100 | UTF32LittleEndian |
| 65536 | Proprietary |

**LicenseInfo**: Information about the current license.When queried, this setting will return a string containing information about the license this instance of a class is using. It will return the following information:

- Product: The product the license is for.
- Product Key: The key the license was generated from.
- License Source: Where the license was found (e.g., RuntimeLicense, License File).
- License Type: The type of license installed (e.g., Royalty Free, Single Server).
- Last Valid Build: The last valid build number for which the license will work.

**MaskSensitiveData**: Whether sensitive data is masked in log messages.In certain circumstances it may be beneficial to mask sensitive data, like passwords, in log messages. Set this to *true* to mask sensitive data. The default is *true*.

**UseInternalSecurityAPI**: Whether or not to use the system security libraries or an internal implementation. When set to *false*, the class will use the system security libraries by default to perform cryptographic functions where applicable.

Setting this configuration setting to *true* tells the class to use the internal implementation instead of using the system security libraries.

 This setting is set to *false* by default on all platforms.

# Trappable Errors (*class *ipworks.[netcode](#netcode-class))

### NetCode Errors

|  |  |
| --- | --- |
| 1 | Short uuencoded file. |
| 2 | The closing 'end' was not found (uudecoded file may be too short). |
| 3 | Cannot create the file for write (illegal name or disk is write-protected). |
| 4 | Cannot open the file for read (does not exist?). |
| 5 | Cannot read from file. |
| 6 | Cannot write to file (disk full?). |
| 7 | Please supply a filename for uuencoded data. |
| 8 | File exists and [Overwrite](#netcodeoverwrite-property) was set to False. |
| 9 | Space is not sufficient in the output string. |
| 10 | The given filenames are insufficient to split all the encoded data. |
| 11 | Please supply a filename for the encoded data. |
| 12 | Encoded data cannot be written in more than 100 files. |
| 13 | Could not write to file. Permission denied. |
| 14 | Could not write to file. Disk full. |
| 15 | Too many open files. No more file handles are available, so no more files can be opened. |
| 16 | The given filename does not exist. |
| 17 | There are no more files to read from or write to. |
| 18 | The starting 'begin' was not found. Is it uuencoded data? |
| 19 | The current format is not supported. |
| 20 | The specified stream does not support Available(). |
| 21 | Format error when YDecoding. |
| 22 | No '=yend' found when YDecoding. |
| 23 | Escape character found at end of line when YDecoding. |
| 24 | CRC check failed when YDecoding (Corrupt data). |
| 25 | Output buffer length was not calculated. |
| 26 | Invalid character in Base64 data. |
