"Fossies" - the Fresh Open Source Software Archive
Member "freeswan-2.06/doc/manpage.d/ipsec_splitkeytoid.3.html" (17 Apr 2004, 4053 Bytes) of package /linux/misc/old/freeswan-2.06.tar.gz:
Caution: In this restricted "Fossies" environment the current HTML page may not be correctly presentated and may have some non-functional links.
You can here alternatively try to browse
the pure source code or just view
the uninterpreted raw source code. If the rendering is insufficient you may try to find and view the page on the freeswan-2.06.tar.gz
project site itself.
Section: C Library Functions (3)
Updated: 25 March 2002
Return to Main Contents
ipsec keyblobtoid, splitkeytoid - generate key IDs from RSA keys
size_t keyblobtoid(const unsigned char *blob,
size_t bloblen, char *dst, size_t dstlen);
size_t splitkeytoid(const unsigned char *e, size_t elen,
const unsigned char *m, size_t mlen, char *dst,
from RSA keys,
for use in messages and reporting,
writing the result to
is a short ASCII string identifying a key;
currently it is just the first nine characters of the base64
encoding of the RFC 2537/3110 ``byte blob'' representation of the key.
(Beware that no finite key ID can be collision-proof:
there is always some small chance of two random keys having the
generates a key ID from a key which is already in the form of an
RFC 2537/3110 binary key
(encoded exponent length, exponent, modulus).
generates a key ID from a key given in the form of a separate
parameter of either
specifies the size of the
under no circumstances are more than
bytes written to
A result which will not fit is truncated.
can be zero, in which case
need not be valid and no result is written,
but the return value is unaffected;
in all other cases, the (possibly truncated) result is NUL-terminated.
header file defines a constant
which is the size of a buffer large enough for worst-case results.
Both functions return
for a failure, and otherwise
always return the size of buffer which would
be needed to
accommodate the full conversion result, including terminating NUL;
it is the caller's responsibility to check this against the size of
the provided buffer to determine whether truncation has occurred.
With keys generated by
the first two base64 digits are always the same,
and the third carries only about one bit of information.
It's worse with keys using longer fixed exponents,
e.g. the 24-bit exponent that's common in X.509 certificates.
However, being able to relate key IDs to the full
base64 text form of keys by eye is sufficiently useful that this
waste of space seems justifiable.
The choice of nine digits is a compromise between bulk and
probability of collision.
RSA/SHA-1 SIGs and RSA KEYs in the Domain Name System (DNS),
(superseding the older but better-known RFC 2537).
Fatal errors are:
key too short to supply enough bits to construct a complete key ID
(almost certainly indicating a garbage key);
exponent too long for its length to be representable.
Written for the FreeS/WAN project by Henry Spencer.
- SEE ALSO
This document was created by
using the manual pages.
Time: 19:04:25 GMT, April 17, 2004