Bifroest Mr. Tines MacCTC CTCjava Manual Pages
Bifroest Mr. Tines CTC Home CTClib MacCTC CTCjava Manual

Global Constants

This page describes a number of constants defined in CTC that are not associated with any single module. They appear in a number of separate header files.

abstract.h

This header file is abstract type definitions file. It provides incomplete definitions of most CTC datatypes. See the appropriate modules for documentation these.

These are adequate for prototype definitions and manipulation of pointers to the types, but providing no details of the internals of the structures.

Many of these structures are used only quite locally. However as we are leaking no information about their internals there is no danger in making their names widely available. Indeed it has the effect of globally reserving the name, preventing accidently clashes.

In addition abstract.h, holds the definitions of types accessMode and fileType which are defined for, and documented with, port_io.

Abstract.h requires the definitions from basic.h

Constant Values

KEYFRAGSIZE
Number of bytes in Key Id.
KEYPRINTFRAGSIZE
Number of bytes of key Id. normally printed.
SIZEOF_TIMESTAMP
Size in bytes of timestamp
SIZEOF_VALIDITY
Size in bytes of validity period
MAX_DEPTH
max. value of max_cert_depth
MAXHASHSIZE
largest digest size in use (bytes)
MAXCVALGS
Maximum number of levels of conventional encryption
MAXBLOCKSIZE
largest block size in use (bytes)
MAXKEYSIZE
largest key size in use (bytes)

Enumeration Types

continue_action
This data-type represents the result of decision on continuing the current operation. Typically taken during decryption operations. The valid values are:-
CB_CONTINUE
Process the immediate operation and continue.
CB_SKIP
Skip the current operations but continue.
CB_ABORT
Abort the whole sequence of operations and return control to the application.

basic.h

This defines a number of very simple and universal types and constants.

Most of these values and types very standard and are defined by many compilers or standard include files. Accordingly basic.h only defines these when not predefined by the C development system.

Constant Values

VERSIONNO
version number of package (as a character string)
VOID
Void data type
TRUE
Boolean true value
FALSE
Boolean false value

Macros

max
Returns the maximum of two arguments.  Note that this macro evaluates the selected value twice.  Substituting an expression with side-effects (e.g. anything including '++' or '--') is likely to have unexpected results.
min
Returns the minimum of two arguments. Implemented in the same way as max().
NAMESPACE_CTCLIB
Used to declare the start of CTC's Namespace, for compilers that support Namespace directives.
END_NAMESPACE
Used to mark the end of CTC's Namespace.

DataTypes

This file defines a number of general purpose datatypes:-
boolean
Boolean value.
byte
Single 8-bit byte; usually implemented as unsigned char
ushort
Obsolete alternative to uint16_t; no longer defined
ulong
Obsolete alternative to uint32_t; no longer defined
uint8_t
Unsigned short (8-bit) integer (not used by most of CTClib which uses byte but is used in some of the ciphers.
uint16_t
Unsigned short (16-bit) integer
uint32_t
Unsigned long (32-bit) integer
common_error
This datatype is used in a number of modules as a common return code type.
CE_OKAY
Operation completed successfully
CE_USER_BREAK
Operation aborted at user request.
CE_NO_MEMORY
Operation failed due to lack of memory
CE_OTHER
Operation failed for other (unspecified) reason, see individual function documentation. For some functions this has a specific meaning.

keyconst.h

This header file defines a number of constants associated with PKE keys, and encryption algorith selection.

Constants

MAXBUFFERSIZE

Cipher Type Byte (CTB)

fields
These constants define the bit fields within a Cipher Type Byte, the first byte of a PGP binary file block.
CTB_DESIGNATOR
Designator bit; all PGP2 style CTB bytes have this bit set.
CTB_PGP3
PGP3 (and later) designator bit; all PGP3 style CTB bytes have these bits set.
CTB_DESG_MASK
Mask for the designator field; this mask should isolate one of the above two values.
CTB_TYPE_MASK
Mask for the type field for PGP2 style CTB bytes.
CTB_TYPE_MSK3
Mask for the type field for PGP3 style CTB bytes.
CTB_LLEN_MASK
(PGP2 style bytes only) Mask for size of length field; two bits indicating 1,2,4 or 0 byte length field. (No length field means "rest-of-file".)
Block Types
The following types:-
CTB_PKE
packet encrypted with RSA public key
CTB_SKE
packet signed with RSA secret key
CTB_CONV_ESK
PGP3: Conventional encryption packet; indicates the algorithm and pass-phrase->key conversion method for the following CTB_CKE packet. Not inspected at version 2.1 or before
CTB_1PASS_SIG
PGP3: new packet type. Not used at version 2.1 or before
CTB_CERT_SECKEY
secret key certificate
CTB_CERT_PUBKEY
public key certificate
CTB_SEC_SUBKEY
secret sub-key certificate
CTB_COMPRESSED
compressed data packet
CTB_CKE
conventional-key-encrypted data
CTB_LITERAL
raw data with filename and mode (Obsolete - defined in PGP2.6 but never used)
CTB_LITERAL2
Fixed literal packet
CTB_KEYCTRL
key control packet
CTB_USERID
user id packet
CTB_PUB_SUBKEY
public sub-key certificate.

N.B. This is an incompatible change at PGP5.0. This value was previously used to mark a comment packet.
Signature type
These constants are used to indicate the significance of a signature.
SIG_BINARY
Signature of a binary file
SIG_TEXT
Signature of a text file
SIG_KEY_CERT
Generic key certification
SIG_KEY_PERSONA
Persona key certification
SIG_KEY_CASUAL
Casual key certification
SIG_KEY_POSITIVE
Positive key certification
SIG_KEY_COMPROM
Key compromise certificate (owner revoking a key)
SIG_KEY_REVOKE
Signature revocation (signer revoking key/username signature)
SIG_KEY_TIMESTMP
Key time-stamp
SIG_SUBKEY_CERT
Subkey certification
SIG_SUBKEY_REVOKE
Subkey revocation
Sub-Packet Type
This is the definition of the constants for the type field of Signature sub-packets. See OpenPGP documentation of details on the use of each of these. (This is now more or less finalised as RFC2440.)
SUBPKT_VERSION (=1)
PGP5 defined this, but OpenPGP does not, so is presumably obsolete.
SUBPKT_CREATION
Signature Creation Time
SUBPKT_EXPIRY
Signature Expiration Time
SUBPKT_EXPORTABLE_CERT
Exportable Certification
SUPPKT_TRUST_SIGNATURE
Trust Signature
SUBPKT_REGEXP
Regular Expression
SUBPKT_REVOCABLE
Revocable
SUBPKT_KEY_CAPABILITIES (=8)
PGP5 defined this, but OpenPGP does not, so is presumably obsolete.
SUBPKT_KEY_EXPIRY
Key Expiration Time
SUBPKT_KEY_RECOVERY_KEY
"placeholder for backward compatibility"; Under PGP5 this is the only warning that a sub-key is a Key-Recovery key so understanding this packet type is important even if OpenPGP has wisely refused to support it.
SUBPKT_KEY_PREFERRED_ALGS
Preferred Symmetric Algorithms
SUBPKT_REVOCATION_KEY
Revocation key
SUBPKT_KEYID
Issuer key ID
SUBPKT_USERID (=17)
PGP5 defined this, but OpenPGP does not ,so is presumably obsolete.
SUBPKT_URL (=18)
PGP5 defined this, but OpenPGP does not, so is presumably obsolete.
SUBPKT_FINGER (=19)
PGP5 defined this, but OpenPGP does not, so is presumably obsolete.
SUBPKT_NOTATION_DATA
Notation Data
SUBPKT_PREFERRED_MDA
Preferred Hash Algorithms
SUBPKT_PREFERRED_CPA
Preferred Compression Algorithms
SUBPKT_KEYSERVER_PREFS
Key Server Preferences
SUBPKT_PREFERRED_KEYSERVER
Preferred Key Server
SUBPKT_PRIMARY_USERID
Primary User Id.
SUBPKT_POLICY_URL
Policy URL
SUBPKT_KEY_FLAGS
Key Flags
SUBPKT_SIGNER_USERID
Signer's user Id.
SUBPKT_REVOCATION_REASON
Reason for Revocation
SUBPKT_MIN_USERDEFINE
Start of user-defined range (100)
SUBPKT_MAX_USERDEFINED
End of user-defined range (110)
Trust Byte fields
This is the definition of the constants for manipulating Trust bytes.  CTC does not take Trust bytes seriously as they are in plain and unauthenticated hence wide open to forgery.
KTB_OWN_MASK
KTB_OWN_UNDEFINED
KTB_OWN_UNKNOWN
KTB_OWN_UNTRUSTED
KTB_OWN_USUALLY
KTB_OWN_TRUSTED
KTB_OWN_OWNKEY
KTB_ENABLE_MASK
KTB_ENABLE_ENABLE
KTB_ENABLE_DISABLE
KTB_BUCKSTOP_MASK
KTB_BUCKSTOP_TRUE
KTB_BUCKSTOP_FALSE
PKE algorithm bytes
This is may change. Arguably here should probably be separate selectors for key exchange and authentication algorithm. However at present algorithm and whether it is usable of key-exchange or authentication or both is encoded in a single value. Note that CTC does not enforce these restrictions. It is up to the application to enforce this, if this is required.
PKA_RSA
RSA dual-use (encryption or authentication); the only value acceptable to most freeware PGP variants.
PKA_RSA_ENCRYPT_ONLY
Viacrypt RSA key for Encryption use only.
PKA_RSA_SIGN_ONLY
Viacrypt RSA key for Signing use only.
PKA_GF2255
Elliptic curve encryption on the Galois Field 2^255 (240 bit elliptic curve encryption) as per Pegwit v8.x (message format is not interoperable)
PKA_PEGWIT9
As for PKA_GF2255 but reserved in anticpation of changes likely at Pegwit v9 (if this ever emerges)
PKA_ELGAMAL
ElGamal/Diffie-Hellman (currently encrypt only)
PKA_DSA
DSA (sign only)
PKA_EBP_RSA
Value used by EBP to designate RSA
PKA_EBP_RABIN
Value used by EBP to desgnate Rabin
Symmetric algorithm selector bytes
Note that there are wide range of different ciphers in use by different PGP implementations. We tried to at least correctly identify all the cipher bytes, albeit we do not implement all ciphers. Hence this has a large number of values not processed by CTC and more are understood but never written by CTC.
CEA_ESCAPE
A value which may be used at some future date. Its purpose is to indicate that something else follows.
CEA_NONE
Indicator that no encryption is to be performed (for operations equivalent to pgp -a, or pgp -sa).
CEA_IDEA, CEA_IDEAFLEX
use the IDEA cipher. The former is the value used in PGP, and implies CFBmode, and nothing else. The latter is used to allow full control over the ancillary choices.
CEA_3WAY
use the 3-way cipher
CEA_BLOW16
Blowfish with 16 byte key
CEA_TEA
The Tiny Encryption Algorithm
CEA_BLOW5
Blowfish with 5 byte key
CEA_SQUARE
Square 128 bit key and block
CEA_DES
Single DES
CEA_S3DES
s3DES
CEA_KDDES
key dependent DES
CEA_3DES, CEA_3DESFLEX
Triple-DES (PGP and flexible codes)
CEA_CAST5, CEA_CAST5FLEX
CAST (PGP and flexible codes)
CEA_OPGP_SAFERSK128
128 SAFER - 13 rounds
CEA_OPGP_DES_SK
CEA_OPGP_AES_128
Placeholder for 128-bit AES
CEA_OPGP_AES_192
Placeholder for 192-bit AES
CEA_OPGP_AES_256
Placeholder for 256-bit AES

CEA_OPGP_TWOFISH_256
256-bit TwoFish

CEA_GPG_BLOW16
GPG designation for Blowfish 128-bit key
CEA_GPG_BLOW20
GPG designation for Blowfish 160-bit key
CEA_GPG_GOST
GPG designation for GOST
CEA_EBP_IDEA
EBP desgnation for IDEA
CEA_EBP_SAFER_MIN
EBP uses a range of values for SAFER this is the start of the range.
CEA_EBP_SAFER_MAX
EBP uses a range of values for SAFER this is the end of the range.
CEA_FLEX_FLAG
Not a PGP-classic imitator
CEA_MORE_FLAG
Another cipher key follows
CEA_MASK
excludes the flags
Symmetric Mode-of-Operation selector bytes
CEM_CFB
CFB mode - assumed for PGP-classic
CEM_ECB
ECB mode, with ciphertext stealing
CEM_OFB
OFB mode
CEM_CBC
CBC mode, with ciphertext stealing
CEM_REVERSE_FLAG
work from the end of the file
CEM_TRIPLE_FLAG
three keys follow for outer chaining
CEM_MASK
excludes the flags
Message digest algorithm selector
MDA_MD5
MD5 message digest algorithm
MDA_3WAY
3-way used to produce 96 bit hash
MDA_SHA
the NIST SHA 160bit hash (SHA-0, usually regarded as obsolete)
MDA_SHA1, MDA_PGP5_SHA1
the NIST SHA 160bit hash with the NSA modification.
MDA_PGP5_RIPEM160
RIPEM 160bit hash
MDA_EBP_HAVAL_MIN to MDA_EBP_HAVAL_MIN
various lengths and strengths of HAVAL as used by EBP, with a possible error in the padding
MDA_EBP_HAVAL_MIN to MDA_EBP_HAVAL_MIN
various lengths and strengths of HAVAL, with the padding error asserted to have been fixed
MDA_FLEX_FLAG
This bit set to indicate that this is not a PGP-defined algorithm (as CEA_FLEX_FLAG)
MDA_MASK
excludes the flags (as CEA_MASK)
Compression algorithm
Defines the method of
CPA_DEFLATE
Zip-based deflate compression algorithm
CPA_SPLAY
Splay tree based compression algorithm
CPA_FLEX_FLAG
Not a PGP-defined option (as CEA_FLEX_FLAG)
Version byte
for data structures created by this version of PGP
MIN_VERSION
PGP2 to 2.5
VERSION_2_6
PGP2.6
VERSION_3
PGP3 - PGP5.0