KRB5_C_MAKE_CHECKSUM(3)
๐ KRB5_C_MAKE_CHECKSUM ๐
okay bestie, sit down, hydrate, because we're about to talk about the Kerberos 5 crypto API and honestly? it's giving โจcryptographic excellenceโจ. this is the manual page for KRB5_C_MAKE_CHECKSUM(3), and the whole little fam of krb5_c_* functions is in here. no cap. ๐
๐ธ NAME ๐ธ
so the icons in this friend group are:
krb5_c_block_sizekrb5_c_decryptkrb5_c_encryptkrb5_c_encrypt_lengthkrb5_c_enctype_comparekrb5_c_get_checksumkrb5_c_is_coll_proof_cksumkrb5_c_is_keyed_cksumkrb5_c_keylengthkrb5_c_make_checksumkrb5_c_make_random_keykrb5_c_set_checksumkrb5_c_valid_cksumtypekrb5_c_valid_enctypekrb5_c_verify_checksumkrb5_c_checksum_length
and collectively they're the Kerberos 5 crypto API. the way that's a whole squad ๐ซถ
๐ LIBRARY ๐
this lives in the Kerberos 5 Library, aka libkrb5, and you link it with -lkrb5. periodt.
โจ SYNOPSIS โจ
first, the classic move:
#include <krb5.h>
then, the whole lineup, exactly as written, no edits, we don't touch the source around here:
krb5_error_code
krb5_c_block_size(krb5_context context, krb5_enctype enctype,
size_t *blocksize);
krb5_error_code
krb5_c_decrypt(krb5_context context, const krb5_keyblock key,
krb5_keyusage usage, const krb5_data *ivec, krb5_enc_data *input,
krb5_data *output);
krb5_error_code
krb5_c_encrypt(krb5_context context, const krb5_keyblock *key,
krb5_keyusage usage, const krb5_data *ivec, const krb5_data *input,
krb5_enc_data *output);
krb5_error_code
krb5_c_encrypt_length(krb5_context context, krb5_enctype enctype,
size_t inputlen, size_t *length);
krb5_error_code
krb5_c_enctype_compare(krb5_context context, krb5_enctype e1,
krb5_enctype e2, krb5_boolean *similar);
krb5_error_code
krb5_c_make_random_key(krb5_context context, krb5_enctype enctype,
krb5_keyblock *random_key);
krb5_error_code
krb5_c_make_checksum(krb5_context context, krb5_cksumtype cksumtype,
const krb5_keyblock *key, krb5_keyusage usage,
const krb5_data *input, krb5_checksum *cksum);
krb5_error_code
krb5_c_verify_checksum(krb5_context context, const krb5_keyblock *key,
krb5_keyusage usage, const krb5_data *data,
const krb5_checksum *cksum, krb5_boolean *valid);
krb5_error_code
krb5_c_checksum_length(krb5_context context, krb5_cksumtype cksumtype,
size_t *length);
krb5_error_code
krb5_c_get_checksum(krb5_context context, const krb5_checksum *cksum,
krb5_cksumtype *type, krb5_data **data);
krb5_error_code
krb5_c_set_checksum(krb5_context context, krb5_checksum *cksum,
krb5_cksumtype type, const krb5_data *data);
krb5_boolean
krb5_c_valid_enctype(krb5_enctype, etype");
krb5_boolean
krb5_c_valid_cksumtype(krb5_cksumtype ctype);
krb5_boolean
krb5_c_is_coll_proof_cksum(krb5_cksumtype ctype);
krb5_boolean
krb5_c_is_keyed_cksum(krb5_cksumtype ctype);
krb5_error_code
krb5_c_keylengths(krb5_context context, krb5_enctype enctype,
size_t *inlength, size_t *keylength);
๐ฆ DESCRIPTION ๐ฆ
okay so the plot: every function that starts with krb5_c is a compat function with MIT kerberos. iykyk. ๐ค
now, the krb5_enc_data structure? she holds an encrypted data (yes, the original says it like that, we respect the typo in spirit but not in copy). there are two publicly accessible members of krb5_enc_data:
enctypeโ holds the encryption type of the data that got encryptedciphertextโ akrb5_datathat might contain the encrypted data
๐ the functions, one by one ๐
krb5_c_block_size()โ returns the blocksize of the encryption type. that's it, that's the whole job, and she does it flawlessly ๐krb5_c_decrypt()โ decryptsinputand stores the data inoutput. ifivecisNULL, the default initialization vector for that encryption type gets used. convenient? yes. iconic? also yes.krb5_c_encrypt()โ takes the plaintext ininput, encrypts it, and stores the ciphertext inoutput. main character energy fr fr.krb5_c_encrypt_length()โ returns the length the encrypted data will be, given the plaintext length. future-telling but make it crypto ๐ฎkrb5_c_enctype_compare()โ compares two encryption types and tells you if they use compatible encryption key types.krb5_c_make_checksum()โ creates a checksumcksumwith the checksum typecksumtypeof the data indata.keyandusageget used if the checksum is a keyed checksum type. returns0or an error code.krb5_c_verify_checksum()โ verifies the checksum of the data incksumthat was created withkeyusing the key usageusage. the verify-out param gets set to non-zero if the checksum verifies correctly and zero if it doesn't (the signature calls itvalid, same vibe). returns0or an error code.krb5_c_checksum_length()โ returns the length of the checksum. short and sweet.krb5_c_set_checksum()โ sets thekrb5_checksumstructure giventypeanddata.
โ ๏ธ important bestie: the content ofcksumshould be freeed withkrb5_c_free_checksum_contents(). (yes, "freeed" โ that's the original spelling, we're keeping it, it's part of the lore.) don't leak, it's not cute ๐
krb5_c_get_checksum()โ retrieves the components of thekrb5_checksumstructure.
๐datashould be freed withkrb5_free_data(). and if eitherdataorchecksumisn't needed by your application, you can just pass inNULL. flexible queen.
krb5_c_valid_enctype()โ returns true ifetypeis a valid encryption type.krb5_c_valid_cksumtype()โ returns true ifctypeis a valid checksum type.krb5_c_is_keyed_cksum()โ returns true ifctypeis a keyed checksum type.krb5_c_is_coll_proof_cksum()โ returns true ifctypeis a collision proof checksum type.krb5_c_keylengths()โ returns the minimum length (inlength) in bytes needed to create a key, plus the length (keylength) of the resulting key, for theenctype. two answers in one call, efficient diva ๐
๐ SEE ALSO ๐
go read these next, bestie, they're the extended universe:
and that's the whole page, no notes, we ate that up ๐โญ
this lil masterpiece came from HEIMDAL, dated Nov 17, 2006, and it's filed under KRB5_C_MAKE_CHECKSUM(3). slay, bye bestie ๐๐ฆ๐
๐ฆ where this page comes from
- alpine 3.22: heimdal-doc 7.8.0-r4 ยท BSD-3-Clause
- alpine 3.23: heimdal-doc 7.8.0-r5 ยท BSD-3-Clause
- alpine 3.24: heimdal-doc 7.8.0-r5 ยท BSD-3-Clause
- debian bookworm: heimdal-dev 7.8.git20221117.28daf24+dfsg-2 ยท BSD-3-Clause
- debian trixie: heimdal-dev 7.8.git20221117.28daf24+dfsg-9+deb13u1 ยท BSD-3-Clause
- epel 10: heimdal-devel 7.8.0-26.el10_2 ยท BSD-2-Clause AND BSD-3-Clause AND HPND-export-US AND HPND-export2-US AND LicenseRef-Fedora-Public-Domain
- epel 9: heimdal-devel 7.8.0-5.el9 ยท BSD and MIT
- fedora 43: heimdal-devel 7.8.0-26.fc43 ยท BSD-2-Clause AND BSD-3-Clause AND HPND-export-US AND HPND-export2-US AND LicenseRef-Fedora-Public-Domain
- fedora 43: heimdal-devel 7.8.0-26.fc43 ยท BSD-2-Clause AND BSD-3-Clause AND HPND-export-US AND HPND-export2-US AND LicenseRef-Fedora-Public-Domain
- fedora 44: heimdal-devel 7.8.0-26.fc43 ยท BSD-2-Clause AND BSD-3-Clause AND HPND-export-US AND HPND-export2-US AND LicenseRef-Fedora-Public-Domain
- fedora 44: heimdal-devel 7.8.0-26.fc43 ยท BSD-2-Clause AND BSD-3-Clause AND HPND-export-US AND HPND-export2-US AND LicenseRef-Fedora-Public-Domain
- fedora 44: heimdal-devel 7.8.0-28.fc44 ยท BSD-2-Clause AND BSD-3-Clause AND HPND-export-US AND HPND-export2-US AND LicenseRef-Fedora-Public-Domain
- fedora 44: heimdal-devel 7.8.0-28.fc44 ยท BSD-2-Clause AND BSD-3-Clause AND HPND-export-US AND HPND-export2-US AND LicenseRef-Fedora-Public-Domain
- nixpkgs unstable: heimdal 7.8.0-unstable-2024-09-10
- ubuntu jammy: heimdal-dev 7.7.0+dfsg-3ubuntu1 ยท BSD-3-Clause
- ubuntu noble: heimdal-dev 7.8.git20221117.28daf24+dfsg-5ubuntu3 ยท BSD-3-Clause
- ubuntu questing: heimdal-dev 7.8.git20221117.28daf24+dfsg-9ubuntu1
- ubuntu resolute: heimdal-dev 7.8.git20221117.28daf24+dfsg-11ubuntu1 ยท BSD-3-Clause
- ubuntu stonking: heimdal-dev 7.8.git20240113.1b4565a+dfsg-2ubuntu1 ยท BSD-3-Clause
- Copyright (c) 2003 - 2006 Kungliga Tekniska Hรถgskolan
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms