---
name: "krb5_c_block_size"
section: "3"
platform: "linux"
package: "heimdal-dev"
version: "7.8.git20221117.28daf24+dfsg-9+deb13u1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/krb5_c_block_size"
---

# krb5\_c\_block\_size(3)

Kerberos 5 crypto API

## NAME

**krb5\_c\_block\_size**, **krb5\_c\_decrypt**, **krb5\_c\_encrypt**, **krb5\_c\_encrypt\_length**, **krb5\_c\_enctype\_compare**, **krb5\_c\_get\_checksum**, **krb5\_c\_is\_coll\_proof\_cksum**, **krb5\_c\_is\_keyed\_cksum**, **krb5\_c\_keylength**, **krb5\_c\_make\_checksum**, **krb5\_c\_make\_random\_key**, **krb5\_c\_set\_checksum**, **krb5\_c\_valid\_cksumtype**, **krb5\_c\_valid\_enctype**, **krb5\_c\_verify\_checksum**, **krb5\_c\_checksum\_length** – Kerberos 5 crypto API

## LIBRARY

Kerberos 5 Library (libkrb5, -lkrb5)

## SYNOPSIS

**#include \<krb5.h\>**

*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

The functions starting with krb5\_c are compat functions with MIT kerberos.

The krb5\_enc\_data structure holds and encrypted data. There are two public accessible members of krb5\_enc\_data. enctype that holds the encryption type of the data encrypted and ciphertext that is a *krb5\_data* that might contain the encrypted data.

**krb5\_c\_block\_size**() returns the blocksize of the encryption type.

**krb5\_c\_decrypt**() decrypts *input* and store the data in *output.* If *ivec* is NULL the default initialization vector for that encryption type will be used.

**krb5\_c\_encrypt**() encrypts the plaintext in *input* and store the ciphertext in *output*.

**krb5\_c\_encrypt\_length**() returns the length the encrypted data given the plaintext length.

**krb5\_c\_enctype\_compare**() compares to encryption types and returns if they use compatible encryption key types.

**krb5\_c\_make\_checksum**() creates a checksum *cksum* with the checksum type *cksumtype* of the data in *data*. *key* and *usage* are used if the checksum is a keyed checksum type. Returns 0 or an error code.

**krb5\_c\_verify\_checksum**() verifies the checksum of *data* in *cksum* that was created with *key* using the key usage *usage*. *verify* is set to non-zero if the checksum verifies correctly and zero if not. Returns 0 or an error code.

**krb5\_c\_checksum\_length**() returns the length of the checksum.

**krb5\_c\_set\_checksum**() sets the krb5\_checksum structure given *type* and *data*. The content of *cksum* should be freeed with **krb5\_c\_free\_checksum\_contents**().

**krb5\_c\_get\_checksum**() retrieves the components of the krb5\_checksum. structure. *data* should be free with **krb5\_free\_data**(). If some either of *data* or *checksum* is not needed for the application, NULL can be passed in.

**krb5\_c\_valid\_enctype**() returns true if *etype* is a valid encryption type.

**krb5\_c\_valid\_cksumtype**() returns true if *ctype* is a valid checksum type.

**krb5\_c\_is\_keyed\_cksum**() return true if *ctype* is a keyed checksum type.

**krb5\_c\_is\_coll\_proof\_cksum**() returns true if *ctype* is a collision proof checksum type.

**krb5\_c\_keylengths**() return the minimum length *(*, *inlength*) bytes needed to create a key and the length *(*, *keylength*) of the resulting key for the *enctype*.

## SEE ALSO

[krb5(3)](/krb5/3.md), [krb5\_create\_checksum(3)](/krb5_create_checksum/3.md), [krb5\_free\_data(3)](/krb5_free_data/3.md), [kerberos(8)](/kerberos/8.md)
