1 .\" $NetBSD: krb5_create_checksum.3,v 1.1.1.3 2014/04/24 12:45:50 pettai Exp $
3 .\" Copyright (c) 1999-2005 Kungliga Tekniska Högskolan
4 .\" (Royal Institute of Technology, Stockholm, Sweden).
5 .\" All rights reserved.
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
11 .\" 1. Redistributions of source code must retain the above copyright
12 .\" notice, this list of conditions and the following disclaimer.
14 .\" 2. Redistributions in binary form must reproduce the above copyright
15 .\" notice, this list of conditions and the following disclaimer in the
16 .\" documentation and/or other materials provided with the distribution.
18 .\" 3. Neither the name of the Institute nor the names of its contributors
19 .\" may be used to endorse or promote products derived from this software
20 .\" without specific prior written permission.
22 .\" THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
23 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
26 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
41 .Nm krb5_checksum_disable ,
42 .Nm krb5_checksum_is_collision_proof ,
43 .Nm krb5_checksum_is_keyed ,
44 .Nm krb5_checksumsize ,
45 .Nm krb5_cksumtype_valid ,
46 .Nm krb5_copy_checksum ,
47 .Nm krb5_create_checksum ,
48 .Nm krb5_crypto_get_checksum_type
49 .Nm krb5_free_checksum ,
50 .Nm krb5_free_checksum_contents ,
52 .Nm krb5_verify_checksum
53 .Nd creates, handles and verifies checksums
55 Kerberos 5 Library (libkrb5, -lkrb5)
59 .Li "typedef Checksum krb5_checksum;"
61 .Fo krb5_checksum_disable
62 .Fa "krb5_context context"
63 .Fa "krb5_cksumtype type"
66 .Fo krb5_checksum_is_collision_proof
67 .Fa "krb5_context context"
68 .Fa "krb5_cksumtype type"
71 .Fo krb5_checksum_is_keyed
72 .Fa "krb5_context context"
73 .Fa "krb5_cksumtype type"
76 .Fo krb5_cksumtype_valid
77 .Fa "krb5_context context"
78 .Fa "krb5_cksumtype ctype"
82 .Fa "krb5_context context"
83 .Fa "krb5_cksumtype type"
87 .Fo krb5_create_checksum
88 .Fa "krb5_context context"
89 .Fa "krb5_crypto crypto"
90 .Fa "krb5_key_usage usage"
94 .Fa "Checksum *result"
97 .Fo krb5_verify_checksum
98 .Fa "krb5_context context"
99 .Fa "krb5_crypto crypto"
100 .Fa "krb5_key_usage usage"
103 .Fa "Checksum *cksum"
106 .Fo krb5_crypto_get_checksum_type
107 .Fa "krb5_context context"
108 .Fa "krb5_crypto crypto"
109 .Fa "krb5_cksumtype *type"
112 .Fo krb5_free_checksum
113 .Fa "krb5_context context"
114 .Fa "krb5_checksum *cksum"
117 .Fo krb5_free_checksum_contents
118 .Fa "krb5_context context"
119 .Fa "krb5_checksum *cksum"
123 .Fa "krb5_context context"
124 .Fa "krb5_cksumtype cktype"
125 .Fa "const void *data"
128 .Fa "krb5_keyblock *key"
129 .Fa "Checksum *result"
132 .Fo krb5_copy_checksum
133 .Fa "krb5_context context"
134 .Fa "const krb5_checksum *old"
135 .Fa "krb5_checksum **new"
140 structure holds a Kerberos checksum.
141 There is no component inside
143 that is directly referable.
145 The functions are used to create and verify checksums.
146 .Fn krb5_create_checksum
147 creates a checksum of the specified data, and puts it in
154 specifies the checksum type to use; it must not be keyed. Otherwise
156 is an encryption context created by
157 .Fn krb5_crypto_init ,
160 specifies a key-usage.
162 .Fn krb5_verify_checksum
165 against the provided data.
167 .Fn krb5_checksum_is_collision_proof
168 returns true is the specified checksum is collision proof (that it's
169 very unlikely that two strings has the same hash value, and that it's
170 hard to find two strings that has the same hash). Examples of
171 collision proof checksums are MD5, and SHA1, while CRC32 is not.
173 .Fn krb5_checksum_is_keyed
174 returns true if the specified checksum type is keyed (that the hash
175 value is a function of both the data, and a separate key). Examples of
176 keyed hash algorithms are HMAC-SHA1-DES3, and RSA-MD5-DES. The
178 hash functions MD5, and SHA1 are not keyed.
180 .Fn krb5_crypto_get_checksum_type
181 returns the checksum type that will be used when creating a checksum for the given
184 This function is useful in combination with
185 .Fn krb5_checksumsize
186 when you want to know the size a checksum will
187 use when you create it.
189 .Fn krb5_cksumtype_valid
190 returns 0 or an error if the checksumtype is implemented and not
191 currently disabled in this kerberos library.
193 .Fn krb5_checksumsize
194 returns the size of the outdata of checksum function.
196 .Fn krb5_copy_checksum
197 returns a copy of the checksum
198 .Fn krb5_free_checksum
199 should use used to free the
203 .Fn krb5_free_checksum
204 free the checksum and the content of the checksum.
206 .Fn krb5_free_checksum_contents
207 frees the content of checksum in
211 calculates the HMAC over
219 Note that keyusage is not always used in checksums.
221 .Nm krb5_checksum_disable
222 globally disables the checksum type.
226 .Xr krb5_crypto_init 3 ,
227 .Xr krb5_c_encrypt 3 ,