| 1 |
.\"============================================================================= |
| 2 |
.\" Header |
| 3 |
.\" |
| 4 |
.\" Copyright (c) 2018-2024 Michael Baeuerle |
| 5 |
.\" |
| 6 |
.\" All rights reserved. |
| 7 |
.\" |
| 8 |
.\" Permission is hereby granted, free of charge, to any person obtaining |
| 9 |
.\" a copy of this software and associated documentation files (the |
| 10 |
.\" "Software"), to deal in the Software without restriction, including |
| 11 |
.\" without limitation the rights to use, copy, modify, merge, publish, |
| 12 |
.\" distribute, and/or sell copies of the Software, and to permit persons |
| 13 |
.\" to whom the Software is furnished to do so, provided that the above |
| 14 |
.\" copyright notice(s) and this permission notice appear in all copies of |
| 15 |
.\" the Software and that both the above copyright notice(s) and this |
| 16 |
.\" permission notice appear in supporting documentation. |
| 17 |
.\" |
| 18 |
.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 19 |
.\" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 20 |
.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT |
| 21 |
.\" OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR |
| 22 |
.\" HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY |
| 23 |
.\" SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER |
| 24 |
.\" RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF |
| 25 |
.\" CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN |
| 26 |
.\" CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 27 |
.\" |
| 28 |
.\" Except as contained in this notice, the name of a copyright holder |
| 29 |
.\" shall not be used in advertising or otherwise to promote the sale, use |
| 30 |
.\" or other dealings in this Software without prior written authorization |
| 31 |
.\" of the copyright holder. |
| 32 |
.\" |
| 33 |
.\" SPDX-License-Identifier: ICU |
| 34 |
.\" |
| 35 |
.\" |
| 36 |
.TH $NAME 3 $DATE Unix "$NAME $VERSION manual" |
| 37 |
.\" |
| 38 |
.\" |
| 39 |
.\"============================================================================= |
| 40 |
.\" NAME section |
| 41 |
.\" |
| 42 |
.SH NAME |
| 43 |
cl_get_key - Create Cancel-Key with $NAME |
| 44 |
.\" |
| 45 |
.\" |
| 46 |
.\"============================================================================= |
| 47 |
.\" SYNOPSIS section |
| 48 |
.\" |
| 49 |
.SH SYNOPSIS |
| 50 |
.nf |
| 51 |
.B #include <libcanlock-3/canlock.h> |
| 52 |
.sp |
| 53 |
.BI "char *cl_get_key(cl_hash_version " hash , |
| 54 |
.BI " const unsigned char *" sec ", size_t " sec_len , |
| 55 |
.BI " const unsigned char *" msg ", size_t " msg_len ); |
| 56 |
.fi |
| 57 |
.sp |
| 58 |
Supported values for |
| 59 |
.I hash |
| 60 |
(by version 3.0.0 of $NAME): |
| 61 |
.br |
| 62 |
CL_SHA1 CL_SHA224 CL_SHA256 CL_SHA384 CL_SHA512 |
| 63 |
.\" |
| 64 |
.\" |
| 65 |
.\"============================================================================= |
| 66 |
.\" DESCRIPTION section |
| 67 |
.\" |
| 68 |
.SH DESCRIPTION |
| 69 |
The |
| 70 |
.BR cl_get_key () |
| 71 |
function creates a <c-key> element according to the algorithm recommended by |
| 72 |
RFC 8315 in Section 4. The hash algorithm selected for <scheme> is used for the |
| 73 |
HMAC operation too. |
| 74 |
.sp |
| 75 |
The hash algorithm for <scheme> is selected with |
| 76 |
.IR "hash" . |
| 77 |
.sp |
| 78 |
The local secret is specified with |
| 79 |
.IR sec " (" sec_len |
| 80 |
must be set to the length of |
| 81 |
.IR "sec" ). |
| 82 |
.br |
| 83 |
The length of the local secret should be at least the length of the hash |
| 84 |
that was selected for <scheme> (32 octets for SHA256). |
| 85 |
.sp |
| 86 |
The Message-ID of the target article (the one that should be cancelled or |
| 87 |
superseded) is specified with |
| 88 |
.IR msg " (" msg_len |
| 89 |
must be set to the length of |
| 90 |
.IR "msg" ). |
| 91 |
.sp |
| 92 |
The Message-ID |
| 93 |
.IR "msg" |
| 94 |
can be prepended with an optional User-ID. The length of the User-ID must be |
| 95 |
added to |
| 96 |
.IR "msg_len" . |
| 97 |
The User-ID must not contain angle brackets. |
| 98 |
.\" |
| 99 |
.\" |
| 100 |
.\"============================================================================= |
| 101 |
.\" RETURN VALUE section |
| 102 |
.\" |
| 103 |
.SH RETURN VALUE |
| 104 |
Upon successful completion a pointer to the result string is returned. |
| 105 |
Otherwise, |
| 106 |
.B NULL |
| 107 |
is returned. |
| 108 |
.sp |
| 109 |
On success the caller is responsible to call |
| 110 |
.BR free () |
| 111 |
for the pointer returned as result. |
| 112 |
.\" |
| 113 |
.\" |
| 114 |
.\"============================================================================= |
| 115 |
.\" AUTHORS section |
| 116 |
.\" |
| 117 |
.SH AUTHORS |
| 118 |
Dennis Preiser |
| 119 |
.br |
| 120 |
(Based in part on the implementation from G. J. Andruk for Version 2) |
| 121 |
.sp |
| 122 |
The base64 implementation is written by Kungliga Tekniska Hogskolan |
| 123 |
(Royal Institute of Technology, Stockholm, Sweden) |
| 124 |
.sp |
| 125 |
The hash algorithms are implemented with code from RFC 6234 |
| 126 |
.\" |
| 127 |
.\" |
| 128 |
.\"============================================================================= |
| 129 |
.\" REPORTING BUGS section |
| 130 |
.\" |
| 131 |
.SH REPORTING BUGS |
| 132 |
Report bugs to <mailto:$BUGREPORT>. |
| 133 |
.\" |
| 134 |
.\" |
| 135 |
.\"============================================================================= |
| 136 |
.\" STANDARDS section |
| 137 |
.\" |
| 138 |
.SH STANDARDS |
| 139 |
.B $NAME |
| 140 |
tries to comply with the following standards: |
| 141 |
.PP |
| 142 |
RFC 5537, RFC 6234, RFC 8315 |
| 143 |
.\" |
| 144 |
.\" |
| 145 |
.\"============================================================================= |
| 146 |
.\" SEE ALSO section |
| 147 |
.\" |
| 148 |
.SH SEE ALSO |
| 149 |
.BR free (3), |
| 150 |
.BR cl_clear_secret (3), |
| 151 |
.BR cl_get_lock (3), |
| 152 |
.BR cl_split (3), |
| 153 |
.BR cl_verify (3), |
| 154 |
.BR cl_verify_multi (3), |
| 155 |
.BR canlock (1) |
| 156 |
.\" |
| 157 |
.\" |
| 158 |
.\" EOF |