---
name: "cl_verify"
section: "3"
platform: "linux"
package: "libcanlock-dev"
version: "3.3.1-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/cl_verify"
---

# cl\_verify(3)

Check whether key and lock strings match with libcanlock

## NAME

cl\_verify - Check whether key and lock strings match with libcanlock

## SYNOPSIS

```
#include <libcanlock-3/canlock.h>

int cl_verify(cl_hash_version hash,
              const char *c_key_string, const char *c_lock_string);
```

Supported values for *hash* (by version 3.0.0 of libcanlock):\
 CL\_SHA1 CL\_SHA224 CL\_SHA256 CL\_SHA384 CL\_SHA512

## DESCRIPTION

The **cl\_verify**() function checks whether a \<c-key-string\> and a \<c-lock-string\> element according to RFC 8315 matches or not.

The hash algorithm for \<scheme\> is selected with *hash*.

The \<c-key-string\> element is specified with *c\_key\_string* and the \<c-lock-string\> element with *c\_lock\_string*.

The function **cl\_split**() can be used to extract \<c-key-string\> from \<c-key\> (or \<c-lock-string\> from \<c-lock\> respectively) elements.

Consider the function **cl\_verify\_multi**() to check multiple keys against multiple locks.

## RETURN VALUE

Upon successful completion zero is returned.\
 All other values indicate an error.

## 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

Report bugs to \<mailto:michael.baeuerle@gmx.net\>.

## STANDARDS

**libcanlock** tries to comply with the following standards:

RFC 5537, RFC 6234, RFC 8315

## SEE ALSO

[**cl\_clear\_secret**(3)](/cl_clear_secret/3.md), [**cl\_get\_key**(3)](/cl_get_key/3.md), [**cl\_get\_lock**(3)](/cl_get_lock/3.md), [**cl\_split**(3)](/cl_split/3.md), [**cl\_verify\_multi**(3)](/cl_verify_multi/3.md), **[cl\_hp\_get\_field(3)](/cl_hp_get_field/3.md),** **[cl\_hp\_unfold\_field(3)](/cl_hp_unfold_field/3.md),** **[cl\_hp\_parse\_field(3)](/cl_hp_parse_field/3.md),** [**canlock**(1)](/canlock/1.md), [**canlock-hfp**(1)](/canlock-hfp/1.md), [**canlock-mhp**(1)](/canlock-mhp/1.md)
