Construction of nCore key hashes

nCore key hashes are SHA1 hashes of a sequence of bytes, or, if you are using KeyHashEx, the specified hash function, for example SHA256, of the same sequence.

Key hashes are constructed the following way in nCore:

"nFast KeyHash\0" || HASHPREFIX || "\0" || KEY || "invented by nCipher 1997\0"
Component Meaning

"nFast KeyHash\0"

zero-terminated header string

HASHPREFIX || "\0"

zero-terminated identifying string for the key type, see Identifying strings and key material

KEY

Key material, see Identifying strings and key material

"invented by nCipher 1997\0"

zero-terminated trailer string

Identifying strings and key material

The following notation is used in the definitions:

Notation Meaning

||

Concatenation

bitlen(x)

The number of bits required to represent the integer x.

B(x)

The representation of the integer x in little-endian form, zero-padded to a multiple of 64 bytes (bytes, not bits). Note that this does not include any kind of length indicator.

Curve

Elliptic curve domains, see Elliptic curve domains.

S(x)

The representation of the integer x in little-endian form in exactly 4 bytes.

Key type Identifying String (HASHPREFIX) Key Material (KEY)

ArcFour

RC4

Raw key material

ARIA

ARIA

Raw key material

Camellia

Camellia

Raw key material

CAST256

CAST256

Raw key material

DES

DES

Raw key material

DES2

DES2

Raw key material

DES3

DES3

Raw key material

DHExPrivate

DHExPublic

DH001

B(p) || B(q) || B(g) || B(gx)

DHPrivate

DHPublic

DH000

B(p) || B(g) || B(gx)

DKTemplate

TEM01

appdata || nested_acl

DSAComm

DSACommVariableSEED

DSC01

B(p) || B(q) || B(g)

DSACommFIPS186_3

DSC02

B(p) || B(q) || B(g)

DSAPrivate

DSAPublic

DSA00

B(p) || B(q) || B(g) || B(y)

ECDHPrivate

ECDHPublic

ECDHLaxPrivate

ECDHLaxPublic

ECDH000

Curve || B(Q.x) || B(Q.y)

ECDSAPrivate

ECDSAPublic

ECDSA00

Curve || B(Q.x) || B(Q.y)

ECPrivate

ECPublic

EC00

Curve || B(Q.x) || B(Q.y)

Ed25519Private

Ed25519Public

ED25519

Raw public key material

Ed448Private

Ed448Public

ED448

Raw public key material

HMACMD5

HMACMD5

Raw key material

HMACRIPEMD160

HMACRIPEMD160

Raw key material

HMACSHA1

HMACSHA1

Raw key material

HMACSHA224

HMACSHA224

Raw key material

HMACSHA256

HMACSHA256

Raw key material

HMACSHA384

HMACSHA384

Raw key material

HMACSHA512

HMACSHA512

Raw key material

HMACSHA3b224

HMACSHA3b224

Raw key material

HMACSHA3b256

HMACSHA3b256

Raw key material

HMACSHA3b384

HMACSHA3b384

Raw key material

HMACSHA3b512

HMACSHA3b512

Raw key material

HMACTiger

HMACTiger

Raw key material

KCDSAComm

KCDSAC01

B(p) || B(q) || B(g)

KCDSAPrivate

KCDSAPublic

KCDSA00

B(p) || B(q) || B(g)

KMAC128

KMAC128

Raw key material

KMAC256

KMAC256

Raw key material

MILENAGEOP

MILENAGEOP

Raw key material

MILENAGEOPC

MILENAGEOPC

Raw key material

MILENAGERC

MILENAGERC

Raw key material

MILENAGESubscriber

MILENAGESubscriber

Raw key material

Random

Random

Raw key material

Rijndael (AES)

Rijndael

Raw key material

RSAPrivate

RSAPublic

RSA00

If bitlen(e) > 32:

S(bitlen(e)) || B(e) || B(n)

Otherwise:

B(e) || B(n)

SEED

SEED

Raw key material

TUAKTOP

TUAKTOPC

Raw key material

TUAKTOPC

TUAKTOPC

Raw key material

TUAKSubscriber

TUAKSubscriber

Raw key material

Wrapped

WRP01

Raw key material

X25519Private

X25519Public

X25519

Raw public key material