]> git.ipfire.org Git - thirdparty/strongswan.git/blame - doc/manpage.d/ipsec_splitkeytoid.3.html
- import of strongswan-2.7.0
[thirdparty/strongswan.git] / doc / manpage.d / ipsec_splitkeytoid.3.html
CommitLineData
997358a6
MW
1Content-type: text/html
2
3<HTML><HEAD><TITLE>Manpage of IPSEC_KEYBLOBTOID</TITLE>
4</HEAD><BODY>
5<H1>IPSEC_KEYBLOBTOID</H1>
6Section: C Library Functions (3)<BR>Updated: 25 March 2002<BR><A HREF="#index">Index</A>
7<A HREF="http://localhost/cgi-bin/man/man2html">Return to Main Contents</A><HR>
8
9
10<A NAME="lbAB">&nbsp;</A>
11<H2>NAME</H2>
12
13ipsec keyblobtoid, splitkeytoid - generate key IDs from RSA keys
14<A NAME="lbAC">&nbsp;</A>
15<H2>SYNOPSIS</H2>
16
17<B>#include &lt;<A HREF="file:/usr/include/freeswan.h">freeswan.h</A>&gt;</B>
18
19<P>
20<B>size_t keyblobtoid(const unsigned char *blob,</B>
21
22<BR>
23&nbsp;
24<B>size_t bloblen, char *dst, size_t dstlen);</B>
25
26<BR>
27
28<B>size_t splitkeytoid(const unsigned char *e, size_t elen,</B>
29
30<BR>
31&nbsp;
32<B>const unsigned char *m, size_t mlen, char *dst,</B>
33
34<BR>
35&nbsp;
36<B>size_t dstlen);</B>
37
38<A NAME="lbAD">&nbsp;</A>
39<H2>DESCRIPTION</H2>
40
41<I>Keyblobtoid</I>
42
43and
44<I>splitkeytoid</I>
45
46generate
47key IDs
48from RSA keys,
49for use in messages and reporting,
50writing the result to
51<I>dst</I>.
52
53A
54<I>key ID</I>
55
56is a short ASCII string identifying a key;
57currently it is just the first nine characters of the base64
58encoding of the RFC 2537/3110 ``byte blob'' representation of the key.
59(Beware that no finite key ID can be collision-proof:
60there is always some small chance of two random keys having the
61same ID.)
62<P>
63
64<I>Keyblobtoid</I>
65
66generates a key ID from a key which is already in the form of an
67RFC 2537/3110 binary key
68<I>blob</I>
69
70(encoded exponent length, exponent, modulus).
71<P>
72
73<I>Splitkeytoid</I>
74
75generates a key ID from a key given in the form of a separate
76(binary) exponent
77<I>e</I>
78
79and modulus
80<I>m</I>.
81
82<P>
83
84The
85<I>dstlen</I>
86
87parameter of either
88specifies the size of the
89<I>dst</I>
90
91parameter;
92under no circumstances are more than
93<I>dstlen</I>
94
95bytes written to
96<I>dst</I>.
97
98A result which will not fit is truncated.
99<I>Dstlen</I>
100
101can be zero, in which case
102<I>dst</I>
103
104need not be valid and no result is written,
105but the return value is unaffected;
106in all other cases, the (possibly truncated) result is NUL-terminated.
107The
108<I>freeswan.h</I>
109
110header file defines a constant
111<B>KEYID_BUF</B>
112
113which is the size of a buffer large enough for worst-case results.
114<P>
115
116Both functions return
117<B>0</B>
118
119for a failure, and otherwise
120always return the size of buffer which would
121be needed to
122accommodate the full conversion result, including terminating NUL;
123it is the caller's responsibility to check this against the size of
124the provided buffer to determine whether truncation has occurred.
125
126With keys generated by
127<I><A HREF="ipsec_rsasigkey.3.html">ipsec_rsasigkey</A></I>(3),
128
129the first two base64 digits are always the same,
130and the third carries only about one bit of information.
131It's worse with keys using longer fixed exponents,
132e.g. the 24-bit exponent that's common in X.509 certificates.
133However, being able to relate key IDs to the full
134base64 text form of keys by eye is sufficiently useful that this
135waste of space seems justifiable.
136The choice of nine digits is a compromise between bulk and
137probability of collision.
138<A NAME="lbAE">&nbsp;</A>
139<H2>SEE ALSO</H2>
140
141RFC 3110,
142<I>RSA/SHA-1 SIGs and RSA KEYs in the Domain Name System (DNS)</I>,
143Eastlake, 2001
144(superseding the older but better-known RFC 2537).
145<A NAME="lbAF">&nbsp;</A>
146<H2>DIAGNOSTICS</H2>
147
148Fatal errors are:
149key too short to supply enough bits to construct a complete key ID
150(almost certainly indicating a garbage key);
151exponent too long for its length to be representable.
152<A NAME="lbAG">&nbsp;</A>
153<H2>HISTORY</H2>
154
155Written for the FreeS/WAN project by Henry Spencer.
156<P>
157
158<HR>
159<A NAME="index">&nbsp;</A><H2>Index</H2>
160<DL>
161<DT><A HREF="#lbAB">NAME</A><DD>
162<DT><A HREF="#lbAC">SYNOPSIS</A><DD>
163<DT><A HREF="#lbAD">DESCRIPTION</A><DD>
164<DT><A HREF="#lbAE">SEE ALSO</A><DD>
165<DT><A HREF="#lbAF">DIAGNOSTICS</A><DD>
166<DT><A HREF="#lbAG">HISTORY</A><DD>
167</DL>
168<HR>
169This document was created by
170<A HREF="http://localhost/cgi-bin/man/man2html">man2html</A>,
171using the manual pages.<BR>
172Time: 21:40:18 GMT, November 11, 2003
173</BODY>
174</HTML>