[BACK]Return to HOWTO.add.crypto CVS log [TXT][DIR] Up to [local] / src / lib / libkeynote

File: [local] / src / lib / libkeynote / HOWTO.add.crypto (download)

Revision 1.3, Tue Jan 25 09:08:09 2000 UTC (24 years, 4 months ago) by angelos
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, OPENBSD_7_3_BASE, OPENBSD_7_3, OPENBSD_7_2_BASE, OPENBSD_7_2, OPENBSD_7_1_BASE, OPENBSD_7_1, OPENBSD_7_0_BASE, OPENBSD_7_0, OPENBSD_6_9_BASE, OPENBSD_6_9, OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7, OPENBSD_6_6_BASE, OPENBSD_6_6, OPENBSD_6_5_BASE, OPENBSD_6_5, OPENBSD_6_4_BASE, OPENBSD_6_4, OPENBSD_6_3_BASE, OPENBSD_6_3, OPENBSD_6_2_BASE, OPENBSD_6_2, OPENBSD_6_1_BASE, OPENBSD_6_1, OPENBSD_6_0_BASE, OPENBSD_6_0, OPENBSD_5_9_BASE, OPENBSD_5_9, OPENBSD_5_8_BASE, OPENBSD_5_8, OPENBSD_5_7_BASE, OPENBSD_5_7, OPENBSD_5_6_BASE, OPENBSD_5_6, OPENBSD_5_5_BASE, OPENBSD_5_5, OPENBSD_5_4_BASE, OPENBSD_5_4, OPENBSD_5_3_BASE, OPENBSD_5_3, OPENBSD_5_2_BASE, OPENBSD_5_2, OPENBSD_5_1_BASE, OPENBSD_5_1, OPENBSD_5_0_BASE, OPENBSD_5_0, OPENBSD_4_9_BASE, OPENBSD_4_9, OPENBSD_4_8_BASE, OPENBSD_4_8, OPENBSD_4_7_BASE, OPENBSD_4_7, OPENBSD_4_6_BASE, OPENBSD_4_6, OPENBSD_4_5_BASE, OPENBSD_4_5, OPENBSD_4_4_BASE, OPENBSD_4_4, OPENBSD_4_3_BASE, OPENBSD_4_3, OPENBSD_4_2_BASE, OPENBSD_4_2, OPENBSD_4_1_BASE, OPENBSD_4_1, OPENBSD_4_0_BASE, OPENBSD_4_0, OPENBSD_3_9_BASE, OPENBSD_3_9, OPENBSD_3_8_BASE, OPENBSD_3_8, OPENBSD_3_7_BASE, OPENBSD_3_7, OPENBSD_3_6_BASE, OPENBSD_3_6, OPENBSD_3_5_BASE, OPENBSD_3_5, OPENBSD_3_4_BASE, OPENBSD_3_4, OPENBSD_3_3_BASE, OPENBSD_3_3, OPENBSD_3_2_BASE, OPENBSD_3_2, OPENBSD_3_1_BASE, OPENBSD_3_1, OPENBSD_3_0_BASE, OPENBSD_3_0, OPENBSD_2_9_BASE, OPENBSD_2_9, OPENBSD_2_8_BASE, OPENBSD_2_8, OPENBSD_2_7_BASE, OPENBSD_2_7, HEAD
Changes since 1.2: +2 -2 lines

Sync with current version (just the file renamed).

# $OpenBSD: HOWTO.add.crypto,v 1.3 2000/01/25 09:08:09 angelos Exp $

This document describes how to add support for digital signature algorithms,
hash functions, and ASCII encoding mechanisms in this implementation.

For a signature algorithm:

- Add the appropriate include files in keynote.h
- Create one or more strings describing the signature algorithm
  prefixes, and add those to keynote.h (the SIG_* definitions).
- Add a definition for the algorithm in keynote.h (the
  KEYNOTE_ALGORITHM_* definitions).
- Define the algorithm public key prefixes, and add them to
  signature.h (the *_HEX, *_HEX_LEN, *_BASE64, *_BASE64_LEN
  definitions).
- In auxil.c, function keynote_keyhash(), add to the switch statement
  a case handling the new algorithm; the return value is an integer,
  and is used as an index into a hash table.
- In signature.c:
  - In keynote_free_key(), add code to free any memory allocated for
    storing a key for the new algorithm.
  - In keynote_get_sig_algorithm(), add code that checks whether a
    signature string begins with one of the prefixes for the new
    algorithm that were defined in keynote.h
  - Similarly, in keynote_get_key_algorithm() for key strings, using
    the key prefixes defined in signature.h
  - In kn_decode_key(), add code that converts a bit string to
    the new algorithm's structure for storing a key (use the DSA
    code as a guide).
  - Similarly for kn_encode_key()
  - In kn_keycompare(), add code that compares two keys and
    returns RETURN_TRUE if they are equal, and RETURN_FALSE otherwise.
  - In keynote_signverify_assertion, add code that verifies a
    signature for the new algorithm.
  - Likewise for signature generation in keynote_sign_assertion()
- In keynote-keygen.c, replicate the code for DSA key generation to
  support the new algorithm.

For a hash algorithm:

- Add the necessary include files in keynote.h
- Add a KEYNOTE_HASH_* definition for the algorithm in signature.h
- In signature.h, if the length of the new hash function's result is
  more than LARGEST_HASH_SIZE (currently 20 bytes, for SHA1), then
  replace that value with the new function's hash result length.
- In signature.c:
  - In keynote_sigverify_assertion(), add code in the switch statement
    for generating a hash of the assertion and the signature algorithm
    name (use the SHA1 code as an example).
  - Likewise in keynote_sign_assertion()

For an ASCII-encoding algorithm:

- Add the necessary include files in keynote.h
- Add additional SIG_* definitions in keynote.h
- Add an ENCODING_* definition in keynote.h
- Add additional key prefix string definitions in signature.h
- In signature.c:
  - In keynote_get_sig_algorithm(), add code for detecting signatures 
    with this encoding.
  - Likewise for keys in keynote_get_key_algorithm()
  - In kn_decode_key(), add code in the switch statement for decoding
    ASCII-encoded keys.
  - Likewise in kn_encode_key() for encoding keys.
  - Likewise in keynote_sigverify_assertion() for decoding signatures.
  - Add the necessary checks in keynote_sign_assertion() for handling
    the new encoding, and code in the switch statement for doing the
    encoding of the signature.
- Add the necessary checks in keynote-keygen.c for handling the
  new algorithm.