libcanlock(3)
πΈ libcanlock(3) β the cl_get_key era πΈ
okay bestie, gather round, because we're diving into libcanlock β yes the manual name is literally libcanlock, iconic β and today's main character is a little function called cl_get_key. it's giving crypto girlboss and we're obsessed π
β¨ NAME β¨
cl_get_key β Create Cancel-Key with libcanlock π
π¦ SYNOPSIS π¦
ok so first you gotta invite the header in:
#include <libcanlock-3/canlock.h>
then the function itself, in all its glory:
char *cl_get_key(cl_hash_version hash,
const unsigned char *sec, size_t sec_len,
const unsigned char *msg, size_t msg_len);
and the supported values for hash (as of version 3.0.0 of libcanlock, no cap):
CL_SHA1 CL_SHA224 CL_SHA256 CL_SHA384 CL_SHA512
like, pick your fighter π
π DESCRIPTION π
so cl_get_key() creates a <c-key> element following the algorithm recommended by RFC 8315 in Section 4 β yes, the algorithm, and yes, we're being that precise. the hash algorithm you selected for <scheme> is used for the HMAC operation too, bestie, they're a package deal π«Ά
you pick the hash algorithm for <scheme> with the hash argument. slay.
the local secret goes in sec β and sec_len must be set to the length of sec. also, the length of the local secret should be at least the length of the hash you selected for <scheme> (that's 32 octets for SHA256, for the people in the back). highkey important, don't skip that π
the Message-ID of the target article β y'know, the one that should be cancelled or superseded β goes in msg. and yep, msg_len must be set to the length of msg. no guessing bestie, give it the real length π
here's a cute extra: the Message-ID msg can be prepended with an optional User-ID. the length of the User-ID must be added to msg_len. and the User-ID must not contain angle brackets β that's the vibe check, it has to pass β
π RETURN VALUE π
if everything goes off without a hitch, you get back a pointer to the result string. chef's kiss. β¨
otherwise? NULL. that's it. that's the whole story π
on success, it's on you (the caller, the main character) to call free() for the pointer you got back as your result. don't ghost your malloc'd memory, that's rude π
π AUTHORS π
- Dennis Preiser β (based in part on the implementation from G. J. Andruk for Version 2) π«Ά
- the base64 implementation is written by Kungliga Tekniska Hogskolan (Royal Institute of Technology, Stockholm, Sweden) πΈπͺ
- the hash algorithms are implemented with code from RFC 6234 π₯
π REPORTING BUGS π
found something cursed? report bugs to <mailto:michael.baeuerle@gmx.net>. be nice about it, it's giving constructive π
β STANDARDS β
libcanlock tries to comply with the following standards (overachiever behavior, we love it):
π SEE ALSO π
go read these next, bestie, iykyk:
and that's the whole page, bestie π¦ this was libcanlock 3.3.3, dated 2026-07-06, straight from the Unix corner of the internet. periodt. πβ¨
π¦ where this page comes from
- epel 10: libcanlock-devel 3.3.3-2.el10_3 Β· BSD-3-Clause AND NLPL AND ICU
- π the page's license: ICU
- (c) 2018-2024 Michael Baeuerle
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms