Enum Class char_encoding

#include <tkcrypt/common.h>

Namespace: tkcrypt

Description

char_encoding enumerates character encodings for encrypted text.

Keychain encrypt/decrypt methods operate on bytes instead of strings. When encrypting a message, users must first convert the message string into a sequence of bytes. However, a byte sequence does not tell the recipient how to piece the original string back together. Therefore when encrypting, users tell the encrypt method what character encoding was used to generate the byte sequence. This information becomes part of the ciphertext itself.

The recipient then can use this information on decrypt to recreate the original message exactly as it is intended. This is especially helpful with cross-programming-language interoperability, since every language has its own native/preferred encoding and relying on the sender and receiver to have the same understanding is faulty.

Since: v2.0

Enum Class Summary

Enum Constant Description

utf8

the bytes represent a UTF-8 encoded string

utf16

the bytes represent a UTF-16 encoded string

binary

the bytes represent binary data

original

an unadorned byte sequence; use this value with care

Enum Class Detail

utf8

The bytes represent a UTF-8 encoded string

utf16

The bytes represent a UTF-16 encoded string

binary

The bytes represent a piece of binary data. For example a PNG, PDF, ZIP, etc file’s contents.

original

The bytes have no additional encoding information present. Sender and receiver are assumed to have a protocol in place to determine the interpretation of the byte sequence.